–Prey A Study in Ecology: Predator Relationships using the Lotka- Volterra Method

advertisement
Numerical Analysis for Engineering - MEAE 4960
Term Project
A Study in Ecology: Predator–Prey
Relationships using the LotkaVolterra Method
Author: Beth McPherson
Date: April 10, 2001
Professor: Ernesto Gutierrez-Miravete
Table of Contents
Introduction ............................................................................................................. 1
The Problem ............................................................................................................ 1
The Model ............................................................................................................... 2
The Solution (Numerical Approaches) ................................................................... 3
The Results (Part I: A Two Species System) .......................................................... 4
Validation (Part I: A Two Species System) ............................................................ 4
The Results (Part II: A Three Species System) ...................................................... 5
Validation (Part II: A Three Species System)......................................................... 7
Error Analysis ......................................................................................................... 7
Discussion ............................................................................................................... 8
Conclusion .............................................................................................................. 8
Appendix A: Part I: A Two Species System
C++ Program .................................................................................................... A1
Program Output ................................................................................................ A4
Appendix B: Part II: A Three Species System
C++ Program ..................................................................................................... B1
Program Output ................................................................................................. B5
Table of Variables
a = predation rate coefficient
A = beginning of research time period
a12 = interaction rate between species 1 and species 2
a13 = interaction rate between species 1 and species 3
a23 = interaction rate between species 2 and species 3
B = end of research time period
b = reproduction rate of predators per 1 prey eaten
1 , 2, 3 = “equivalence” numbers (i.e. i-1/j-1 represents the ration of i’s lost or
gained per unit time to j’s lost or gained)
d = predator mortality rate
h = step size (number of years between results outputs)
k1,1, k2,1, k3,1, k4,1, k1,2, k2,2, k3,2, k4,2, k1,3, k2,3, k3,3, k4,3 = Runge-Kutta calculation
constants.
N = number of output readings given
n1 = population of species 1
n2 = population of species 2
n3 = population of species 3
ny = population of prey
nd = population of predators
r = intrinsic rate of prey population increase
t = time
Introduction
Websters Dictionary defines ecology as the study of the causes and effects of the
spatial distribution of population (174). Ecology has evolved with the
advancement in technology throughout history as man has taken an interest in the
importance of other species to our world. History suggests that, though human
monitoring techniques have become more advanced and results more accurate and
refined, the patterns remain the same. We see synchrony in ecological systems,
which depend on neighboring systems, external disturbances, and self-reinforcing
interactions (Ranta 1621). Humans have created reserves to study these
interactions and to protect endangered species. This is where most of our
documented research comes from. There are many downfalls to these reserves,
which are discussed later in the error analysis.
Two scientists in particular, Lotka and Volterra, noticed this synchrony during a
study of Adriatic fish between 1905 and 1923. The populations of these fish
seemed to rise and fall cyclically in synchrony with each other. The cycle was
due to the fact that the small fish would multiply and feed the big fish, which
would in turn grow in population until the big fish ate more small fish than were
being produced. The population of small fish would then begin to drop and
eventually, the big fish would start to die off due to lack of food until enough died
off to allow the small fish to multiply faster than they were eaten and the cycle
would start again (Montroll 61).
The Problem
The task is to mathematically model a predator prey system. There are an infinite
number of ways to go about a problem like this. In order to fully understand the
mathematics behind an ecological model such as this, I have chosen to simplify a
few predator prey relationships. I have broken the analysis down into two parts.
The first involves a simple two species model with no outside factors. This model
can be validated both with another researchers model as well as some numbers of
1
actual interacting species in an ecosystem. The second part will expand on the
first part. I will make a three species system, set some parameters, and analyze
the data.
The Model
From their observations, Lotka and Volterra developed a model by defining the
population of a predator, nd, and a prey, ny, as they interact with one another over
time. The rate of change of prey and predator populations, respectively as
follows:
ny‘ = rny - anynd
(1)
nd’ = bnynd – dnd
(2)
where r is the rate of prey population increase in the absence of predators, a and b
describe how interactions between predator and prey effect the population of each
respectively, and m is the rate at which predators die. Two initial conditions,
which represent initial populations of both predator and prey, must be identified
(Sharov).
The Lotka-Volterra equations were expanded for a more complex ecosystem of
three or more species. These equations are generalized as follows:
n’i = ci + -1  aijninj
where ci describes how the ith species will grow or decline in population in the
absence of all other species, i are Lotka-Volterra “equivalence” numbers that
describe how quickly each species reproduces with respect to time, and aij
describes how interactions between species i and j lead to a population change in i
and an aij of zero. This generalized equation translates into the following for a
three species system:
n1‘ = c1 * n1 + (β1)-1 (a12 * n1 * n2 + a13 * n1 * n3)
(3)
n2’ = c2 * n2 + (β2)-1 (a21 * n1 * n2 + a23 * n2 * n3)
(4)
n3’ = c3 * n3 + (β3)-1 (a13 * n1 * n3 + a32 * n2 * n3)
(5)
2
It is important to note that interaction coefficients (aij), inversely affect the ith and
jth species. That is aij = -aji (Montroll 68-69).
The Solution (Numerical Approaches)
To keep this paper within the scope of the class (as well as under 12 pages!), I
have limited my solution methods to those that are included in the textbook. The
only method given for solving systems of differential equations is the RungeKutta of Order Four Method. This method involves any number of equations with
initial known values on a time interval A≤t≤B. These are equations (3), (4), and
(5) which were defined by Lotka and Volterra. Please note that, in order to avoid
being redundant, the description of the solution method in this section involves
the three species system only. In order to translate them to a two species system,
you would employ equations (1) and (2) instead of (3), (4), and (5) and would
omit any equations or variables with the subscript 3:
n’1 = f1(t,n1,n2,n3)
n’2 = f2(t,n1,n2,n3)
n’3 = f3(t,n1,n2,n3)
This means that the change in population of each species is a function of all other
species from year A to year B. N represents the number of population “readings”
to take between A and B and h represents the time period between each
population “reading” and will effect how accurate the results are. The
relationship between the two is:
h = (B – A) / N
The Runge-Kutta Method then introduces values, k1,1, k1,2, k1,3, k2,1, k2,2, k2,3, k3,1,
k3,2, k3,3, k4,1, k4,2, and k4,3 that will help reduce error in the approximate solution.
n1, n2,…, nj are initially set as the known initial population of each species. The
general equations for j = 1, 2, …, m and starting at time a look like this:
k1,j = h(f1(t, n1, n2,…, nj))
k2,j = h(f2(t + h/2, n1+ k1,1/2, n2+k1,2/2,…, nm+k1,m/2))
k3,j = h(f3(t+h/2, n1+ k2,1/2, n2+ k2,2/2,…, nm+ k2,m/2))
3
k4,j = h(f4(t+h, n1+ k3,1, n2+ k3,2,…, nm+ k3,m))
nj = nj + (k1,j + 2 k2,j + 2 k3,j + 2 k4,j)/6
t=t+h
As you can see, an approximated value, w, is obtained for a specific time t, and
then that time is stepped up a designated interval, and the equations are evaluated
again. So for equations (3), (4), and (5) above, the equations will look like this
(only showing equations for the first species, the second and third are done in the
same manner):
k1,1 = h*c1*n1 + (β1)-1 (a12*n1*n2 + a13*n1*n3)
k2,1 = h*c1*n1 + (β1)-1 (a12*(n1+k1,1/2)*(n2+k1,2/2) + a13*(n2+k1,2/2)*(n3+k1,3/2))
k3,1 = h*c1*n1 + (β1)-1 (a12*(n1+k1,1/2)*(n2+k1,2/2) + a13*(n2+k1,2/2)*(n3+k1,3/2))
k4,1 = h*c1*n1 + (β1)-1 (a12*(n1+k1,1/2)*(n2+k1,2/2) + a13*(n2+k1,2/2)*(n3+k1,3/2))
n1 = n1 + (k1,1 + 2 k2,1 + 2 k3,1 + 2 k4,1)/6
t=t+h
(Burden 313-316).
The Results (Part I: A Two Species System)
Beginning with the above equations (1) and (2), and a two species system, a C++
computer program was constructed and can be located in Appendix A. The inputs
to the computer program were chosen in order to compare the results to a
baseline. These variables were set as follows: r = 0.100, a = 0.010, b = 0.001, and
m = 0.050. The full tabular output of this computer program can also be found in
Appendix A. The population change of each species is shown with respect to
time in Figure 1 along with the results of the baseline comparison for this part,
which is discussed below.
Validation (Part I: A Two Species System)
In an experiment done by Sharov, we see the output of his computer program,
which can also be located in Appendix A. Sharov used Runge-Kutta of Order two
4
rather than four, but you can see in Figure 1 that the results are so close, they are
not even discernible.
90
80
70
Population
60
50
40
30
20
10
0
0
20
40
60
80
100
120
140
160
180
200
Time (Years)
Sharov Prey
SharovPredator
Part1Prey
Part1Predator
Figure 1: Population vs. Time of a 2-Species System
Now that I have determined that the results of my computer program for the two
species system works properly, I can expand it to incorporate three interdependent
species.
The Results (Part II: A Three Species System)
Equations (3), (4), and (5), and the analysis below it describe the three species
system. The C++ computer program for this system can be located in Appendix
B. Due to the fact that it would take years of research and experimentation to
accurately describe the system with any three particular interacting species, I have
made some educated guesses as to what numbers to use as input for the program.
Table 1 is a listing of the inputs used along with a brief description of why.
5
Table 1: Input variable for the three species system
Variable Value
Explanation
.0005 Species 2 is species 1’s main source of food.
a12
a13
a23
.0001
.0003
k1
-.1
k2
-.001
k3
.2
1
2
3
n1
n2
n3
1.5
.75
.5
15
50
75
Species 3 is species 1’s secondary source of food.
Species 3 is species 2’s main source of food along with
vegetation and species 3 is herbivorous.
Species 1 is mainly a carnivore and would dwindle in
numbers without other species to feed on.
Species 2 can live off the land, but will not grow in numbers
without species 3.
Species 3 will survive and thrive off the land without
predators.
Species 1 reproduces slow over time.
Species 2 reproduces a bit faster than species 1.
Species 3 reproduces the fastest.
Random
Random
Random
From this input, we see the trends shown in Figure 2 with respect to time.
1200
1000
Population
800
600
400
200
0
0
20
40
60
80
100
120
140
160
180
200
Time (Years)
Species 1
Species 2
Species 3
Figure 2: Population vs. Time for a 3-Species System
6
Validation (Part II: A Three Species System)
Figure 2 above is a good representation of a small ecosystem of three species. We
can see the population fluctuations and how each species depends on the others.
It is also interesting to note the upward trend of the fluctuations. The graph is
suggesting that the fluctuations will continue, however, the “peaks and valleys”
will be at higher populations each fluctuation infinitely. We know that this cannot
be true forever, but does demonstrate what may happen in a flourishing ecosystem
before it becomes saturated. A saturated ecosystem will introduce
overpopulation, pollution, mutation, and many other limiting factors which will
effect this growing trend.
Error Analysis
The fact that much of our research comes from reserves created by humans to
study animal ecological systems creates errors in itself. These reserves are a great
tool to encapsulate certain species and exclude others. However, there are always
“edge effects” involved with reserves that create what are called “population
sinks.” These sinks are largely created because the populations outside the
reserves are human, which is the single most important cause of adult mortality
(Woodroffe 2126). This will cause species to become extinct as population
fluctuations fall out of synchrony. These fluctuations will generally fall back in
synchrony over time, but it may be too late for species with historically small
populations (Ranta 1622). Therefore, without data that is completely pure, man
can never create a 100% accurate model for any ecosystem.
The model for these ecosystems always assumes that the vegetation of the land is
limitless. That is, those animals and systems that depend on vegetation may
theoretically grow infinitely, but in reality, we know that when a certain
population is reached, the land will start to become depleted and polluted. At that
point, the populations will begin to die off until the land, if it is not too late, is
restored.
7
Yet another reason that these mathematical models have limits is that they do not
take into account evolution. Many ecosystems that continue to have synchrony
may change with the changing environment in a process called “co-evolution.”
This can slightly change the cyclic patterns in their predator prey system
(Dieckmann 2).
Lastly, as with all mathematical modeling systems, accuracy depends heavily on
the number of data points you have. In other words, if I were to take these
“readings,” or approximations in monthly increments rather than yearly, the
accuracy of the approximations would be better.
Discussion
Despite the drawbacks to the models, there is still much to be learned from them.
From just a two and three species system, we can see the cyclical patterns and
how each species depends on and affects each of the others. We can also see how
a community, untouched, can thrive and grow.
Just one slight change of any input value into the three species system, which
relates to one slight change in the actual balance of the ecosystem, can cause
entire species to become extinct and consequently affect the other species in the
system. Just imagine a system of dozens or even hundreds of species like we live
with. Polluting the rivers and land and destroying natural habitats can be that one
slight change to destroy a system.
Conclusion
Although I have shown that there are many drawbacks and inaccuracies in
mathematical modeling of the world around us, it is a very powerful tool in
helping us understand it. The models and tools we have now are obviously
limited, but much less so than in the past and they will continue to improve. If
8
man better understands the world around him, then he can better react and live in
it without discord.
We have begun to understand that we are a part of an ever-changing ecosystem
and can greatly impact it in both positive and negative ways. Researchers and
scientists have played a huge role in demonstrating to us the importance of
preserving the world around us by putting together mathematical models such as
the one in this paper. They observe and study real ecosystems, document them,
and see what happens when just one piece of that ecosystem dies off. The rest of
the interdependent ecosystem begins to crumble.
Man can learn quite a bit through the use of mathematical models in our society
and research. You can see that by just using simple principles learned in class, we
can construct entire ecosystems and predict how species will effect one another
and their numbers will change over time. This is just one small piece of the world
of mathematical modeling that can affect us all.
9
References
The New American Webster Handy College Dictionary. 1981.
Burden, Richard L, and Douglas J. Faires. Numerical Analysis. Pacific Grove,
CA: Brooks/Cole, 2001.
Dieckmann, Ulf, Paul Marrow, and Richard Law. “Evolutionary Cycling in
Predator-Prey Interactions: Population Dynamics and the Red Queen.”
IIASA Studies in Adaptive Dynamics 3 (1996): 1-24.
Kemeny, John G, and J. Laurie Snell. Mathematical Models in the Social
Sciences. Cambridge: The MIT Press, 1978.
Montroll, Elliot W, and Wade W. Badger. Introduction to Quantitative Aspects of
Social Phenomena. New York: Gordon and Breach Science, 1974.
Ranta, Esa, Veijo Kaitala, and Per Lundberg. “The Spatial Dimension in
Population Fluctuations.” Science 28 Nov 1997: 1621-1623.
Sharov, Alexei. Online. Internet. 12 Jan. 1996. Available: http://
www.gypsymoth.ento.vt.edu/~sharov/PopEcol/lec10/introd.html.
Woodroffe, Rosie, and Joshua R. Ginsberg. “Edge Effects and the Extinction of
Populations Inside Protected Areas.” Science 26 June 1998: 2126-2128.
http:// isolatium.uhh.hawaii.edu/Media/JavaTools/popltkvl.html.
Online. Internet.
Appendix A: Part I: A Two Species System
Appendix A:
Part I: A Two Species System
C++ Program
/****************************************************
PREDATOR PREY MODEL
BASED ON THE MODEL LAID OUT BY LOTKA-VOLTERRA
TWO SPECIES SYSTEM
****************************************************/
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
/****************Begin main program********************/
main()
{
double a,b,r,m,A,B,H,P,T,W1,W2,X11,X12,X21,X22,X31,X32,X41,X42;
int I,N,S;
FILE *OUP[1];
double predator(double, double, double, double, double);
double prey(double, double, double, double, double);
void INPUT(double *,double *,double *,double *,double *,double
*,double *,
double *,int *);
void OUTPUT(FILE **);
INPUT(&r, &a, &b, &m, &A, &B, &H, &P, &S);
/****** The Runge Kutta Method of order four for ******/
/********* systems of differential equations **********/
OUTPUT(OUP);
N = (B - A) / S;
T = A;
W1 = H;
W2 = P;
fprintf(*OUP, "Rate of prey population increase: r = %5.3f", r);
fprintf(*OUP, "\nPredation rate coefficient:
a = %5.3f", a);
fprintf(*OUP, "\nPredator reproduction rate:
b = %5.3f", b);
fprintf(*OUP, "\nPredator mortality rate:
m = %5.3f\n", m);
fprintf(*OUP, "\n t
H(t)
P(t)\n");
fprintf(*OUP, "%5.3f %11.8f %11.8f\n", T, W1, W2);
A1
Appendix A:
Part I: A Two Species System
for (I=1; I<=N; I++) {
X11 = S * prey(T, W1, W2, r, a);
X12 = S * predator(T, W1, W2, m, b);
X21 = S * prey(T + S / 2.0, W1 + X11 / 2.0, W2 + X12 / 2.0, r, a);
X22 = S * predator(T + S / 2.0, W1 + X11 / 2.0, W2 + X12 / 2.0,
m, b);
X31 = S * prey(T + S / 2.0, W1 + X21 / 2.0, W2 + X22 / 2.0, r, a);
X32 = S * predator(T + S / 2.0, W1 + X21 / 2.0, W2 + X22 / 2.0,
m, b);
X41 = S * prey(T + S, W1 + X31, W2 + X32, r, a);
X42 = S * predator(T + S, W1 + X31, W2 + X32, m, b);
W1 = W1 + (X11 + 2.0 * X21 + 2.0 * X31 + X41) / 6.0;
W2 = W2 + (X12 + 2.0 * X22 + 2.0 * X32 + X42) / 6.0;
T = A + I * S;
fprintf(*OUP, "%5.3f %11.8f %11.8f\n", T, W1, W2);
}
fclose(*OUP);
/******************************************************/
return 0;
}
/******************************************************/
/******** Get necessary information from user *********/
void INPUT(double *r,double *a,double *b,double *m,double *A,double *B,
double *H, double *P, int *S){
printf("This is the Lotka-Volterra Method.\n");
printf("This part of the project will be compared to the baseline.\n");
printf("\n\nEnter the rate at which the prey multiply untouched: \n");
scanf("%lf", r);
printf("\nEnter the predation rate coefficient: \n");
scanf("%lf", a);
printf("\nEnter the rate that the predators reproduce per prey eaten: \n");
scanf("%lf", b);
printf("\nEnter the rate at which the predators die: \n");
scanf("%lf", m);
printf("\nEnter the beginning and end of the time period desired separated
by a blank: \n");
scanf("%lf %lf", A, B);
A2
Appendix A:
Part I: A Two Species System
printf("\nEnter the number of predator and prey, respectively");
printf("\nyou start with separated by a blank: \n");
scanf("%lf %lf", P, H);
printf("\nEnter the time period desired between readings: \n");
scanf("%d", S);
}
/******************************************************/
/*********** Lotka Volterra Equations *****************/
double prey(double T, double H, double P, double r, double a){
double HR;
HR = r * H - a * H * P;
return HR;
}
double predator(double T, double H, double P, double m, double b){
double PR;
PR = b * P * H - m * P;
return PR;
}
/*******************************************************/
/************* Print results to a user specified file **************/
void OUTPUT(FILE **OUP){
char NAME[30];
printf("Input the file name in the form - drive:name.ext\n");
printf("For example A:OUTPUT.txt\n");
scanf("%s", NAME);
*OUP = fopen(NAME, "w");
}
/******************************************************/
A3
Appendix A:
Part I: A Two Species System
Program Output
t
H(t)
P(t)
0.000 50.00000000 15.00000000
1.000 47.56440601 14.98158125
2.000 45.26388152 14.92778285
3.000 43.10499676 14.84104360
4.000 41.09101226 14.72405330
5.000 39.22244894 14.57965542
6.000 37.49763978 14.41076186
7.000 35.91323890 14.22028115
8.000 34.46467359 14.01106045
9.000 33.14653287 13.78584068
10.000 31.95289173 13.54722354
11.000 30.87757418 13.29764903
12.000 29.91436099 13.03938168
13.000 29.05714908 12.77450400
14.000 28.30006972 12.50491555
15.000 27.63757292 12.23233643
16.000 27.06448436 11.95831385
17.000 26.57604073 11.68423096
18.000 26.16790836 11.41131724
19.000 25.83618935 11.14065952
20.000 25.57741841 10.87321356
21.000 25.38855317 10.60981557
22.000 25.26696006 10.35119343
23.000 25.21039726 10.09797757
24.000 25.21699601 9.85071130
25.000 25.28524108 9.60986045
26.000 25.41395099 9.37582249
27.000 25.60225842 9.14893489
28.000 25.84959090 8.92948293
29.000 26.15565204 8.71770683
30.000 26.52040309 8.51380835
31.000 26.94404484 8.31795691
32.000 27.42699959 8.13029508
33.000 27.96989313 7.95094382
34.000 28.57353611 7.78000714
35.000 29.23890482 7.61757662
36.000 29.96712075 7.46373544
37.000 30.75942860 7.31856228
38.000 31.61717226 7.18213499
39.000 32.54176822 7.05453401
40.000 33.53467584 6.93584577
41.000 34.59736390 6.82616587
A4
Appendix A:
Part I: A Two Species System
42.000
43.000
44.000
45.000
46.000
47.000
48.000
49.000
50.000
51.000
52.000
53.000
54.000
55.000
56.000
57.000
58.000
59.000
60.000
61.000
62.000
63.000
64.000
65.000
66.000
67.000
68.000
69.000
70.000
71.000
72.000
73.000
74.000
75.000
76.000
77.000
78.000
79.000
80.000
81.000
82.000
83.000
84.000
85.000
86.000
87.000
35.73127276
36.93777139
38.21810858
39.57335745
41.00435262
42.51161906
44.09529190
45.75502655
47.48989835
49.29829153
51.17777705
53.12497978
55.13543545
57.20343910
59.32188691
61.48211511
63.67374052
65.88450919
68.10016135
70.30432319
72.47843811
74.60175244
76.65137273
78.60241307
80.42825142
82.10091287
83.59159437
84.87133949
85.91186241
86.68650767
87.17131642
87.34615213
87.19582088
86.71110588
85.88962677
84.73643342
83.26425554
81.49335252
79.45094278
77.17023304
74.68911014
72.04859466
69.29117938
66.45918357
63.59324501
60.73104770
6.72560227
6.63427837
6.55233611
6.47993902
6.41727530
6.36456090
6.32204254
6.29000080
6.26875306
6.25865636
6.26011005
6.27355811
6.29949100
6.33844682
6.39101157
6.45781801
6.53954303
6.63690267
6.75064443
6.88153623
7.03035101
7.19784652
7.38473918
7.59167148
7.81917225
8.06760959
8.33713679
8.62763199
8.93863361
9.26927444
9.61821845
9.98360566
10.36301124
10.75342563
11.15126204
11.55239663
11.95224457
12.34587178
12.72813883
13.09386917
13.43803090
13.75591880
14.04332292
14.29667111
14.51313571
14.69069829
A5
Appendix A:
Part I: A Two Species System
88.000 57.90634990 14.82817105
89.000 55.14834052 14.92517721
90.000 52.48131741 14.98209633
91.000 49.92465397 14.99998243
92.000 47.49300219 14.98046408
93.000 45.19667188 14.92563497
94.000 43.04212517 14.83794298
95.000 41.03253161 14.72008391
96.000 39.16833826 14.57490450
97.000 37.44782027 14.40531751
98.000 35.86758844 14.21423039
99.000 34.42303944 14.00448771
100.000 33.10874238 13.77882659
101.000 31.91876109 13.53984416
102.000 30.84691552 13.28997528
103.000 29.88698784 13.03147905
104.000 29.03288050 12.76643244
105.000 28.27873330 12.49672955
106.000 27.61900687 12.22408513
107.000 27.04853886 11.95004132
108.000 26.56257872 11.67597649
109.000 26.15680591 11.40311562
110.000 25.82733565 11.13254144
111.000 25.57071556 10.86520595
112.000 25.38391585 10.60194189
113.000 25.26431501 10.34347407
114.000 25.20968275 10.09043014
115.000 25.21816127 9.84335094
116.000 25.28824570 9.60270010
117.000 25.41876431 9.36887317
118.000 25.60885895 9.14220593
119.000 25.85796576 8.92298219
120.000 26.16579639 8.71144092
121.000 26.53231957 8.50778284
122.000 26.95774303 8.31217646
123.000 27.44249549 8.12476363
124.000 27.98720857 7.94566472
125.000 28.59269822 7.77498332
126.000 29.25994540 7.61281069
127.000 29.99007566 7.45922982
128.000 30.78433705 7.31431932
129.000 31.64407605 7.17815705
130.000 32.57071089 7.05082360
131.000 33.56570173 6.93240562
132.000 34.63051706 6.82299904
133.000 35.76659576 6.72271224
A6
Appendix A:
Part I: A Two Species System
134.000
135.000
136.000
137.000
138.000
139.000
140.000
141.000
142.000
143.000
144.000
145.000
146.000
147.000
148.000
149.000
150.000
151.000
152.000
153.000
154.000
155.000
156.000
157.000
158.000
159.000
160.000
161.000
162.000
163.000
164.000
165.000
166.000
167.000
168.000
169.000
170.000
171.000
172.000
173.000
174.000
175.000
176.000
177.000
178.000
179.000
36.97530391
38.25788584
39.61540845
41.04869809
42.55826920
44.14424380
45.80626132
47.54337794
49.35395521
51.23553754
53.18471908
55.19700042
57.26663672
59.38647947
61.54781536
63.74020695
65.95134163
68.16689731
70.37043510
72.54333204
74.66476868
76.71178881
78.65944982
80.48108259
82.14867881
83.63342019
84.90635775
85.93924018
86.70547733
87.18120904
87.34643170
87.18611719
86.69124347
85.85964715
84.69660801
83.21508714
81.43556427
79.38545455
77.09812643
74.61158479
71.96691915
69.20664071
66.37303910
63.50668022
60.64514225
57.82205339
6.63166913
6.55001227
6.47790587
6.41553894
6.36312830
6.32092166
6.28920065
6.26828382
6.25852944
6.26033818
6.27415540
6.30047297
6.33983046
6.39281527
6.46006158
6.54224751
6.64009019
6.75433793
6.88575903
7.03512630
7.20319666
7.39068482
7.59823044
7.82635823
8.07543065
8.34559359
8.63671589
8.94832473
9.27953963
9.62900953
9.99485790
10.37464245
10.76533595
11.16333464
11.56449950
11.96423334
12.35759365
12.73943731
13.10458946
13.44802542
13.76505252
14.05147814
14.30375124
14.51906782
14.69543441
14.83168816
A7
Appendix A:
Part I: A Two Species System
180.000
181.000
182.000
183.000
184.000
185.000
186.000
187.000
188.000
189.000
190.000
191.000
192.000
193.000
194.000
195.000
196.000
197.000
55.06645816
52.40250505
49.84942102
47.42172085
45.12959060
42.97938483
40.97418264
39.11435771
37.39812782
35.82206089
34.38152329
33.07106450
31.88473748
30.81635826
29.85971059
29.00870251
28.25748246
27.60052173
14.92747606
14.98319930
14.99993079
14.97931475
14.92345714
14.83481486
14.71608962
14.57013132
14.39985353
14.20816260
13.99790041
13.77180031
13.53245480
13.28229359
13.02357036
12.75835655
12.48854077
12.21583247
A8
Appendix B: Part II: A Three Species System
Appendix B:
Part II: A Three Species System
C++ Program
/****************************************************
PREDATOR PREY MODEL
BASED ON THE MODEL LAID OUT BY LOTKA-VOLTERRA
THREE SPECIES SYSTEM
****************************************************/
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
main()
{
double A,B,ALPHA1, ALPHA2,
ALPHA3,H,T,W[3],X11,X12,X13,X21,X22,X23,X31,X32,X33,X41,X42,
X43;
double k1, k2, k3,beta1, beta2, beta3,V[3];
double a12, a13, a23;
int I,N;
FILE *OUP[1];
double F1(double, double, double, double, double, double, double, double);
double F2(double, double, double, double, double, double, double, double);
double F3(double, double, double, double, double, double, double, double);
double absval(double);
void INPUT(double *, double *, double *, double *, double *, int *, double *,
double *, double *, double *,double *, double *, double *, double *,
double *);
void OUTPUT(FILE **);
INPUT(&A, &B, &ALPHA1, &ALPHA2, &ALPHA3, &N, &k1, &k2, &k3,
&a12, &a13, &a23, &beta1, &beta2, &beta3);
OUTPUT(OUP);
/* STEP 1 */
H = (B - A) / N;
T = A;
/* STEP 2 */
W[0] = ALPHA1;
W[1] = ALPHA2;
W[2] = ALPHA3;
/* STEP 3 */
fprintf(*OUP, "%5.3f %11.8f
%11.8f
%11.8f\n", T, W[0], W[1],
W[2]);
/* STEP 4 */
for (I=1; I<=N; I++) {
B1
Appendix B:
Part II: A Three Species System
/* STEP 5 */
X11 = H * F1(T, W[0], W[1], W[2], k1, a12, a13, beta1);
X12 = H * F2(T, W[0], W[1], W[2], k2, -a12, a23, beta2);
X13 = H * F3(T, W[0], W[1], W[2], k3, -a13, -a23, beta3);
/* STEP 6 */
V[0] = W[0] + X11 / 2.0;
V[1] = W[1] + X12 / 2.0;
V[2] = W[2] + X13 / 2.0;
X21 = H * F1(T + H / 2.0, V[0], V[1], V[2], k1, a12, a13, beta1);
X22 = H * F2(T + H / 2.0, V[0], V[1], V[2], k2, -a12, a23, beta2);
X23 = H * F3(T + H / 2.0, V[0], V[1], V[2], k3, -a13, -a23,
beta3);
/* STEP 7 */
V[0] = W[0] + X21 / 2.0;
V[1] = W[1] + X22 / 2.0;
V[2] = W[2] + X23 / 2.0;
X31 = H * F1(T + H / 2.0, V[0], V[1], V[2], k1, a12, a13, beta1);
X32 = H * F2(T + H / 2.0, V[0], V[1], V[2], k2, -a12, a23, beta2);
X33 = H * F3(T + H / 2.0, V[0], V[1], V[2], k3, -a13, -a23, beta3);
/* STEP 8 */
V[0] = W[0] + X31;
V[1] = W[1] + X32;
V[2] = W[2] + X33;
X41 = H * F1(T + H, V[0], V[1], V[2], k1, a12, a13, beta1);
X42 = H * F2(T + H, V[0], V[1], V[2], k2, -a12, a23, beta2);
X43 = H * F3(T + H, V[0], V[1], V[2], k3, -a13, -a23, beta3);
/* STEP 9 */
W[0] = W[0] + (X11 + 2.0 * X21 + 2.0 * X31 + X41) / 6.0;
W[1] = W[1] + (X12 + 2.0 * X22 + 2.0 * X32 + X42) / 6.0;
W[2] = W[2] + (X13 + 2.0 * X23 + 2.0 * X33 + X43) / 6.0;
/* STEP 10 */
T = A + I * H;
/* STEP 11 */
fprintf(*OUP, "%5.3f %11.8f
%11.8f
%11.8f\n", T, W[0], W[1],
W[2]);
}
/* STEP 12 */
fclose(*OUP);
return 0;
}
/* Change functions F1, F2, and F3 for a new problem. */
double F1(double T, double n1, double n2, double n3, double k, double a12,
double a13, double B){
double f;
B2
Appendix B:
Part II: A Three Species System
f = k * n1 + pow(B,-1) * (a12 * n1 * n2 + a13 * n1 * n3);
return f;
}
double F2(double T, double n1, double n2, double n3, double k, double a21,
double a23, double B){
double f;
f = k * n2 + pow(B,-1) * (a21 * n1 * n2 + a23 * n2 * n3);
return f;
}
double F3(double T, double n1, double n2, double n3, double k, double a31,
double a32, double B){
double f;
f = k * n3 + pow(B,-1) * (a31 * n3 * n1 + a32 * n2 * n3);
return f;
}
void INPUT(double *A,double *B,double *ALPHA1, double *ALPHA2, double
*ALPHA3, int *N, double *k1, double *k2, double *k3, double *a12,
double *a13, double *a23, double *beta1, double *beta2, double *beta3)
{
double X;
char AA;
printf("This is the Runge-Kutta Method for Systems with m = 3.\n");
printf("Input left and right endpoints separated by blank\n");
scanf("%lf %lf", A, B);
printf("\nInput a positive integer for the number of subintervals\n");
scanf("%d", N);
printf("\nInput the interaction rates between species one and all others:
\n");
scanf("%lf %lf", a12, a13);
printf("\nInput the interaction rate between species 2 and 3:\n");
scanf("%lf", a23);
printf("Input the population rate change in absence of other species\n");
printf("separated by a blank: \n");
scanf("%lf %lf %lf", k1, k2, k3);
printf("\nInput the Lotka-Volterra equivalence numbers:\n");
B3
Appendix B:
Part II: A Three Species System
scanf("%lf %lf %lf", beta1, beta2, beta3);
printf("Input the three initial conditions, separated by blank.\n");
scanf("%lf %lf %lf", ALPHA1, ALPHA2, ALPHA3);
}
void OUTPUT(FILE **OUP)
{
char NAME[30];
printf("Input the file name in the form - drive:name.ext\n");
printf("For example A:OUTPUT.txt\n");
scanf("%s", NAME);
*OUP = fopen(NAME, "w");
fprintf(*OUP, "Populations for a three species system.\n");
fprintf(*OUP, " T
W1
W2
W3\n\n");
}
B4
Appendix B:
Part II: A Three Species System
Program Output
Populations for a three species system.
T
W1
0.000 15.00000000
1.000 13.87841079
2.000 12.85889632
3.000 11.93488166
4.000 11.10053086
5.000 10.35077464
6.000 9.68136134
7.000 9.08894239
8.000 8.57120905
9.000 8.12710659
10.000 7.75716693
11.000 7.46402533
12.000 7.25322463
13.000 7.13446803
14.000 7.12355729
15.000 7.24532744
16.000 7.53788856
17.000 8.05825718
18.000 8.88884637
19.000 10.14346632
20.000 11.97133452
21.000 14.55888214
22.000 18.13070743
23.000 22.95034276
24.000 29.31823334
25.000 37.56095099
26.000 48.00417411
27.000 60.92280231
28.000 76.46565508
29.000 94.56139095
30.000 114.82686881
31.000 136.51418439
32.000 158.53652648
33.000 179.59383868
34.000 198.37798299
35.000 213.79547470
36.000 225.13352831
37.000 232.12256147
38.000 234.89568769
W2
W3
50.00000000
75.00000000
51.11361595
88.61347432
52.59956664
104.63912435
54.54185156
123.46055984
57.05251047
145.49945673
60.28223543
171.20607746
64.43575443
201.03971046
69.79430398
235.43291920
76.74860751
274.73029418
85.84722305
319.08790269
97.86666473
368.31393955
113.91024940
421.62568967
135.53887985
477.29824621
164.92064601
532.20133769
204.93992687
581.29508496
259.10561183
617.33702988
330.94168976
631.36793425
422.46825775
614.80245055
531.80392903
563.45551225
651.21019601
481.78853312
768.00936366
383.39064341
869.13959587
285.49351118
946.18287188
201.35837417
996.98379375
136.56994198
1023.74720576
90.41600822
1030.22434164
59.19271504
1019.86356274
38.73082089
995.17269748
25.55278826
957.83443014
17.12717840
909.13477174
11.74072736
850.44008370
8.28032816
783.56729512
6.03903023
710.94294975
4.57305442
635.50077067
3.60511197
560.35335038
2.96193662
488.36297190
2.53493133
421.77213102
2.25572530
362.00935158
2.08110531
309.69382859
1.98375617
B5
Appendix B:
Part II: A Three Species System
39.000
40.000
41.000
42.000
43.000
44.000
45.000
46.000
47.000
48.000
49.000
50.000
51.000
52.000
53.000
54.000
55.000
56.000
57.000
58.000
59.000
60.000
61.000
62.000
63.000
64.000
65.000
66.000
67.000
68.000
69.000
70.000
71.000
72.000
73.000
74.000
75.000
76.000
77.000
78.000
79.000
80.000
81.000
82.000
83.000
84.000
233.88216456
229.68136380
222.95202170
214.33280744
204.39536799
193.62330154
182.40854657
171.05777402
159.80346064
148.81630586
138.21714758
128.08751177
118.47851185
109.41812331
100.91700316
92.97307375
85.57509119
78.70539727
72.34202441
66.46029299
61.03401363
56.03638359
51.44064759
47.22057824
43.35081873
39.80712172
36.56651032
33.60738208
30.90957240
28.45439086
26.22464201
24.20464096
22.38023426
20.73883745
19.26950377
17.96304359
16.81222371
15.81209207
14.96050171
14.25895834
13.71400458
13.33951110
13.16051433
13.21966612
13.58790094
14.38118928
264.78418981
226.78793750
194.96295273
168.47454425
146.49950267
128.28457337
113.17218936
100.60567443
90.12318748
81.34654616
73.96857748
67.74093727
62.46328382
57.97409021
54.14306937
50.86504520
48.05505685
45.64448481
43.57800981
41.81124624
40.30892250
39.04350955
37.99422454
37.14635964
36.49090808
36.02448086
35.74953235
35.67494235
35.81704152
36.20122352
36.86437039
37.85844607
39.25581457
41.15716252
43.70343051
47.09401874
51.61495091
57.68300439
65.91553080
77.24126964
93.07453850
115.57964674
148.03759700
195.24317685
263.59621876
359.99045865
1.94657399
1.95917173
2.01573327
2.11370348
2.25300360
2.43558496
2.66520803
2.94738001
3.28941206
3.70057532
4.19234658
4.77874241
5.47674687
6.30684258
7.29365965
8.46676090
9.86158673
11.52058709
13.49457361
15.84433002
18.64252463
21.97597458
25.94831620
30.68313994
36.32764895
43.05689601
51.07863979
60.63883244
72.02769536
85.58624317
101.71294920
120.86996625
143.58785040
170.46696167
202.17243185
239.41745726
282.92613404
333.36120811
391.19262305
456.46798366
528.42532276
604.86708337
681.21872002
749.31296050
796.37969503
805.75005740
B6
Appendix B:
Part II: A Three Species System
85.000 15.78405078
86.000 18.07621818
87.000 21.65280275
88.000 27.02820757
89.000 34.82308012
90.000 45.73617113
91.000 60.48649981
92.000 79.69328418
93.000 103.66887929
94.000 132.14403698
95.000 164.01868984
96.000 197.29693396
97.000 229.34373783
98.000 257.44454971
99.000 279.44415485
100.000 294.17275052
101.000 301.50895273
102.000 302.14534335
103.000 297.23566262
104.000 288.07760304
105.000 275.90018341
106.000 261.75585567
107.000 246.48749399
108.000 230.73798107
109.000 214.97870591
110.000 199.54292170
111.000 184.65699976
112.000 170.46687925
113.000 157.05922558
114.000 144.47778995
115.000 132.73578793
116.000 121.82513233
117.000 111.72325088
118.000 102.39808165
119.000 93.81170870
120.000 85.92298981
121.000 78.68944081
122.000 72.06857357
123.000 66.01883423
124.000 60.50025053
125.000 55.47486988
126.000 50.90704936
127.000 46.76364498
128.000 43.01413775
129.000 39.63072786
130.000 36.58842628
488.10279391
642.07341936
802.66982025
943.65733053
1045.45831390
1102.27031053
1118.15380730
1100.11720873
1054.39396870
986.02452245
899.84320231
801.41506298
697.19936598
593.85149829
497.10769772
410.89795938
337.08338752
275.77750671
225.94827532
186.00743118
154.23813392
129.04139540
109.04429784
93.12376553
80.38776713
70.14009329
61.84261108
55.08122655
49.53761438
44.96677869
41.17970820
38.03018023
35.40481736
33.21564284
31.39453836
29.88915039
28.65991040
27.67793070
26.92361630
26.38590091
26.06207813
25.95826701
26.09063448
26.48761428
27.19353911
28.27438835
761.97301039
661.44450446
521.51001004
374.80448686
249.97337586
158.69688021
98.36656022
60.82754217
38.18479174
24.67945193
16.60976732
11.74098270
8.76437744
6.92278377
5.77863770
5.07772039
4.67116567
4.47131808
4.42680693
4.50843011
4.70112512
4.99940230
5.40478464
5.92444618
6.57059895
7.36037924
8.31609784
9.46578613
10.84401050
12.49295482
14.46378921
16.81835885
19.63123918
22.99221621
27.00926239
31.81208984
37.55637331
44.42874332
52.65265307
62.49521701
74.27509563
88.37144884
105.23387611
125.39306901
149.47155684
178.19331652
B7
Appendix B:
Part II: A Three Species System
131.000
132.000
133.000
134.000
135.000
136.000
137.000
138.000
139.000
140.000
141.000
142.000
143.000
144.000
145.000
146.000
147.000
148.000
149.000
150.000
151.000
152.000
153.000
154.000
155.000
156.000
157.000
158.000
159.000
160.000
161.000
162.000
163.000
164.000
165.000
166.000
167.000
168.000
169.000
170.000
171.000
172.000
173.000
174.000
175.000
176.000
33.86517379
31.44202407
29.30344007
27.43777898
25.83808722
24.50341471
23.44102323
22.67018452
22.22888871
22.18597668
22.66330445
23.87537610
26.19455207
30.23906235
36.94955134
47.59325266
63.65980399
86.63991275
117.63186388
156.71392957
202.22857964
250.45805045
296.22882072
334.42107024
361.55649931
376.52553762
380.25553013
374.83354011
362.67211070
345.98734779
326.57908002
305.80087152
284.61748219
263.68747183
243.44167688
224.14746002
205.95760405
188.94605915
173.13348560
158.50526111
145.02407206
132.63866864
121.28992371
110.91500369
101.45022039
92.83296334
29.82683000
212.38994648
31.99255365
252.99921603
34.98132609
301.04845302
39.10875781
357.60924897
44.85936605
423.69921031
52.99375143
500.08721102
64.73299965
586.92475398
82.07601594
683.07032994
108.33172420
784.89799463
148.93842380
884.34412542
212.43520679
966.21801527
310.59891736
1006.18343315
454.77282188
974.40148952
644.47639237
852.65526262
853.45913704
659.95827589
1035.16516078
452.45051168
1152.60529400
282.52236921
1196.65206354
167.48908026
1176.70798871
98.12703628
1106.57801521
58.68787962
999.54022183
36.72095671
869.05796626
24.45458105
729.34922068
17.50479438
593.78919867
13.50151656
472.36844970
11.17881804
370.27731684
9.85740079
288.36128623
9.16824592
224.68237202
8.90864740
176.11132467
8.96751744
139.40012198
9.28634882
111.70616653
9.83858388
90.75100684
10.61864416
74.79541543
11.63617671
62.54699387
12.91323660
53.05830717
14.48322300
45.63840069
16.39095396
39.78332864
18.69356718
35.12433214
21.46210094
31.39022173
24.78370754
28.38045502
28.76451294
25.94599916
33.53317878
23.97576876
39.24525563
22.38703754
46.08844269
21.11869564
54.28889163
20.12657597
64.11870877
19.38033246
75.90481831
B8
Appendix B:
Part II: A Three Species System
177.000
178.000
179.000
180.000
181.000
182.000
183.000
184.000
185.000
186.000
187.000
188.000
189.000
190.000
191.000
192.000
193.000
194.000
195.000
196.000
197.000
85.00299437
77.90330417
71.48067537
65.68605875
60.47484607
55.80711013
51.64788042
47.96753207
44.74239227
41.95572217
39.59933902
37.67635288
36.20591901
35.23180126
34.83845993
35.18246512
36.55510213
39.50399726
45.04195206
54.90445263
71.65191556
18.86154880
18.56291577
18.48846460
18.65501130
19.09519474
19.86284412
21.04200754
22.76203665
25.22308681
28.74013195
33.82086501
41.30717969
52.63797492
70.34331964
98.96212172
146.62676485
227.18753809
360.55802038
563.13623580
819.82615711
1064.57577333
90.03934081
106.99160338
127.32180598
151.69617915
180.90310394
215.86898253
257.67138285
307.54462772
366.86858050
437.12296161
519.77324474
616.02230995
726.29971895
849.24262085
979.72471202
1105.28701879
1200.74124070
1224.17488626
1127.89284381
902.17121751
616.57774045
B9
Download