Exercise 16.3#
Question 1#
An early predator-prey population model is the Lotka-Volterra Model (http://www.scholarpedia.org/article/Predator-prey_model) given by:
Where \(x\) denotes the prey population and \(y\) denotes the predator population. This can be integrated out directly to arrive at the identity:
where \(C\) is a constant determined by the initial conditions and parameters. All solutions should satisfy this relation.
Use Euler’s method to solve this system of ODEs for \(b = p = r = d = 1\) up to \(t = 10\).
Use your solutions to calculate \(C\) over time. Does it stay constant? What happens if you reduce the size of your \(t\) step?
Question 2#
Consider a planet orbiting the Sun. By Newton’s law of gravity, the components of acceleration in the \(x\)- and \(y\)-directions are
where \(r^2 = x^2 + y^2\), \(G\) is the gravitational constant and \(M\) is the mass of the Sun. Re-write these equations as four first-order differential equations.
These four differential equations require four initial conditions. Choosing units such that \(GM = 1\), the initial conditions at \(t = 0\) are \(x = 1.0,~~ y = 0.0,~~dx/dt = 0.0,~~dy/dt = 1.0.\) Solve the differential equations using Euler’s method and write values of \(t, x, y\) for \(0 < t < 7\) using a step size of \(0.001\) in \(t\). Plot the the orbit (\(y\) as a function of \(x\)).
Repeat above solution using initial conditions \(x = 1.0\), \(y = 0.0\) , \(\tfrac{d}{d t}x = 0.0\), \(\tfrac{d}{dt} y = 1.1\) at \(t = 0\) for \(0 < t < 10\) and the same step size. Plot the orbit.