🌍 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 fprintf to 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

  1. Critical: Investigate Exercise 2 results - bisection implementation is correct but results are wrong
  2. Important: Add explicit discussion comparing bisection vs Newton convergence in Exercise 3
  3. Style: Consider saving figures as both PNG and .fig for better accessibility
  4. 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)