visualizing differential equations
TRANSCRIPT
PEI DU
The Gompertz equation has been used to model self-limited population growth.
It is characterized by the differential equation dy/dt=r*y*ln(K/y) along with the initial condition y(0)=y0.
Since it is widely used in science and is a typical example for ordinary differential equations, I want to use these slides to show how to draw its graphs using Maple.
graph Maple codes
t1 2 3 4 5 6
y(t)
2.4
2.5
2.6
2.7
2.8
2.9
3.0
Asymptotic solution
with(DEtools): Phaseportrait(D(y)
(t))=2*y(t)*ln(3/y(t)), y(t), t=1..6,[[y(0)=0.5],[y(0)=1],[y(0)=1.5]],title=‘Asymptotic solution’, colour=magenta,linecolor=[gold, yellow, wheat]);
Maple codes: > with DEtools: > y: =‘y’: > eqn:
diff(y(t),t)=2y(t)ln(3/y(t));
> dfieldplot(eqn, y(t),t=1..6,y=-1..4)
with(plots): p1:=dsolve({D(y)(t)=2*y(t)*ln(3/y(t)),y(0)=1},y(t),
type=numeric): p2:=dsolve({D(y)(t)=3*y(t)*ln(3/y(t)),y(0)=1},y(t),
type=numeric): p3:=dsolve({D(y)(t)=4*y(t)*ln(3/y(t)),y(0)=1},y(t),
type=numeric): p4:=dsolve({D(y)(t)=5*y(t)*ln(3/y(t)),y(0)=1},y(t),
type=numeric): p5:=dsolve({D(y)(t)=6*y(t)*ln(3/y(t)),y(0)=1},y(t),
type=numeric):
a1:= odeplot(p1,[t, y(t)],-1..3, color=blue): a2:= odeplot(p2,[t, y(t)],-.8..3, color=green): a3:= odeplot(p3,[t, y(t)],-.6..3, color=yellow): a4:= odeplot(p4,[t, y(t)],-.4..3, color=orange): a5:= odeplot(p5,[t, y(t)],-.4..3, color=red): Display(a1,a2,a3,a4,a5);
graph on Maple
Maple codes
With(plots): eqn: =D(y)(t)=C*y(t)*ln(3/
y(t)): toplot={seq(subs(C=i,
eqn), i=2..6)}; plot(toplot,
t=-5..5,-5..5);
The graphing codes showed above can be extended to many other ordinary differential equations.
Maple has many handy graphing functions. It can be used to simple functions, direction fields, asymptotes, and families of functions. Maple also has functions to create animated functions.
Special thanks to my tutor Kathy. : )