In [1]:
import numpy as np
import matplotlib.pyplot as plt
import quantecon as qe

In [2]:
np.set_printoptions(suppress=True)

In [3]:
%run src/ssy_fp_discretized.py
%run src/ssy_monte_carlo_test.py

In [4]:
ssy = SSY()

In [5]:
dot_loc = ssy.ψ, ssy.μ_c

In [6]:
G = 6
D = 3

In [7]:
average_wealth_cons(ssy, K=D, I=D, J=D, verbose=True)


Test value = 0.994712322967233 and θ = -16.0240206185567
Beginning iteration


Iteration converged after 67326 iterations
Out[7]:
2256.1724999018534

In [8]:
psi_vec = np.linspace(1.1, 4.0, G)
mu_vec = np.linspace(0.003, 0.0005, G)

In [9]:
R = np.empty((G, G))

In [10]:
for i, μ_c in enumerate(mu_vec):
    for j, ψ in enumerate(psi_vec):
        ssy.ψ = ψ
        ssy.μ_c = μ_c
        test_function = ssy_function_factory(ssy, parallelization_flag=False)
        if test_function() < 1:
            R[i, j] = average_wealth_cons(ssy, K=D, I=D, J=D, verbose=False)
        else:
            R[i, j] = np.inf

In [67]:
R


Out[67]:
array([[1.29e+03, 4.66e+04,      inf,      inf,      inf,      inf],
       [1.22e+03, 4.61e+03, 4.66e+25,      inf,      inf,      inf],
       [1.16e+03, 2.42e+03, 4.99e+03, 1.28e+04, 3.60e+06, 1.79e+31],
       [1.10e+03, 1.64e+03, 2.14e+03, 2.60e+03, 3.02e+03, 3.41e+03],
       [1.05e+03, 1.24e+03, 1.36e+03, 1.44e+03, 1.50e+03, 1.55e+03],
       [1.00e+03, 9.98e+02, 9.98e+02, 9.98e+02, 9.98e+02, 9.99e+02]])

In [68]:
start_table = r"""
\begin{table}
\centering
\begin{tabular}{c_string}
"""

In [69]:
end_table = r"""
\end{tabular}
\end{table}
"""

In [71]:
print(start_table)

# Print the first row
for j, ψ in enumerate(psi_vec):
    print(f"$\psi$ = {round(ψ, 3)} & ", end='')
print("\\\\")
print("\hline \hline")


for i, μ_c in enumerate(mu_vec):
    print(f"$\mu_c$ = {round(μ_c, 4)} & ", end='')
    for j in range(G):
        print(f"{R[i, j].round(1)}  & ", end='')
    print('\\\\')
    print('\\hline')
    
print(end_table)


\begin{table}
\centering
\begin{tabular}{c_string}

$\psi$ = 1.1 & $\psi$ = 1.68 & $\psi$ = 2.26 & $\psi$ = 2.84 & $\psi$ = 3.42 & $\psi$ = 4.0 & \\
\hline \hline
$\mu_c$ = 0.003 & 1290.3  & 46604.4  & inf  & inf  & inf  & inf  & \\
\hline
$\mu_c$ = 0.0025 & 1219.3  & 4610.7  & 4.661476754501171e+25  & inf  & inf  & inf  & \\
\hline
$\mu_c$ = 0.002 & 1155.7  & 2423.3  & 4986.7  & 12840.7  & 3596674.7  & 1.7922553505068954e+31  & \\
\hline
$\mu_c$ = 0.0015 & 1098.4  & 1642.7  & 2142.0  & 2600.6  & 3022.8  & 3412.6  & \\
\hline
$\mu_c$ = 0.001 & 1046.5  & 1242.0  & 1362.4  & 1443.9  & 1502.7  & 1547.2  & \\
\hline
$\mu_c$ = 0.0005 & 999.5  & 998.3  & 998.3  & 998.3  & 998.5  & 998.6  & \\
\hline

\end{tabular}
\end{table}


In [ ]: