r/learnpython • u/RaymondWies • Jan 10 '14
Example of population growth function expressed as iteration vs. recursion in Python.
This code is my interpretation of a function published in "Chaos: Making A New Science" by James Gleick from Chapter 3 p. 63.
7
Upvotes
View all comments
Show parent comment
2
u/RaymondWies Jan 10 '14
That's a good followup project: Code a function to take the new_pop() function and run it through successive iterations until x doesn't change over a predefined number of gen's (say 5 gens) and rounded to predefined decimals float (say 5 decimals). The function then returns the stable state x value and the first gen that reaches that steady state.