π Week 5 Homework β Feedback
π 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
fprintfto 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
- 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 - Important: Add explicit discussion comparing bisection vs Newton convergence in Exercise 3
- Style: Good use of manual Newton method for Exercise 1 - demonstrates understanding
- 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)