DEtools - Maple Programming Help

Home : Support : Online Help : Graphics : Packages : DEtools : DEtools/DEplot3d

DEtools

 DEplot3d
 plot the 3-D solutions to a system of DEs

 Calling Sequence DEplot3d(deqns, vars, trange, inits, options) DEplot3d(deqns, vars, trange, inits, xrange, yrange, zrange, options) DEplot3d(deqns, vars, trange, xrange, yrange, zrange, options)

Parameters

 deqns - list or set of ordinary differential equations vars - list or set of dependent variables trange - range of the independent variable inits - set or lists of lists; initial conditions for solution curves xrange - range of the first dependent variable yrange - range of the second dependent variable zrange - range of the third dependent variable options - (optional) equations of the form keyword=value

Description

 • Given a system of differential equations and a list of initial conditions, specified by inits, DEplot3d produces a three-dimensional representation of the solution curves of the system. There can be only one independent variable.
 • Direction fields, as found in DEplot, can also be plotted for autonomous systems with at most 3 first-order dependent variables, or non-autonomous systems with at most 2 first-order dependent variables, by specifying the arrows option.
 • The default method of integration is method=rkf45. Other methods can be specified in the optional equations. Note that because numerical methods are used to generate plots, the output is subject to the characteristics of the numerical method in use. In particular, unusual output may occur when dealing with asymptotes of solution curves. This also means that the initial conditions of the problem must be given in standard form, that is, the function values and all derivatives up to one less than the differential order of the differential equation at the same point.
 • Three of the dependent variables are plotted, or the independent variable and two dependent variables (for a 2-system). Other views can be specified using the scene option.
 • By default, plots are produced with boxed axes.
 • The inits parameter must take the form of

$\left[\left[x\left(\mathrm{t0}\right)=\mathrm{x0},y\left(\mathrm{t0}\right)=\mathrm{y0},z\left(\mathrm{t0}\right)=\mathrm{z0},...\right],\left[x\left(\mathrm{t1}\right)=\mathrm{x1},y\left(\mathrm{t1}\right)=\mathrm{y1},z\left(\mathrm{t1}\right)=\mathrm{z1},...\right],...\right]$

 inits is a list (or set) of lists, each sublist specifying one group of initial conditions (for one solution curve).
 • The xrange, yrange and zrange parameters must be specified as follows.

 $x\left(t\right)={x}_{1}..{x}_{2}$,  $y\left(t\right)={y}_{1}..{y}_{2}$, $z\left(t\right)={z}_{1}..{z}_{2}$  or $x={x}_{1}..{x}_{2}$,    $y={y}_{1}..{y}_{2}$,   $z={z}_{1}..{z}_{2}$

 By default, integration along a solution curve stops one mesh point after the specified range is exceeded. This may be overridden by the obsrange option.
 • The optional equations, options, consist of the following, as well as a restricted set of plot3d and dsolve[numeric] options.

 'animatefield' 'animatecurves' 'animate' 'arrows' 'color' 'dirfield' 'iterations' 'linecolor' 'numframes' 'obsrange' 'scene' 'size' 'stepsize'

 • animatecurves = true or false (default=false)
 animatecurves creates an animation of the evolving solution curve from the specified initial value(s) with respect to time. The default number of animation frames is 25, which can be changed with the numframes option. dsolve[numeric] is used to compute the solution curves for all specified initial values at different times. Note that if numpoints is provided, and the number of intervals ($\mathrm{numpoints}-1$) does not divide evenly by the number of frame intervals ($\mathrm{numframes}-1$), then a warning is produced, and numpoints is modified to be $⌈\frac{\mathrm{numpoints}-1}{\mathrm{numframes}-1}⌉\left(\mathrm{numframes}-1\right)+1$.
 • animatefield = true or false (default = false)
 animatefield creates an animation of the direction field with respect to time (that is, the arrows describing the direction field move as a solution with respect to time). The default number of animation frames is 25, which can be changed with the numframes option. dsolve[numeric,rkf45] is used to compute the trajectory of each arrow.
 • animate = true or false (default = false)
 animate is a shortcut that can be used to specify that both animatefield (if applicable) and animatecurves (if applicable) be used.
 • arrows = arrowtype
 arrowtype consists of 'cheap', 'hex', 'hybrid', or 'none'
 The arrowtype indicates the type of arrow to be used in a direction field. The default is 'none', which suppresses the calculation and display of any direction fields.
 • color, colour = arrowcolor
 arrowcolor can take many forms: 1) a plot[color] name; 2) COLOR('HUE', realcons); 3) COLOR('RGB', realcons, realcons, realcons); 4) the literal 'magnitude'; 5) magnitude[plot[color] name, plot[color] name]; 6) an expression in three variables; 7) a procedure in three variables; 8) a three-element list of expressions in three variables; or 9) a three-element list of procedures in three variables.
 In case 4), the color of the arrows is determined by the magnitude of the field, where blue is used for the lowest magnitude, and red is used for the highest. Case 5) is identical to case 4), but the low and high magnitude colors are specified as the indices of magnitude (for example, magnitude is equivalent to magnitude[blue,red]). In cases 6) and 7), coordinates of the arrows in the plane are passed to the expression or procedure.  The resulting values are then normalized on the range [0,1] and used as 'HUE' values. In cases 8) and 9), the resulting values are normalized on [0,1] and used as RGB values. Note that 6) and 8) must contain expressions of the plotted variables. This form of color handling is useful in differentiating features of the direction field.
 The default arrow color is red.
 • dirfield = [posint,posint,posint], posint, or [[float,float,float],[float,float,float],...]
 If [posint,posint,posint] is used, it specifies a grid on which to place the arrows. If posint is used, it specifies the number of randomly positioned arrows to use for the direction field. If [[float,float,float],[float,float,float],...] is used, each sublist describes a point at which an arrow is to be drawn.
 • iterations = integer
 iterations indicates the number of steps to be taken, of size stepsize, between stored points. This is useful in gaining a higher accuracy of plotted points by a small stepsize, without storing and plotting a large number of points.
 • linecolor, linecolour = color_info
 color_info may take one of five forms: 1) a plot[color] name; 2) COLOR('HUE', realcons); 3) COLOR('RGB', realcons, realcons, realcons); 4) an expression of the independent variable; or 5) a procedure of the independent variable.
 In the case of 4) and 5), values of the independent variable are passed to the expression or procedure. The resulting values are then normalized on $\left[0,1\right]$ and applied as 'HUE' values. This color handling is useful in displaying how the solution curve varies with the independent variable.
 In addition, forms 1) to 5) can be combined into a list, one element for each of the solution curves considered. Each list element is then applied to a corresponding solution curve.
 Default coloring is handled internally by the Maple plotting routines.
 • numframes = posint
 numframes specifies the number of frames used for animations, using any of the animate, animatefield, or animatecurves options.
 • obsrange = true or false
 obsrange indicates whether the integrator should stop once the solution curve has passed outside the specified range. It also specifies that any arrows that pass completely outside the viewing area should be removed (for an arrow-based animation). This is useful in the plotting of functions with asymptotic behavior. The default is true.
 • scene = [name, name, name]
 scene specifies the plot to be viewed. For example, scene = [x, y, z] indicates that the plot of x versus y versus z is to be plotted, with t implicit, while scene = [t, y, z] plots t versus y versus z (t explicit). This option can also be used to change the order in which to plot the variables. If vars is entered as a set, there is no default ordering; if entered as a list, the given ordering is used.
 • size = float or magnitude
 When size=magnitude, the size of the arrows is proportional to the magnitude of the direction field. When size is specified as a positive floating-point value, then this value is used to modify the size of all arrows in the direction field. The default value is size=1.0.
 • stepsize = realcons
 stepsize specifies the distance between mesh points to be used in generating the graph. For trange=a..b, the default stepsize value is $\frac{\left|b-a\right|}{20}$. If the stepsize specified is too large, the default is used.
 • Note that the solution curves are plotted with a default line thickness of $3$, but this can be changed with the thickness plot option.
 • There are many other optional equations, as supplied in plot3d and dsolve[numeric]. For more information, see plot3d[options] and the individual dsolve[numeric] help files.

Examples

 > with(DEtools):
 > DEplot3d({diff(y(x),x)=y(x)-z(x),diff(z(x),x)=z(x)-2*y(x)},{y(x),z(x)},x=0..3, [[y(0)=1.638,z(0)=2.31]],y=0..2,z=-4..4,scene=[x,z(x),y(x)],linecolor= COLOR(HUE,.5));
 > DEplot3d({diff(x(t),t)=-sin(t),diff(y(t),t)=cos(t)},{y(t),x(t)},t=-2*Pi..0, [[y(0)=0,x(0)=1]],scene=[t,x(t),y(t)],stepsize=0.1,linecolor=cos(t));
 > DEplot3d({D(x)(t)=y(t),D(y)(t)=-x(t)-y(t)},[x(t),y(t)],t=0..10,[[x(0)=0, y(0)=1],[x(0)=0,y(0)=.5]],scene=[t,x(t),y(t)],stepsize=.1, title=Damped oscillations,linecolor=t-sqrt(t));
 > DEplot3d({diff(x(t),t)=y(t),diff(y(t),t)=-sin(x(t))},[x(t),y(t)],t=0..10, [[x(0)=0,y(0)=.5],[x(0)=0,y(0)=1],[x(0)=0,y(0)=1.8],[x(0)=-2*Pi,y(0)=1], [x(0)=2*Pi,y(0)=.5],[x(0)=-2*Pi,y(0)=2.1],[x(0)=2*Pi,y(0)=-2.1]],stepsize=.2, title=Pendulum Vibrations,orientation=[0,90],linecolor=sin(t)-t);
 > DEplot3d({D(x)(t)=y(t)+z(t),D(y)(t)=-x(t)-y(t)+w(t),D(z)(t)=x(t)+y(t)-z(t), D(w)(t)=x(t)-w(t)*z(t)},{x(t),y(t),z(t),w(t)},t=0..10,[[x(0)=1,y(0)=0, z(0)=2,w(0)=3],[x(0)=0,z(0)=.25,y(0)=.5,w(0)=.165]],scene=[x(t),z(t),w(t)], stepsize=.1,orientation=[139,-106]);

Example with an animated direction field

 > r := .7*sqrt(x(t)^2+y(t)^2+z(t)^2):
 > LimCyc := [diff(x(t), t) = sin(r)*x(t)+y(t),            diff(y(t), t) = sin(r)*y(t)-z(t),            diff(z(t), t) = sin(r)*z(t)+x(t)]:
 > DEplot3d(LimCyc, [x(t),y(t),z(t)], t=0..10, [[x(0)=50, y(0)=20, z(0)=25],    [x(0)=20, y(0)=10, z(0)=15], [x(0)=15, y(0)=5, z(0)=5]], dirfield=50,    numpoints=300, color=[blue,red], axes=box, arrows=hybrid,    animatefield=true, numframes=75, orientation=[60, 55], obsrange=false);

The command to create the plot from the Plotting Guide is

 > DEplot3d({diff(x(t),t)=y(t),diff(y(t),t)=-sin(x(t))-y(t)/10},{x(t),y(t)}, t=-9..9,stepsize=0.1,[[x(0)=1,y(0)=1]],linecolor=t, axes=NONE);
 >

Compatibility

 • The zrange parameter was introduced in Maple 15.
 • The animatecurves, animatefield, animate, arrows, color, dirfield, numframes and size options were introduced in Maple 15.