var('t')
var('R F')
var('R0 F0')
var('a b c d')
## CONSTANTS
a = 0.04 # rabbit birthrate
b = 0.0005 # probability of predation per encounter
c = 0.1*0.0005 # probability of predation per encounter, rabbit -> fox conversion efficiency
d = 0.2 # death rate of foxes
## INITIAL CONDITIONS
R0 = 5000 #initial number of rabbits
F0 = 200 #initial number of foxes
## DIFFERENTIAL EQUATIONS
de_R = (diff(R,t) == a*R - b*R*F)
de_F = (diff(F,t) == c*R*F - d*F)
## CALCULATION PARAMETERS
end_points = 500
stepsize = 1.0
steps = end_points/stepsize
ics = [0,R0,F0]
sol = []
des = [de_R.rhs(), de_F.rhs()]
## NUMERICAL SOLUTION OF DIFFERENTIAL EQUATIONS
sol = desolve_system_rk4(des,[R,F],ics,ivar=t,end_points=end_points,step=stepsize)