I was experimenting with ways to model population of some country given its initial population, initial resources and some coefficients to have a control on the population and resources, and I have coded a simulation for it:
popstep = [100000]
restep = [5000]
k = 100 #Rate of consumption of resource for 1 reproduction
r = 0.0015 #Coefficient of Growth of Population
d = 0.0090 #Coefficient of Decline of Population
for t in range(1000):
timestep.append(t)
dP, dR = 0, 0
if restep[t] <= 1200: #When resources reach 1200, decline begins!
k = 55
nB = 1
dP = -1*d*popstep[t] + nB*k
dR = -nB*k
else:
k = 10
nB = random.randint(0,2) #At every timestep, there is a choice of either no child, one child or two children
dP = r*popstep[t] + nB
dR = -nB*k
popstep.append(popstep[t]+dP)
restep.append(restep[t]+dR)
The output for the above simulation turned out to be:
However, I want some natural decline in population, unlike the sharp decline. What am I missing in my equation to achieve that? I would also like to know how I could make my population generate resources such that it never really runs out of resources. How should I implement wealth generation, which would correlate with the population and resources I have?
I'm doing this project for a simulator game I'm working on.
Do you suggest any reading I need to do to model such simulations?
