![]() |
How can I find the value of k(subscript t+1) for periods t=1...50? - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: How can I find the value of k(subscript t+1) for periods t=1...50? (/thread-35469.html) |
How can I find the value of k(subscript t+1) for periods t=1...50? - maeva - Nov-06-2021 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)? RE: How can I find the value of k(subscript t+1) for periods t=1...50? - Gribouillis - Nov-06-2021 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 >>> RE: How can I find the value of k(subscript t+1) for periods t=1...50? - maeva - Nov-07-2021 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? |