Plotting Three-Dimensional Differential Equations
This worksheet describes the DEplot3d routine, located in the DEtools package. Given a system of differential equations and a list of initial conditions, DEplot3d produces a three-dimensional representation of the solution curves of the system.
In order to access the routines in the DEtools package by their short names, the with command has been used.
restart
withDEtools:
Options
The DEplot3d supports a wide variety of options. These options are summarized in the following sections.
iterations and stepsize
The option iterations allows the user to ask that steps of size stepsize be taken between output points. This gives greater accuracy in the output points, while reducing the actual number of output points that have to be stored.
DE1:=ⅆ2ⅆx2yx=yxzx,ⅆⅆxzx=yxx
DEplot3dDE1,yx,zx,x=−2..2,y0=1,Dy0=2,z0=1,y=−4..4,obsrange=true,stepsize=0.05,iterations=3,orientation=−124,72
DE1≔ⅆ2ⅆx2yx=yxzx,ⅆⅆxzx=yxx
linecolor
The linecolor option works in a way similar to that of color, but it is applied to the solution curves.
plot[color] Name
DE2:=ⅆⅆtxt=yt,ⅆⅆtyt=−sinxt−yt10
DEplot3dDE2,xt,yt,t=−10..10,x0=1,y0=1,stepsize=0.5,title=LC 2,linecolor=magenta
DE2≔ⅆⅆtxt=yt,ⅆⅆtyt=−sinxt−yt10
HUE Value
DE3:=ⅆⅆxyx=yx−zx,ⅆⅆxzx=zx−2yx
DEplot3dDE3,yx,zx,x=0..3,y0=1.638,z0=2.31,y=0..2,z=−4..4,scene=x,zx,yx,title=LC 3,linecolor=COLORHUE,0.5
DE3≔ⅆⅆxyx=yx−zx,ⅆⅆxzx=zx−2yx
RGB Value
DE4:=ⅆⅆtxt=yt,ⅆⅆtyt=−sinxt−yt10
DEplot3dDE4,xt,yt,t=−10..10,stepsize=0.1,x0=1,y0=1,title=LC 4,linecolor=COLORRGB,0.65,0.89,0.75
DE4≔ⅆⅆtxt=yt,ⅆⅆtyt=−sinxt−yt10
Expression Applied as HUE
DE5:=Dxt=yt,Dyt=−xt−yt
DEplot3dDE5,xt,yt,t=0..10,x0=0,y0=1,x0=0,y0=0.5,scene=t,xt,yt,stepsize=0.1,title=Damped Oscillations - LC 5,linecolor=t−t,sint−cost
DE5≔Dxt=yt,Dyt=−xt−yt
Procedure Applied as HUE
l_p:=proctlocala,b; a≔10⋅sint2;b:=t;RETURNb − a; end:
DE6:=ⅆⅆtxt=−sint,ⅆⅆtyt=cost
DEplot3dDE6,yt,xt,t=−2π..0,y0=0,x0=1,scene=t,xt,yt,stepsize=0.1,title=LC 5,linecolor=l_p
DE6≔ⅆⅆtxt=−sint,ⅆⅆtyt=cost
method
The method option allows the user to make full use of the numerical integration schemes from dsolve/numeric. The default used is classical[rk4]. Consider the following three-dimensional equation plot that uses the classical method.
DE6:=Dxt=yt,Dyt=−xt−yt
DEplot3dDE6,xt,yt,t=0..10,x0=0,y0=1,x0=0,y0=0.5,scene=t,xt,yt,stepsize=0.1,linecolour=t−t,method=classicalrk2
DE6≔Dxt=yt,Dyt=−xt−yt
Now we use the dverk78 method for another plot.
DE7:=Dxt=yt,Dyt=−xt−yt
DEplot3dDE7,xt,yt,t=0..10,x0=0,y0=1,x0=0,y0=0.5,scene=t,xt,yt,stepsize=0.1,linecolor=t−t,method=dverk78
DE7≔Dxt=yt,Dyt=−xt−yt
obsrange
The obsrange option indicates whether the internal integration should stop after one of the user-specified ranges is exceeded. The default is to continue integration along a solution curve, even after the user boundaries have been exceeded. To illustrate this, we graph two DE plots.
DEplot3dⅆⅆtxt=yt,ⅆⅆtyt=−sinxt−yt10,xt,yt,t=−10..10,x0=1,y0=1,stepsize=0.15,x=−1..1.5,obsrange=false
DEplot3dⅆⅆtxt=yt,ⅆⅆtyt=−sinxt−yt10,xt,yt,t=−10..10,x0=1,y0=1,stepsize=0.15,x=−1..1.5,obsrange=true
plot and dsolve/numeric
A variety of plot and dsolve/numeric options are allowed in DEplot3d. Here is an example containing a number of these:
DEplot3dⅆⅆtxt=yt,ⅆⅆtyt=−sinxt,xt,yt,t=0..10, x0=0,y0=0.5,x0=0,y0=1, x0=0,y0=1.8, x0=−2π,y0=1,x0=2π,y0=0.5,x0=−2π,y0=2.1, x0=2 π,y0=−2.1, stepsize=0.2,title=Pendulum Vibrations,orientation=0,90,method=classicalabmoulton,corrections=3,axes=normal,linecolor=sint−t
For more information, consult the DEplot3d help page. Also see the worksheet Plotting Two-Dimensional Differential Equations. You can also refer to the following help pages: diff operator, D operator, classical method, and dverk78 method.
Return to Index for Example Worksheets
Download Help Document