π Week 5 Homework β Feedback
π 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
closecommand 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
fprintfwith 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
- Style: Add
saveas()orexportgraphics()calls to save figures (they look correct but werenβt saved) - Style: Consider using
exportgraphics()instead ofsaveas()for higher resolution - 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)