COSC 1002/1902 Computational Science in C
Practical 8
This practical session involves numerically solving coupled systems of ordinary differential equations
in C using the RungeKutta method.
The exercises include models for ecosystems and nonlinear
oscillators.
Before you begin these exercises, you should review the material in lecture 8. The calculations in
that lecture use the codes
pred
prey.c
and
pred
prey
mod1.c
, which are available on the unit
web pages. You can try compiling and running the codes yourself, to confirm the results obtained in
lectures. If you succeed with this then you are ready to begin the exercises. If not consult a tutor, who
can provide assistance.
The exercises are for students in both units except where indicated (‘1002’ means that the question
is just for students in COSC 1002, and ‘1902’ means that the question is just for students in COSC
1902). Remember to have a tutor mark off checkpoints as you reach them.
Exercises
1. In lecture 8 the LotkaVolterra model was introduced to describe predatorprey ecosystems. The
deficiencies of the model were discussed, and two modified models were introduced. The first
modified model is solved by the code
pred_prey_mod1.c
. The second modified model is
described by the coupled ODEs
dN
dt
=
a
1
1

N
N
*
N

c
1
NP
N
+
c
1
/b
1
,
dP
dt
=
a
2
P
1

P
b
2
N
.
(1)
The detailed motivation for these equations was given in the lecture. Briefly, the first term on the
right hand side of the ODE for
N
is logistic growth of the prey population (see Q2 in practical
session 6). The second term describes the rate at which predators remove prey. For small prey
numbers, this term is proportional to the predator population and to the prey population. For
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.
 Three '09
 wheatland
 Lotka–Volterra equation, phase space diagram

Click to edit the document details