From 478e3f322a4c4381e1c789d524502f3f21c9bd71 Mon Sep 17 00:00:00 2001 From: mmcky Date: Mon, 5 Feb 2024 20:08:58 +1100 Subject: [PATCH 1/2] FIX: fix missing h0 returned from compute_optimal --- lectures/cons_smooth.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lectures/cons_smooth.md b/lectures/cons_smooth.md index ea52430a..fc00132f 100644 --- a/lectures/cons_smooth.md +++ b/lectures/cons_smooth.md @@ -311,7 +311,7 @@ a0 = -2 # such as "student debt" y_seq = np.concatenate([np.ones(46), np.zeros(20)]) cs_model = creat_cs_model() -c_seq, a_seq = compute_optimal(cs_model, a0, y_seq) +c_seq, a_seq, h0 = compute_optimal(cs_model, a0, y_seq) print('check a_T+1=0:', np.abs(a_seq[-1] - 0) <= 1e-8) From e9e1548f05c3216a9d6468fe8e2e10e44d690b9f Mon Sep 17 00:00:00 2001 From: mmcky Date: Mon, 5 Feb 2024 20:21:49 +1100 Subject: [PATCH 2/2] add ho --- lectures/cons_smooth.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lectures/cons_smooth.md b/lectures/cons_smooth.md index fc00132f..8d10471f 100644 --- a/lectures/cons_smooth.md +++ b/lectures/cons_smooth.md @@ -429,7 +429,7 @@ def compute_variation(model, ξ1, ϕ, a0, y_seq, verbose=1): if verbose == 1: print('check feasible:', np.isclose(β_seq @ v_seq, 0)) # since β = 1/R - c_opt, _ = compute_optimal(model, a0, y_seq) + c_opt, _, _ = compute_optimal(model, a0, y_seq) cvar_seq = c_opt + v_seq return cvar_seq