🌍 Week 5 Homework β€” Feedback

Student: Alessandra Nishaj
Assignment: Solving Nonlinear Equations in Economics


βœ… Overall Assessment

Result: βœ… More than 50% Correct

Submission implements all three exercises with good organization and uses manual Newton method for Exercise 1. Exercise 1 uses manual Newton iteration instead of fsolve, which demonstrates understanding. Exercise 2 and 3 bisection have a critical numerical error: the method does not update function values (fa, fb) at endpoints (lines 101, 143), causing convergence to the wrong root. This is the same critical bisection error affecting several other students. Exercise 3 damped Newton is correctly implemented. The figures look correct as you noted.


πŸ” 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 (alternative but correct)
1.3 Solve from two initial guesses βœ… Two guesses provided using manual Newton method
1.4 Plot IS and LM curves βœ… Creates IS-LM plot with curves and equilibrium point (you noted β€œlooks correct”)
1.5 Verify positive interest rate βœ… Finds equilibrium with positive interest rate
2.1 Parameter setup for labor supply βœ… All parameters correctly defined
2.2 Define Z(h) function βœ… Correct formulation: c(h)^(-sigma)*(1-tau)*w - chi*(1-h)^phi
2.3 Loop over sigma values βœ… Correctly loops over sigma ∈ {1,2,3,4,5}
2.4 Solve using Bisection method ❌ Critical Error: Bisection does not update function values at endpoints (line 101: Z(a0)*Z(c) re-evaluates Z(a0))
2.5 Plot h*(sigma) and interpret βœ… Creates plot showing h* vs sigma values (you noted β€œlooks correct”)
3.1 Implement Bisection method ❌ Same critical bisection error (line 143: re-evaluates Z(a0))
3.2 Implement Damped Newton method βœ… Implements damped Newton with alpha=0.5, analytical derivative, derivative check, and bounds protection
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
3.5 Compare and discuss convergence ⚠️ Provides output but no explicit discussion comparing methods

πŸ“ˆ Technical Implementation

  • IS-LM System: Uses manual Newton method instead of fsolve - demonstrates understanding
  • Labor Supply Function: Correct mathematical formulation
  • Bisection Method: ❌ Critical error - does not update function values at endpoints (same error as Pablo Romanella, Michele Nascia, Chiara Tombolini, Sebastiano Bacchi)
  • Damped Newton: Correct implementation with alpha=0.5, analytical derivative, derivative check, and bounds protection
  • Error Handling: Includes sign change verification and derivative checks
  • Figure Management: βœ… Saves figures as PNG files (you noted β€œboth figures look correct”)
  • Advanced Features: Includes proper derivative safeguards and bounds protection for Newton method

πŸ’¬ Style & Clarity

  • Code Quality: Good structure with clear organization
  • Variable Naming: Clear names (h_star, sigma_values, i_vec)
  • Comments: Minimal but appropriate comments
  • Output: Appropriate use of fprintf to display results
  • Organization: Clear separation into three exercises with headers

πŸ“Š Visual Output Assessment

Figure 1: IS-LM Equilibrium βœ…

  • Layout: Plot with IS and LM curves and equilibrium point
  • Features: Correctly identifies equilibrium
  • Styling: Appropriate styling with proper labels and legend
  • Saving: βœ… Saves as PNG file
  • Your note: β€œBoth figures look 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
  • Your note: β€œBoth figures look correct”

βœ… Suggestions for Improvement

  1. Critical: Fix bisection in Exercises 2 and 3 - must update function values when updating brackets:
    fa = Z(a0); fb = Z(b0);  % Store initial values
    if fa * fc < 0
        b0 = c; fb = fc;  % Update function value
    else
        a0 = c; fa = fc;  % Update function value
    end
    
  2. Important: Add explicit discussion comparing bisection vs Newton convergence in Exercise 3
  3. Style: Good use of manual Newton method for Exercise 1 - demonstrates understanding
  4. Verification: Consider adding output verification to check that results are economically reasonable

🎯 Summary

Good submission with critical bisection error. The student demonstrates understanding of numerical methods and implements all three exercises. Exercise 1 uses manual Newton method instead of fsolve, demonstrating good understanding of the algorithm. Exercise 2 and 3 bisection implementations have the critical error of not updating function values (fa, fb) when updating brackets (same error as Pablo, Michele, Chiara, Sebastiano), causing potential convergence to wrong roots. Exercise 3 damped Newton is correctly implemented with proper safeguards. The code structure is appropriate with figures properly saved, and the figures look correct as you confirmed.

Grade Level: βœ… More than 50% Correct (11/15 tasks fully correct, 1/15 partially correct, 3/15 incorrect)