🌍 Week 5 Homework β€” Feedback

Student: Chiara Tombolini
Assignment: Solving Nonlinear Equations in Economics


βœ… Overall Assessment

Result: βœ… More than 50% Correct

Good submission implementing all three exercises. Exercise 1 IS-LM is correctly implemented with two initial guesses and proper plotting. Exercise 2 has a critical numerical error: the bisection method does not update function values (fa, fb) after updating brackets, causing convergence to the wrong root (this is why Figure 2 looks wrong). Exercise 3 demonstrates proper comparison between bisection and damped Newton methods with comprehensive output. The code is well-structured with appropriate documentation.


πŸ” 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
1.3 Solve from two initial guesses βœ… Two guesses provided (x0_1=[500,10], x0_2=[800,20])
1.4 Plot IS and LM curves βœ… Creates IS-LM plot with equilibrium points (you noted β€œFigure 1 looks correct”)
1.5 Verify positive interest rate βœ… Solves and plots equilibria
2.1 Parameter setup for labor supply βœ… All parameters correctly defined
2.2 Define Z(h) function βœ… Correct formulation
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, causing convergence to wrong root. Code evaluates Z(a_bis)*Z(mid) without storing fa, leading to incorrect bracket updates.
2.5 Plot h*(sigma) and interpret ❌ Creates plot but shows incorrect results (you noted β€œFigure 2 no”) - this is caused by the critical bisection error
3.1 Implement Bisection method βœ… Correct bisection implementation
3.2 Implement Damped Newton method βœ… Implements damped Newton with alpha=0.5 and analytical derivative
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 all iterations and residuals in table
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
  • Labor Supply Function: Correct mathematical formulation
  • Bisection Method: ❌ Critical error - does not update function values at endpoints, causing wrong root convergence
  • Damped Newton: Correct implementation with alpha=0.5 and analytical derivative
  • Error Handling: Includes sign change checks and proper convergence criteria
  • Figure Management: βœ… Saves figures as PNG and .fig files
  • Advanced Features: Includes proper bounds checking for Newton method

πŸ’¬ Style & Clarity

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

πŸ“Š Visual Output Assessment

Figure 1: IS-LM Equilibrium βœ…

  • Layout: Plot with IS and LM curves and equilibrium points
  • Features: Correctly identifies equilibria from both guesses
  • Styling: Appropriate styling with proper labels and legend
  • Saving: βœ… Saves as PNG and .fig files
  • Your note: β€œFigure 1 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 and .fig files
  • Issue: Your note: β€œFigure 2 no [looks wrong]” - the plot shows incorrect results

βœ… Suggestions for Improvement

  1. Critical: Fix bisection in Exercise 2 - must update fa/fb values when updating brackets: if fa * fm < 0, b = m; fb = fm; else, a = m; fa = fm; end
  2. Important: Add explicit discussion comparing bisection vs Newton convergence in Exercise 3
  3. Style: Consider using exportgraphics() instead of saveas() for higher resolution
  4. Verification: Add verification that results are economically reasonable (h* should be in [0,1])
  5. Documentation: Add more detailed comments explaining the methodology

🎯 Summary

Good submission with incorrect results in Exercise 2. The student demonstrates understanding of numerical methods and implements all three exercises. Exercise 1 is correctly solved with two initial guesses and produces correct plots (as you confirmed). Exercise 2 uses correct bisection methodology but shows incorrect results in the plot. Exercise 3 is implemented correctly with proper comparison between bisection and damped Newton methods. The code structure is appropriate with figures saved properly.

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