# POPULATION MODELS

For a more detailed introduction and example problems see http://mathsci2.appstate.edu/~hph/SageMath/

# Commands we will need to work with the population models

You can evaluate these cells to read about the commands being used in this notebook:

• desolve will find a solution to a simple differential equation that can be solved "by hand."
• plot will plot an expression
• desolve_rk4 will find a solution to a differential equation using a fairly basic method "Runge Kutta 4."
• desolve_system_rk4 will find a solution to a system of differential equations using the RK4 method.
• list_plot will plot a list of points.
desolve??
plot??
desolve_rk4??
desolve_system_rk4??
list_plot??
show??

# The first model - "the more the merrier"

Assume that the number of rabbits grows proportional to the number of rabbits present.

p' = k p

var('t') p=function('p',t) diffeq = diff(p, t) == 0.3*p #Notice that full equation here, double equal means "equality" desolve(diffeq, p, [0,10]) #Notice the independent variable is specified as is the range for t
plot(_, (t, 0, 10)) #Notice the underscore to reference the previous output and the range for t # The second model - intraspecies competition

Add a death term -- the number of rabbits that die is proportional to the number of 2-rabbit interactions.

p' = k p - d p (p-1)/2

var('t') p=function('p',t) diffeq = diff(p, t) == 0.3*p - 0.01*p*(p-1)/2 desolve(diffeq,p, [0,10])
var('t') p=function('p',t) diffeq = diff(p, t) == 0.3*p - 0.01*p*(p-1)/2 desolve_rk4(diffeq,p, ics=[0,10],step=1, end_points=40) #Notice the initial conditions, step and ending value of t

# Slowing Birthrates

A different way of thinking about death:  The birthrate slows as the population approaches the maximum sustainable in the ecosystem.

p' = k (1 -  p/M) p

var('t') p=function('p',t) diffeq = diff(p, t) == 0.3*p - 0.01*p*(p-1)/2 desolve_rk4(diffeq,p, ics=[0,10],step=1, end_points=40, output='slope_field') #Notice that here we have specified the graphical solution including the slope field # Lotka Volterra Predator Prey Equation

Volterra set the prey (x) increase to simple Malthusean and had the predator (y) affect the prey through the death term. He set the birth term of the predator proportional to both the predators present and the prey present, since predators would have a hard time reproducing without food.

x' = rb * x - rd * x * y

y' = wb * x * y - wd * y

x,y,t=var('x y t') sol=desolve_system_rk4([0.7*x - 0.3*x*y,0.08*x*y - 0.44*y],[x,y],ics=[0, 10, 4],ivar=t,end_points=20) #Notice the initial conditions (t, x, y), the independent variable, and the ending t value txpoints=[ [i,j] for i, j, k in sol] typoints=[ [i,k] for i, j, k in sol] xypoints=[ [j,k] for i, j, k in sol] #To plot we need to choose which pairs we are interested in tx=list_plot(txpoints, plotjoined=true, color='red') ty=list_plot(typoints, plotjoined=true, color='blue') show(tx+ty) #We can show both plots together list_plot(xypoints, plotjoined=true, color='green') # Modeling Competition in the Prey, the Leslie Model, and the May Model

Can you complete these altered predator-prey models? What happens? How are these different from the traditional L-V behavior and from each other? Does the behavior make sense?