🌍 Week 5 Homework — Feedback

Student: Michele Nascia
Assignment: Solving Nonlinear Equations in Economics


✅ Overall Assessment

Result: ✅ More than 50% Correct

Submission implements all three exercises. Exercise 1 IS-LM is solved with two initial guesses. Exercise 2 and 3 bisection implementations have a critical numerical error: the method does not update function values (fa, fb) after updating brackets, 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 code structure is clear with good figure management.


🔍 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;-1], x0_2=[800;1])
1.4 Plot IS and LM curves ✅ Creates IS-LM plot with equilibrium points
1.5 Verify positive interest rate ✅ Solves and verifies equilibria from both guesses
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 (lines 74-78: elseif Z(a_h)*Z(c) < 0). Re-evaluates Z(a_h) each iteration instead of updating fa. This causes convergence to wrong root.
2.5 Plot h*(sigma) and interpret ❌ Creates plot but shows incorrect results due to bisection error
3.1 Implement Bisection method ❌ Same critical bisection error (lines 120-124) - does not update Z(a_h)/Z(b_h) values
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
3.5 Compare and discuss convergence ⚠️ Provides output 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 (same error as Pablo Romanella, Chiara Tombolini)
  • Damped Newton: Correct implementation with alpha=0.5 and analytical derivative
  • Error Handling: No sign change verification before bisection
  • Figure Management: ✅ Excellent - saves figures with descriptive names as both PNG and .fig files (lines 155-161)
  • Advanced Features: Includes bounds projection for Newton method

💬 Style & Clarity

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

📊 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: ✅ Excellent - saved as both PNG and .fig with descriptive filename
  • Note: Implementation 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: ✅ Excellent - saved as both PNG and .fig with descriptive filename
  • Issue: Plot shows incorrect results due to bisection error (same issue as Pablo Romanella)

✅ Suggestions for Improvement

  1. Critical: Fix bisection in Exercises 2 and 3 - must update function values when updating brackets:
    fa = Z(a_h); fb = Z(b_h);  % Store initial values
    if fa * fc < 0
        b_h = c; fb = fc;  % Update function value
    else
        a_h = c; fa = fc;  % Update function value
    end
    
  2. Important: Add sign change verification before starting bisection: if fa * fb > 0, error('No sign change'); end
  3. Style: Add more detailed discussion of convergence comparison in Exercise 3
  4. Verification: Add output verification to check that results are economically reasonable

🎯 Summary

Submission with critical bisection error affecting results. The student demonstrates understanding of numerical methods and implements all three exercises. Exercise 1 IS-LM is correctly solved with two initial guesses and proper plotting. Exercise 2 and 3 bisection implementations have the critical error of not updating function values (fa, fb) when updating brackets, causing convergence to wrong roots (same error as Pablo Romanella and Chiara Tombolini). Exercise 3 damped Newton is correctly implemented with proper convergence checking. The code structure is appropriate with excellent figure management and clear organization. The issue is a fundamental numerical analysis error that needs correction.

Grade Level: ✅ More than 50% Correct (9/15 tasks fully correct, 0/15 partially correct, 6/15 incorrect)