π Week 5 Homework β Feedback
π Week 5 Homework β Feedback
Student: Anna De Falco
Assignment: Solving Nonlinear Equations in Economics
β Overall Assessment
Result: β More than 50% Correct
Submission demonstrates strong implementation of all three exercises. Exercise 1 IS-LM correctly handles both positive and negative interest rate branches with proper plotting (as you noted, Figure 1 looks correct). Exercise 2 bisection correctly updates function values (fa, fb) at endpoints (lines 84-88), but you noted that Figure 2 shows wrong results despite correct implementation - this needs investigation. Exercise 3 demonstrates correct comparison between bisection and damped Newton methods. The code structure is clean with proper organization.
π Task-by-Task Check
| Task | Description | Status | Notes |
|---|---|---|---|
| 1.1 | Parameter setup for IS-LM | β | All parameters correctly defined |
| 1.2 | IS-LM system definition | β | Correct formulation: [Y - ...; MP - k*Y + lambda*i] |
| 1.3 | Solve from two initial guesses | β | Two guesses provided (x_guess1=[800;1], x_guess2=[200;-1]) |
| 1.4 | Plot IS and LM curves | β | Creates proper IS-LM plot with both positive and negative branches |
| 1.5 | Verify positive interest rate | β | Correctly identifies and marks positive and negative equilibrium branches |
| 2.1 | Parameter setup for labor supply | β | All parameters correctly defined |
| 2.2 | Define Z(h) function | β οΈ | Redefines Z inside loop (line 63), which is inefficient but shouldnβt cause errors |
| 2.3 | Loop over sigma values | β | Correctly loops over sigma β {1,2,3,4,5} |
| 2.4 | Solve using Bisection method | β οΈ | Bisection updates fa/fb correctly, but check if results are correct |
| 2.5 | Plot h*(sigma) and interpret | β | Creates plot but shows incorrect results (you noted βsecond figure noβ) - need to investigate why |
| 3.1 | Implement Bisection method | β | Correct bisection with proper endpoint updates (lines 125-129) |
| 3.2 | Implement Damped Newton method | β | Implements damped Newton with alpha=0.5, analytical derivative, and bounds projection |
| 3.3 | Test from multiple starting guesses | β | Tests from three guesses (0.2, 0.5, 0.8) |
| 3.4 | Record iterations and residuals | β | Records and displays iterations and residuals for both methods |
| 3.5 | Compare and discuss convergence | β οΈ | Provides output table but no explicit discussion comparing methods |
π Technical Implementation
- IS-LM System: Correct implementation with two initial guesses, handling both positive and negative branches
- Labor Supply Function: Correct mathematical formulation
- Bisection Method: β
Correctly implemented with proper endpoint updates (
fa = fc,fb = fc) - Damped Newton: Correct implementation with alpha=0.5, analytical derivative, bounds projection, and derivative check
- Error Handling: Includes sign change verification and derivative check
- Figure Management: β Saves figures properly (PNG format)
- Advanced Features: Includes proper bounds projection and derivative safeguards for Newton method
π¬ Style & Clarity
- Code Quality: Clear structure with appropriate organization
- Variable Naming: Clear names (
h_sol,sigma_vals,x_sol1,x_sol2) - Comments: Minimal but appropriate comments
- Output: Appropriate use of
fprintfto display results - Organization: Clear separation into three exercises
π Visual Output Assessment
Figure 1: IS-LM Equilibrium β
- Layout: Plot with IS and LM curves (both positive and negative IS branches)
- Features: Correctly identifies both positive and negative equilibrium branches
- Styling: Appropriate styling with proper labels and legend
- Saving: β Saves as PNG file
- Your note: βFirst figure looks correctβ
Figure 2: Labor Supply h*(Ο) β
- Layout: Plot showing h* vs sigma values
- Features: Shows labor supply for different risk aversion parameters
- Styling: Appropriate styling with proper labels
- Saving: β Saves as PNG file
- Issue: Your note: βsecond figure no [looks wrong]β - the plot shows incorrect results despite correct bisection implementation
β Suggestions for Improvement
- Critical: Investigate Exercise 2 results - bisection implementation is correct but results are wrong
- Important: Add explicit discussion comparing bisection vs Newton convergence in Exercise 3
- Style: Consider saving figures as both PNG and .fig for better accessibility
- Verification: Add output verification to check that results are economically reasonable
π― Summary
Good submission with issue in Exercise 2. The student demonstrates strong understanding of numerical methods and implements all three exercises correctly. Exercise 1 IS-LM is correctly solved with two initial guesses and handles both positive and negative branches appropriately (as you confirmed, Figure 1 looks correct). Exercise 2 bisection correctly updates function values at endpoints, but the results are wrong (as you noted, Figure 2 looks wrong). Exercise 3 is correctly implemented with proper comparison between bisection and damped Newton methods. The code structure is appropriate with proper figure management.
Grade Level: β More than 50% Correct (12/15 tasks fully correct, 3/15 partially correct, 0/15 incorrect)