
210 3 Mechanistic Models I: ODEs
no time axis. This means that what you see in the phase plot is the curve (u(t), v(t)),
drawnonsomeinterval[t
0
, t
1
]. Comparing Figures 3.16 and 3.15b you will find
that both figures indeed refer to the same solution of Equations 3.279 and 3.280.
Figure 3.16 has been produced using the Maxima program
VolPhase.mac.With
some effort, R could also have been used to produce similar plots, but Maxima
provides a really nice package called
plotdf to produce phase plots that has been
used in
VolPhase.mac. The command producing the phase plot in this program is
1: plotdf(
2: [(r-a*v)*u,(b*u-m)*v]
3: ,[u,v]
4: ,[parameters, "r=0.1,m=0.15,a=0.08,b=0.17"]
5: ,[sliders,"r=0.07:0.1"]
6: ,[trajectory_at,1,1]
7: ,[tstep,0.1]
8: ,[nsteps,1000]
9: ,[u,0.69,1.1]
10: ,[v,0.7,1.7]
11: )$
(3.281)
In this code, line 2 defines the ODEs (3.279) and (3.280) via their right-hand sides.
The rest of the code is self-explanatory. Note the definition of the slider element
in line 5, which can be used to change the parameter value of r interactively
(Figure 3.16). Several of such parameter sliders can be added to the plot in this way.
Lines 7–8 define the interval [0, T]forwhichthecurve(u(t), v(t)) is plotted. We have
T =
tstep · nsteps here which gives T = 100 based on the settings in 3.281, and
this means that Figure 3.16 uses the same time interval as Figure 3.15b.
tstep
is the stepsize of the numerical algorithm. plotdf uses the Adams–Moulton
method, but it can also be switched to a Runge–Kutta method (Section 3.8) with
an adaptive stepsize [110]. If you use
plotdf as above, you should choose tstep
small enough, applying the heuristical procedures explained in Section 3.8 (Note
3.8.1).
The closed form of the trajectory in Figure 3.16 expresses the fact that the curve
(u(t), v(t )) always goes along the same way, which means that this is indeed a
periodical solution. It would not have been so easy to see this in the conventional
plot, Figure 3.15b. The real benefit of the phase plot, however, lies in the fact that
you can see the effects of changes of the initial conditions or of the parameters. If you
move the parameter slider in Figure 3.16, you can see that the trajectory changes its
size and position, and you can assess in this way the effects of parameter changes
much better than it would have been possible using conventional plots such as
Figure 3.15b. Try this yourself using
VolPhase.mac. Effects of different initial
condition can be studied particularly simple just by clicking into the plot. Every click
produces a trajectory going through the initial condition at your mouse position.
An example is shown in Figure 3.17a. This figure shows an interesting fact: you
see that the amplitudes of the oscillations of the predator and prey populations go