I know that: kt+1= (1−δ)kt + s * kθt s=0.08, δ=0.3, θ= 0.35, k0=2.5
I wrote this:
JavaScript
x
5
1
(δ,s,θ) = (0.08,0.3,0.35)
2
k=2.5
3
K = (1-δ)*k+s*k**θ
4
print (K)
5
I want to calculate the value of k for periods 1,…,50 Of course, the result of my code is only for k1. Can you help me understand how I can find the values up to k50?
Advertisement
Answer
You can calculate it with a simple loop like this:
JavaScript
1
6
1
δ, s, θ = 0.08, 0.3, 0.35
2
k = [2.5]
3
for _ in range(50):
4
k.append((1-δ)*k[-1]+s*k[-1]**θ)
5
print(k)
6