Optimal growth model stochastic with while loop

next is to check if the program works with more than 2 states