Bug fix : DEplot bugs

There are a number of bugs and weaknesses affecting DEplot in the DEtools package.

> with(DEtools):

The coords option, which allows the use of non-Cartesian coordinate systems in many other plotting commands, does not work here. In two-dimensional plots it causes an error message. In three-dimensional plots (with DEplot3d ) there is no error message, but the plot is done in Cartesian coordinates.

> DEplot({diff(r(t),t)=-sin(theta(t)/2), diff(theta(t),t)=1/2},
[r(t),theta(t)], t=0..3,
[[r(0)=1,theta(0)=0]], arrows=none,coords=polar);

Error, (in plot/options2d) unknown or bad argument, coords = polar

> DEplot3d({diff(r(t),t)=-sin(theta(t))/2, diff(theta(t),t)=1/2},
[r(t),theta(t)], t=-0..3,
[[r(0)=1,theta(0)=0]], scene=[r,theta,t],

[Maple Plot]

A work-around is to produce a list of points, and plot it using plot (in two dimensions) or spacecurve (in three dimensions).

> L1:= op(indets(DEplot({diff(r(t),t)=-sin(theta(t)/2), diff(theta(t),t)=1/2},
[r(t),theta(t)], t=0 .. 3,

> plot(L1,coords=polar,scaling=constrained);

[Maple Plot]

> L2:= op(indets(DEplot3d({diff(r(t),t)=-sin(theta(t))/2, diff(theta(t),t)=1/2},
[r(t),theta(t)], t=-Pi..Pi,
[[r(0)=1,theta(0)=0]], scene=[r,theta,t]),list(list(numeric)))):

> plots[spacecurve](L2,coords=cylindrical);

[Maple Plot]

This can be done for the direction field too (if you don't mind a small bit of distortion in the arrows). In order to have the direction field and trajectories in different colours, they should be plotted separately and combined using display .

> L3:= {op(indets(DEplot({diff(r(t),t)=-sin(theta(t)/2), diff(theta(t),t)=1/2},
[r(t),theta(t)], t=0 .. 3, r=0.1 .. 1.1,theta=0 .. 1.55, dirgrid=[10,8]),list(list(numeric))))}:

> p1:= plot(L1, coords=polar, colour=blue):
p2:= plot(L3, coords=polar, colour=black):

[Maple Plot]

When the right side of one of the differential equations is identically 0, the direction field can not be plotted. With no initial conditions, there is an error message. With initial conditions, solution curves are plotted correctly but there are no arrows.

> DEplot({diff(x(t),t) = y(t)*x(t), diff(y(t),t) = 0}, [x(t),y(t)], t=0..0.5, x=0..1, y=-1..1, arrows=SMALL);

Error, (in DEplot) Cannot produce plot, non-autonomous DE(s) require initial conditions.

> DEplot({diff(x(t),t) = y(t), diff(y(t),t) = 0}, [x(t),y(t)], t=0 .. 0.5, {[x(0)=.5,y(0)=.5]}, x=0..1, y=-1..1, arrows=SMALL);

[Maple Plot]

A work-around is to use a very small but nonzero value for the derivative.

> DEplot({diff(x(t),t) = y(t), diff(y(t),t) = 0.0001*y(t)}, [x(t),y(t)], t=0 .. 0.5, {[x(0)=.5,y(0)=.5]}, x=0..1, y=-1..1, arrows=SMALL);

[Maple Plot]

In some circumstances, the direction field plotter fails to do an evalf , with the result that some of the arrows to be plotted contain symbolic expressions.

> DEplot(diff(y(t),t) = exp(1-2*t), y(t), t = 0 .. 1,y=0..1);

Plotting error, non-numeric vertex definition

In this case, the problem doesn't occur if a floating-point value is placed inside the exp .

> DEplot(diff(y(t),t) = exp(1.0-2*t), y(t), t = 0 .. 1,y=0..1);

[Maple Plot]

Another work-around is to map evalf into every CURVES structure in the DEplot result.

> pl:= DEplot(diff(y(t),t) = exp(1-2*t), y(t), t = 0 .. 1,y=0..1):
pts:= indets(pl,specfunc(anything,CURVES)):
s:= map(t -> (t = map(evalf,t)), pts):

[Maple Plot]

See also:

DEplot , DEplot3d , DEtools , dfieldplot , display , dsolve(numeric) , fieldplot , odeplot , phaseportrait , plot , spacecurve

Maple Advisor Database R. Israel 1998