!pip install --upgrade quantecon import quantecon as qe import numpy as np import scipy.linalg as la import matplotlib.pyplot as plt %matplotlib inline from quantecon import DLE np.set_printoptions(suppress=True, precision=4) α, β, ρ_1, ρ_2, σ = 10, 0.95, 0.9, 0, 1 γ = np.array([[-1], [0]]) ϕ_c = np.array([[1], [0]]) ϕ_g = np.array([[0], [1]]) ϕ_1 = 1e-5 ϕ_i = np.array([[-1], [-ϕ_1]]) δ_k = np.array([[0]]) θ_k = np.array([[1 / β]]) β = np.array([[β]]) l_λ = np.array([[0]]) π_h = np.array([[1]]) δ_h = np.array([[0]]) θ_h = np.array([[0]]) a22 = np.array([[1, 0, 0], [α, ρ_1, ρ_2], [0, 1, 0]]) c2 = np.array([[0], [σ], [0]]) ud = np.array([[0, 1, 0], [0, 0, 0]]) ub = np.array([[100, 0, 0]]) x0 = np.array([[0], [0], [1], [0], [0]]) info1 = (a22, c2, ub, ud) tech1 = (ϕ_c, ϕ_g, ϕ_i, γ, δ_k, θ_k) pref1 = (β, l_λ, π_h, δ_h, θ_h) econ1 = DLE(info1, tech1, pref1) econ1.Sc fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(16, 5)) for i in range(25): econ1.compute_sequence(x0, ts_length=150) ax1.plot(econ1.c[0], c='g') ax1.plot(econ1.d[0], c='b') ax1.plot(econ1.c[0], label='Consumption', c='g') ax1.plot(econ1.d[0], label='Income', c='b') ax1.legend() for i in range(25): econ1.compute_sequence(x0, ts_length=150) ax2.plot(econ1.k[0], color='r') ax2.plot(econ1.k[0], label='Debt', c='r') ax2.legend() plt.show()