Sample code - Classical growth model


#1

Hello,

I am looking for a sample code solving the deterministic classical growth model by value function iteration.
I can do it on Matlab, but it takes so much time to converge. So, I want to try do it with Python.

If anyone knows any sample code for Python, plz kindly suggest to me.

Thanks a lot!


#2

It is not my intention to sound “teaching”, but it may be really useful (and more fun) if you take the MATLAB code and try to translate it to Python yourself. Don’t worry about the result being less than optimal: You can improve and ask specific questions when you are stuck with programming.

Regarding speed in Python, it may be that a naive implementation without any further tweaks will not be much of an improvement over MATLAB. However, you may find this post from the front page and, more specifically, this lecture interesting. (Although I am not such a JIT fan, the lecture is very worthwhile.)