lec17_ODE4

# lec17_ODE4 - #Lecture 17#Example 1 Lotka-Volterra#from...

This preview shows pages 1–2. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: #Lecture 17 ############# #Example 1: Lotka-Volterra ############## #from pylab import * # #def euler(x,y,tau): # for step in range(maxstep-1): # xc=x[step] # yc=y[step] # t=step*tau # times[step]=t # # #Compute accel. vector at each time step # fx=(a-b*xc-c*yc)*xc # fy=(-d+e*xc)*yc # # #Compute r and v for next time step # x[step+1]=xc+tau*fx # y[step+1]=yc+tau*fy # return x,y # #def leapfrog(x,y,tau): # for step in range(maxstep-1): # xc=x[step] # yc=y[step] # t=step*tau # times[step]=t # # #Compute accel. vector at each time step # # fy=(-d+e*xc)*yc # # #Compute y and x for next time step # y[step+1]=yc+tau*fy # # # Use updated y to compute new x (ala Euler-Cromer) # fx=(a-b*xc-c*y[step+1])*xc # x[step+1]=xc+tau*fx # # return x,y # # #close('all') # # # # ##parameters # #a=1 #prey birth rate #b=0.01 #prey death rate (other than being eaten) #c=1.4 #rate of consumption #d=12 #pred. death rate #e=0.4 #pred. growth rate # ##Initial conditions ##Y is predator population and x is prey population # #xsteady=d/e...
View Full Document

## This note was uploaded on 10/05/2010 for the course PHYS phy503 taught by Professor Gladden during the Spring '09 term at Ole Miss.

### Page1 / 3

lec17_ODE4 - #Lecture 17#Example 1 Lotka-Volterra#from...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online