Problem set 6: Solving the Solow model
import numpy as np
from scipy import linalg
from scipy import optimize
import sympy as sm
Tasks
Solving matrix equations I
np.random.seed(1900)
n = 5
A = np.random.uniform(size=(n,n))
b = np.random.uniform(size=n)
c = np.random.uniform(size=n)
d = np.random.uniform(size=n)
Question A: Find the determinant of
# write your code here
Answer: see A1.py
Question B: Solve the following equation systems directly using scipy.
Answer: A2.py
Question C: Solve the same equation systems as above using linalg.lu_factor()
and linalg.lu_solve()
. What is the benefit of this approach?
Answer: A3.py
Solving matrix equations II
F = np.array([[2.0, 1.0, -1.0], [-3.0, -1.0, 2], [-2.0, 1.0, 2.0]])
e = np.array([8.0, -11.0, -3.0])
Question: Use the function gauss_jordan()
in the numecon_linalg
module located in this folder to solve
# write your code here
Answer: see A4.py
Symbolic
Question A: Find
and
# write your code here
Answer: A5.py
Question B: Solve the equation
# write your code here
Answer: A6.py
Problem: Solve the Solow model
Introduction
Consider the standard Solow-model where:
- is capital2
- is labor (growing with a constant rate of )
- is technology (growing with a constant rate of )
- is GDP
Saving is a constant fraction of GDP
such that capital accumulates according to
The production function has constant-return to scale such that
where is the technology adjusted capital-labor ratio.
The transition equation then becomes
If the production function is Cobb-Douglas then
If it is CES (with ) then
Steady state
Assume the production function is Cobb-Douglas.
Question A: Use sympy to find an analytical expression for the steady state, i.e. solve
k = sm.symbols('k')
alpha = sm.symbols('alpha')
delta = sm.symbols('delta')
s = sm.symbols('s')
g = sm.symbols('g')
n = sm.symbols('n')
# write your code here
Answer: see A7.py
Question B: Turn you solution into a Python function called as ss_func(s,g,n,delta,alpha)
.
# write your code here
Answer: A8.py
Question C: Find the steady state numerically using root-finding with optimize.root_scalar
.
s = 0.2
g = 0.02
n = 0.01
alpha = 1/3
delta = 0.1
# write your code here
Answer: A9.py
Question D: Now assume the production function is CES. Find the steady state for for the various values of shown below.
betas = [-0.5,-0.25,-0.1,-0.05,0.05,0.1,0.25,0.5]
# write your code here
Answer: A10.py