Skip to content

Commit 3eb98bb

Browse files
authored
Fix ruff: remove unused variable in originals script
1 parent 0e413ad commit 3eb98bb

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

originals/b7_contract_stochastic_income.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,23 @@
66
def solve_contract() -> float:
77
"""Solve for high-state consumption in a two-state stochastic contract.
88
9-
Uses bisection to match a target lifetime utility under log preferences
9+
Uses bisection to match a target lifetime utility under log preferences,
1010
with a participation (exit) constraint in the high-income state.
1111
"""
1212
delta = 0.95
1313
prob = 0.5
1414
c_low = 0.95
1515
v0_target = 3.0
1616

17-
v_aut_high = math.log(1.1) / (1.0 - delta)
18-
1917
def expected_value(c_high: float) -> float:
2018
if c_high <= 0:
2119
return -math.inf
2220
eu = prob * math.log(c_low) + prob * math.log(c_high)
2321
return eu / (1.0 - delta)
2422

2523
def exit_constraint(c_high: float) -> bool:
24+
# Participation constraint in the high-income state:
25+
# requires c_high >= 1.1 (autarky consumption).
2626
return c_high >= 1.1
2727

2828
tol = 1e-8
@@ -41,6 +41,8 @@ def exit_constraint(c_high: float) -> bool:
4141
hi = mid
4242

4343
sol = 0.5 * (lo + hi)
44+
45+
# Enforce the exit constraint (minimal feasible c_high).
4446
if not exit_constraint(sol):
4547
sol = 1.1
4648

0 commit comments

Comments
 (0)