## Nefedov's (2013) model of malthusian population dynamics in agrarian societies
## In contrast to other malthusian models, this model includes "malthusian crises" 
## where the the scarcity of surplus food (K) leads to population collapse (N)
## in repeated dampened oscillations
## There are two key parameters: 
## r is the maximal rate of natural increase 0.004 < r < 0.02
## q is how many households one farming family can support 1 < q < 2
## the equilibrium population value is scaled to 1
par r=0.01,q=1.2
## Initial conditions for the model
init N=0.1, K=0.1
## Differential equations
dN/dt=r*N*(1-N/K)
dK/dt=N*q/((q-1)*(N+1/(q-1)))-N

@ dt=0.5, total=1000, xplot=N,yplot=K,axes=2d
@ xmin=0,xmax=3,ymin=0,ymax=10
@ xlo=0,ylo=0,xhi=3,yhi=10

done

