Python Forum

Full Version: How can I find the value of k(subscript t+1) for periods t=1...50?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,
I know that:

k(subscript t+1)= (1−δ)k(subscript t) + s[k^(θ)(subscript t)]
s=0.08
δ=0.3
θ= 0.35
k(subscript 0)=2.5

(δ,s,θ) = (0.08,0.3,0.35)
k=2.5
K = (1-δ)*k+s*k**θ
print (K)
I want to calculate the value of k for periods 1,...,50
Of course, the result of my code is only for k(subscript 1).
Can you help me understand how I can find the values up to k(subscript 50)?
Use a "for" loop to compute the sequence
>>> delta, s, theta = 0.08, 0.3, 0.35
>>> k = 2.5
>>> for i in range(10):
...     k = (1 - delta) * k + s * k ** theta
...     print(f"{i:3d}: {k}")
... 
  0: 2.7134283534178376
  1: 2.9218081528946036
  2: 3.124679201001941
  3: 3.321700371622801
  4: 3.512629012329435
  5: 3.69730401824454
  6: 3.8756318212738003
  7: 4.04757472314622
  8: 4.2131411328686434
  9: 4.372377365759764
>>> 
Thank you!
And what is a cvs-file in python 3? How can I write the value of k for periods 0,...,50 into a a csv-file named capital.csv?