π Week 5 Homework β Feedback
π 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
fprintfanddispto 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
- Critical: Fix bisection in Exercise 2 - must update
fa/fbvalues when updating brackets:if fa * fm < 0, b = m; fb = fm; else, a = m; fa = fm; end - Important: Add explicit discussion comparing bisection vs Newton convergence in Exercise 3
- Style: Consider using
exportgraphics()instead ofsaveas()for higher resolution - Verification: Add verification that results are economically reasonable (h* should be in [0,1])
- 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)