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
with⁡DEtools:
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ⅆx2⁢y⁡x=y⁡x⁢z⁡x,ⅆⅆx⁢z⁡x=y⁡x⁢x
DEplot3d⁡DE1,y⁡x,z⁡x,x=−2..2,y⁡0=1,D⁡y⁡0=2,z⁡0=1,y=−4..4,obsrange=true,stepsize=0.05,iterations=3,orientation=−124,72
DE1≔ⅆ2ⅆx2y⁡x=y⁡x⁢z⁡x,ⅆⅆxz⁡x=y⁡x⁢x
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:=ⅆⅆt⁢x⁡t=y⁡t,ⅆⅆt⁢y⁡t=−sin⁡x⁡t−y⁡t10
DEplot3d⁡DE2,x⁡t,y⁡t,t=−10..10,x⁡0=1,y⁡0=1,stepsize=0.5,title=LC 2,linecolor=magenta
DE2≔ⅆⅆtx⁡t=y⁡t,ⅆⅆty⁡t=−sin⁡x⁡t−y⁡t10
HUE Value
DE3:=ⅆⅆx⁢y⁡x=y⁡x−z⁡x,ⅆⅆx⁢z⁡x=z⁡x−2⁢y⁡x
DEplot3d⁡DE3,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,title=LC 3,linecolor=COLOR⁡HUE,0.5
DE3≔ⅆⅆxy⁡x=y⁡x−z⁡x,ⅆⅆxz⁡x=z⁡x−2⁢y⁡x
RGB Value
DE4:=ⅆⅆt⁢x⁡t=y⁡t,ⅆⅆt⁢y⁡t=−sin⁡x⁡t−y⁡t10
DEplot3d⁡DE4,x⁡t,y⁡t,t=−10..10,stepsize=0.1,x⁡0=1,y⁡0=1,title=LC 4,linecolor=COLOR⁡RGB,0.65,0.89,0.75
DE4≔ⅆⅆtx⁡t=y⁡t,ⅆⅆty⁡t=−sin⁡x⁡t−y⁡t10
Expression Applied as HUE
DE5:=D⁡x⁡t=y⁡t,D⁡y⁡t=−x⁡t−y⁡t
DEplot3d⁡DE5,x⁡t,y⁡t,t=0..10,x⁡0=0,y⁡0=1,x⁡0=0,y⁡0=0.5,scene=t,x⁡t,y⁡t,stepsize=0.1,title=Damped Oscillations - LC 5,linecolor=t−t,sin⁡t−cos⁡t
DE5≔D⁡x⁡t=y⁡t,D⁡y⁡t=−x⁡t−y⁡t
Procedure Applied as HUE
l_p:=proctlocala,b; a≔10⋅sint2;b:=t;RETURNb − a; end:
DE6:=ⅆⅆt⁢x⁡t=−sin⁡t,ⅆⅆt⁢y⁡t=cos⁡t
DEplot3d⁡DE6,y⁡t,x⁡t,t=−2⁢π..0,y⁡0=0,x⁡0=1,scene=t,x⁡t,y⁡t,stepsize=0.1,title=LC 5,linecolor=l_p
DE6≔ⅆⅆtx⁡t=−sin⁡t,ⅆⅆty⁡t=cos⁡t
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:=D⁡x⁡t=y⁡t,D⁡y⁡t=−x⁡t−y⁡t
DEplot3d⁡DE6,x⁡t,y⁡t,t=0..10,x⁡0=0,y⁡0=1,x⁡0=0,y⁡0=0.5,scene=t,x⁡t,y⁡t,stepsize=0.1,linecolour=t−t,method=classicalrk2
DE6≔D⁡x⁡t=y⁡t,D⁡y⁡t=−x⁡t−y⁡t
Now we use the dverk78 method for another plot.
DE7:=D⁡x⁡t=y⁡t,D⁡y⁡t=−x⁡t−y⁡t
DEplot3d⁡DE7,x⁡t,y⁡t,t=0..10,x⁡0=0,y⁡0=1,x⁡0=0,y⁡0=0.5,scene=t,x⁡t,y⁡t,stepsize=0.1,linecolor=t−t,method=dverk78
DE7≔D⁡x⁡t=y⁡t,D⁡y⁡t=−x⁡t−y⁡t
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⁡ⅆⅆt⁢x⁡t=y⁡t,ⅆⅆt⁢y⁡t=−sin⁡x⁡t−y⁡t10,x⁡t,y⁡t,t=−10..10,x⁡0=1,y⁡0=1,stepsize=0.15,x=−1..1.5,obsrange=false
DEplot3d⁡ⅆⅆt⁢x⁡t=y⁡t,ⅆⅆt⁢y⁡t=−sin⁡x⁡t−y⁡t10,x⁡t,y⁡t,t=−10..10,x⁡0=1,y⁡0=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ⅆⅆt⁢x⁡t=y⁡t,ⅆⅆt⁢y⁡t=−sin⁡x⁡t,xt,yt,t=0..10, x⁡0=0,y⁡0=0.5,x⁡0=0,y⁡0=1, x0=0,y0=1.8, x⁡0=−2⁢π,y⁡0=1,x⁡0=2⁢π,y⁡0=0.5,x⁡0=−2⁢π,y⁡0=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