🌍 Week 5 Homework β€” Feedback

Student: Alice Ciavatta
Assignment: Solving Nonlinear Equations in Economics


βœ… Overall Assessment

Result: βœ… More than 50% Correct

Good submission implementing all three exercises correctly. Exercise 1 IS-LM is properly solved with two initial guesses and correct verification of positive interest branch. Exercise 2 bisection is correctly implemented with appropriate handling of corner solutions. Exercise 3 comparison is correct with proper bisection and damped Newton methods. However, figures are not properly saved (only .fig files exist instead of PNG files), and there’s an issue with the bisection sign change logic.


πŸ” Task-by-Task Check

Task Description Status Notes
1.1 Parameter setup for IS-LM βœ… All parameters correctly defined (C0, c, I0, beta, T, G, M_over_P, k, lambda)
1.2 IS-LM system definition βœ… Correct formulation
1.3 Solve from two initial guesses βœ… Two guesses provided (x0_pos=[850;1], x0_neg=[600;-5])
1.4 Plot IS and LM curves ⚠️ Creates plot but figures not saved as PNG (only .fig files exist)
1.5 Verify positive interest rate βœ… Verifies positive interest rate with assert statement
2.1 Parameter setup for labor supply βœ… All parameters correctly defined (w, tau, a, g, phi, chi)
2.2 Define Z(h) function βœ… Correct formulation with proper consumption function
2.3 Loop over sigma values βœ… Correctly loops over sigma ∈ {1,2,3,4,5}
2.4 Solve using Bisection method ❌ Critical Error: Uses fa*fm <= 0 instead of fa*fm < 0. This causes convergence to wrong root when fm=0 exactly
2.5 Plot h*(sigma) and interpret ⚠️ Creates plot but figures not saved as PNG
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 ⚠️ No explicit discussion provided

πŸ“ˆ Technical Implementation

  • IS-LM System: Correct implementation with two initial guesses and proper verification
  • Labor Supply Function: Correct mathematical formulation
  • Bisection Method: Correct implementation but uses <= 0 instead of < 0 for sign change
  • Corner Solutions: βœ… Excellent - Explicitly handles corner solutions (h*=1) when no interior root exists, with isCorner flag to track which sigma values have corners
  • Damped Newton: Correct implementation with alpha=0.5 and analytical derivative
  • Error Handling: Includes projection to keep h in (0,1) bounds, plus sophisticated corner detection
  • Figure Management: ❌ Only saves .fig files, should save PNG files using saveas() or exportgraphics()
  • Advanced Features: Includes proper comparison table, bounds checking, and systematic corner solution tracking

πŸ’¬ Style & Clarity

  • Code Quality: Good structure with clear separation into exercises
  • Variable Naming: Clear names (hstar, sigmas, isCorner)
  • Comments: Minimal but appropriate comments
  • Output: Good use of fprintf with formatted tables
  • Organization: Clear separation into three exercises
  • Documentation: Includes sophisticated handling of corner solutions with tracking flags

πŸ“Š Visual Output Assessment

CRITICAL ISSUE: Figures not properly saved

Figure 1: IS-LM Equilibrium ⚠️

  • Layout: Plot with IS and LM curves and equilibrium point
  • Features: Correctly identifies equilibrium and verifies positive interest rate
  • Styling: Appropriate styling
  • Saving: ❌ Only saves as .fig file, no PNG saved
  • Issue: Figures must be saved as PNG files for submission

Figure 2: Labor Supply h*(Οƒ) ⚠️

  • Layout: Plot showing h* vs sigma
  • Features: Shows labor supply for different risk aversion parameters
  • Styling: Appropriate styling with proper labels
  • Saving: ❌ Only saves as .fig file, no PNG saved
  • Issue: Your submitted .fig files look incorrect

βœ… Suggestions for Improvement

  1. Critical: Add saveas() commands to save all figures as PNG files (currently only .fig files exist)
  2. Critical: Consider using exportgraphics() for higher resolution
  3. Critical: Fix bisection sign change logic - must use < 0 instead of <= 0 to avoid convergence to wrong root
  4. Style: Add more detailed discussion of convergence comparison in Exercise 3
  5. Verification: Check that the .fig files are displaying correctly

🎯 Summary

Good submission with correct implementations but critical bisection error and figure saving issues. The student demonstrates understanding of numerical methods and implements all three exercises. Exercise 1 is properly solved with two initial guesses and verification, Exercise 2 has a critical bisection sign change error (<= 0 instead of < 0), and Exercise 3 demonstrates proper comparison between methods. Critical issues: (1) bisection uses fa*fm <= 0 instead of < 0 which can cause convergence to wrong root, and (2) figures are not properly saved as PNG files (only .fig files exist).

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