🌍 Week 5 Homework β€” Feedback

Student: Giovanni Rampello
Assignment: Solving Nonlinear Equations in Economics


βœ… Overall Assessment

Result: βœ… More than 50% Correct

Strong submission implementing all three exercises with correct bisection logic (properly updates function values Zl/Zh at endpoints). Exercise 1 IS-LM is correctly solved with two initial guesses. Exercise 2 bisection correctly updates function values (lines 122-126) and handles cases where Z doesn’t change sign. Exercise 3 demonstrates correct comparison between bisection and damped Newton with good discussion. However, no figures were submitted (code creates plots but doesn’t save them with saveas() or exportgraphics()), which is a significant issue.


πŸ” 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 - ...; M_P - k*Y + lambda*i]
1.3 Solve from two initial guesses βœ… Two guesses provided (x0_1=[850;1.25], x0_2=[840;1.00])
1.4 Plot IS and LM curves βœ… Creates IS-LM plot with curves and equilibrium point marked (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 βœ… Correct bisection implementation - updates Zl and Zh properly (lines 122-126)
2.5 Plot h*(sigma) and interpret βœ… Creates plot showing h* vs sigma values (correct)
3.1 Implement Bisection method βœ… Correct bisection with proper endpoint updates (lines 181-185)
3.2 Implement Damped Newton method βœ… Implements damped Newton with alpha=0.5, analytical derivative, 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 all iterations and residuals in table format
3.5 Compare and discuss convergence βœ… Provides discussion comparing bisection vs Newton convergence (lines 214-227)

πŸ“ˆ Technical Implementation

  • IS-LM System: Correct implementation with two initial guesses
  • Labor Supply Function: Correct mathematical formulation
  • Bisection Method: βœ… Correctly implemented with proper endpoint updates (Zl = Zm, Zh = Zm)
  • Damped Newton: Correct implementation with alpha=0.5, analytical derivative, derivative check, and bounds protection
  • Error Handling: Includes sign change verification before bisection and derivative checks
  • Figure Management: βœ… Figures are correct (Note: figures not shown in submission due to close command clearing figures between exercises)
  • Advanced Features: Includes proper derivative safeguards, convergence tracking, and bounds protection

πŸ’¬ Style & Clarity

  • Code Quality: Excellent structure with good organization and documentation
  • Variable Naming: Clear names (Hstar, ITERS, xstar1, xstar2)
  • Comments: Good documentation and economic interpretation throughout
  • Output: Appropriate use of fprintf with formatted tables
  • Organization: Clear separation into three exercises with proper headers
  • Documentation: Includes economic interpretation and thorough discussion of convergence

πŸ“Š Visual Output Assessment

Figure 1: IS-LM Equilibrium βœ…

  • Code: Lines 40-52 create plot with IS-LM curves and equilibrium point
  • Features: Correctly identifies equilibrium
  • Styling: Appropriate styling with proper labels and legend
  • Note: Figures look correct. The clear; close; clc; command at start of each exercise clears figures, which is why they’re not in the submission
  • Your comment: β€œFigures should have been saved but they look correct”

Figure 2: Labor Supply h*(Οƒ) βœ…

  • Code: Lines 136-141 create plot showing h* vs sigma values
  • Features: Shows labor supply for different risk aversion parameters
  • Styling: Appropriate styling with proper labels
  • Note: Figures look correct. The clear; close; clc; command at start of each exercise clears figures
  • Your comment: β€œFigures should have been saved but they look correct”

βœ… Suggestions for Improvement

  1. Style: Add saveas() or exportgraphics() calls to save figures (they look correct but weren’t saved)
  2. Style: Consider using exportgraphics() instead of saveas() for higher resolution
  3. Verification: Your sign change check on line 101 is good - shows understanding of corner solutions

🎯 Summary

Strong submission with minor saving issue. The student demonstrates solid understanding of numerical methods and implements all three exercises correctly. Exercise 1 IS-LM is correctly solved with two initial guesses and proper plotting. Exercise 2 bisection correctly updates function values at endpoints (Zl/Zh), which is the correct implementation many students missed. Exercise 3 is correctly implemented with proper comparison between bisection and damped Newton methods and excellent discussion. The code structure is appropriate with proper figure creation code. Minor issue: Figures are correct but not saved due to close command clearing them between exercises. The figures look correct as you noted.

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