Xperiments Lotka-Volterra

127 days ago by staffan

%hide %latex This is the original Lotka-Volterra phase map in a non-dimensional form. Which has many coarse "flaws" and has also been modified over time as we'll see below. We use a dimensionless form of the Lotka-Volterra . Default for the Sage ode -solver is to use runga-kutta-felhberg (4,5). Just a reminder of the mathematical form (x is prey and y is predator): $$\left\{\begin{matrix} & \dot x = x(1-y)\\ & \dot y = -y+xy \end{matrix}\right.$$ Below we use an array $y$ which contains x(t) and y(t) 
       
T = ode_solver() T.function = lambda t, y: [y[0]-y[0]*y[1], -y[1]+y[0]*y[1]] sol_lines = Graphics() for i in srange(0.1,1.1,.1): T.ode_solve(y_0= [i,i],t_span=[0,10],num_points=1000) y = T.solution sol_lines += line([x[1] for x in y], rgbcolor = (i,i,0)) show(sol_lines+point((1,1),rgbcolor=(0,0,0)), figsize = [6,6], xmax = 6, ymax = 6) 
       
%hide %latex Here we added a parameter g in the original Lotka-Volterra or logistic growth. We also later enable choice of logistic growth 
       
def lv(g,k=None): Tg = ode_solver() Tg.function = lambda t, y: [y[0]*(1 - y[1]), -g*y[1] + y[0]*y[1]] sol_lines = Graphics() for i in srange(0.1,1.1,.2): Tg.ode_solve(y_0=[i,i],t_span=[0,10],num_points=10^3) y = Tg.solution sol_lines += line([x[1] for x in y], rgbcolor = (i,i,0)) return sol_lines @interact def lv_explorer(gamma = (0.,1.,0.1)): #html("equilibrium points are is %.2f" % k) show(lv(gamma)) 
       
gamma 

Click to the left again to hide and once more to show the dynamic interactive window

graphics_array([lv(g) for g in srange(0.1,1.0,.2)],3,2).show() 
       
lvanim = animate([lv(g) for g in srange(0.,1.,0.1)], xmin=0,xmax=6,ymin= -0,ymax= 6,figsize = [7,5]) lvanim.show(delay=200,iterations=3) 
       
%html <h3>Here we will show how bifurcations can occur.</h3> 
       

Here we will show how bifurcations can occur.

Here we will show how bifurcations can occur.

 
       
 
       
%latex References [1] Y. Kuznetsov, Springer 2005, Elements of Applied Bifurcation Theory. [2] N. Britton,Springer SUMS 2005, Essential Mathematical Biology