#
# Initialise snd load necessary packages
#
restart;
with(DEtools):
with(plots):
#
# Define parameters, differential equations and initial
# conditions
#
m := .18: A := .45: B := .3: C1 := .2: C2 := .14: MU := .5:
SYS := [ diff(x(t), t) = x(t)*(1-x(t)-m*y(t)),
diff(y(t), t) = y(t)*(1-2*x(t)-y(t)+m*x(t)-A*z(t)/(B+y(t))-C1),
diff(z(t), t) = z(t)*(MU*A*y(t)/(B+y(t))-C2)]:
IC := [ [x(0) = .7, y(0) = .1, z(0) = .5],
[x(0) = .8, y(0) = .2, z(0) = 0],
[x(0) = .9, y(0) = .3, z(0) = 0],
[x(0) = 1, y(0) = .4, z(0) = 0]
#
# Next four conditions just repeat the previous four:
# Redundant, so comment out
#
# [x(0) = .7, y(0) = .1, z(0) = .5],
# [x(0) = .8, y(0) = .2, z(0) = 0],
# [x(0) = .9, y(0) = .3, z(0) = 0],
# [x(0) = 1, y(0) = .4, z(0) = 0]
]:
#
# Define equations for fieldplot
#
RHS := eval(map(rhs, SYS), [x(t) = x, y(t) = y, z(t) = z]):
#
# Do plots with the range for the solution curves set to t=-1..1
# No singularities occur (changed limits on x, y, z so both plots
# cover the same domain
#
trange:=-1..1:
p1 := fieldplot3d(RHS, x = -1 .. 1, y = -1 .. 1, z = -1 .. 1, grid = [10, 10, 10], axes = boxed);
p2 := DEplot3d(SYS, [x(t), y(t), z(t)], t = trange, IC, stepsize = .2, linecolor=blue,axes = boxed);
display(p1, p2, view = [-1 .. 1, -1 .. 1, -1 .. 1]);
#
# For comparison, change the range for the solution curves to
# t=-10..10 - now singularities occur. All of these are to
# the left of -1. Maple will still plot as far as it can
#
trange:=-10..10:
p2 := DEplot3d(SYS, [x(t), y(t), z(t)], t = trange, IC, stepsize = .2, linecolor=blue,axes = boxed);