|
Integration of Ordinary Differential Equations (ODEs)
Make sure you understand the examples ode1.py (which produces the plot ode1.png) and
ode2.py (which creates plot ode2.png).
You may want to consult section 14.4 Solving differential equations in
lecture notes.
Modify the equations in ode2.py such that the force acting on
the object changes from F/m=-k*r to F/m = -k*r -a*v, where a is a constant
and v=dr/dt is the velocity.
- How does this affect the results (best plotted)?
- What physical effect might be modelled through this extra term?
Predator-Prey Problem
- Let p1(t) be the number of rabbits, and
- p2(t) be the number of foxes
For the time dependence of p1 and p2 we assume that :
- rabbits proliferate at a rate a: Per unit
time a number ap1 of rabbits is born.
- Number of rabbits is reduced by collisions with foxes.
Per unit time c*p1*p2 rabbits are eaten, and disappear.
- Assume that birth rate of foxes depends only on food intake in form of rabbits.
- Assume that foxes die a natural death at a rate b.
- Numbers to use initially:
- rabbit birth rate a = 0.7
- rabbit-fox-collision rate c = 0.007
- fox death rate b = 1
Exercise:
Put all this together in predator-prey ODEs:
dp1/dt = a*p1 - c*p1*p2
dp2/dt = c*p1*p2 - b*p2
Write a programme predprey.py to solve these equations for for
p1(0) = 70 and p2(0) = 50 for 30 units of time.
Visualise the results (i.e. p1(t) and p2(t))
Vary parameters
There is nothing to submit for this lab.
|