Plotting Two-dimensional Differential Equations
The DEplot routine from the DEtools package is used to generate plots that are defined by differential equations. This worksheet details some of the options that are available, in sections on Interface and Options.
In order to access the routines in the DEtools package by their short names, the with command has been used.
>
|
|
>
|
|
|
Interface
|
|
The interface accepts forms of input similar to those allowed by the dsolve[numeric] routine. For example,
>
|
|
>
|
|
Here is another example which uses strictly the D operator.
>
|
|
>
|
|
Autonomous systems are automatically determined for plotting phase portraits. For instance,
>
|
|
>
|
|
An example of a non-autonomous system is
>
|
|
>
|
|
To view examples that make use of the autonomous command, consult the autonomous help page.
Inputs may be specified as lists or sets. If lists are used, the order of the variables in a list control the ordering of plot axes (along the lines of the "scene" optional equation).
|
|
Options
|
|
Some of the options available to DEplot are summarized in the subsections that follow.
|
color
|
|
Color handling is allowed for the plotting of arrows in various ways.
|
plot[color] Name
|
|
>
|
|
>
|
|
|
|
HUE Value
|
|
>
|
|
>
|
|
|
|
RGB Value
|
|
>
|
|
>
|
|
|
|
Procedure Applied to HUE
|
|
>
|
|
>
|
|
>
|
|
|
|
Procedure Applied to RGB
|
|
>
|
|
>
|
|
>
|
|
|
|
Expression Applied as HUE
|
|
>
|
|
>
|
|
|
|
Expression List Applied as HUE
|
|
>
|
|
>
|
|
|
|
Color signifying magnitude of field
|
|
>
|
|
| (2.1.8.1) |
Default is [blue,red], blue for small magnitude, and red for large
>
|
|
Can specify colors for small and large magnitude instead
>
|
|
|
|
|
numpoints (and iterations and stepsize)
|
|
The numpoints option allows specification of the number of points used to plot solution curves in the DEplot.
>
|
|
| (2.2.1) |
>
|
|
>
|
|
The stepsize option can also be used to specify the number of points used in the plot, but only when the number of points it requests exceeds the default of 49, and one must take great care, as stepsize is also passed as an option to numerical dsolve when any of the classical methods are in use (not the default).
>
|
|
>
|
|
| (2.2.2) |
>
|
|
| (2.2.3) |
When using a classical method (see the method option below), the option iterations allows the user to ask that the specified number of steps be taken for each stepsize in the plot. This gives a greater accuracy in the output points, while retaining the actual number of output points present in the plot. Again, unless the number of points dictated by the step size is greater than 49, 49 points will be used.
In this example, the stepsize sent to dsolve is actually 0.02/2=0.01
>
|
|
In this example, the stepsize sent to dsolve is actually 0.02/4=0.005
>
|
|
|
|
linecolor
|
|
The linecolor option works in a fashion similar to that of color, but it is applied to the solution curves.
|
plot[color] Name
|
|
>
|
|
>
|
|
|
|
HUE Name
|
|
>
|
|
>
|
|
|
|
Expression Applied as HUE
|
|
>
|
|
>
|
|
|
|
Procedure Applied as HUE
|
|
>
|
|
>
|
|
>
|
|
>
|
|
>
|
|
|
|
|
method
|
|
The method option allows the user to make full use of the variety of numerical integration schemes available in dsolve[numeric]. The default used is rkf45. Consider the following two-dimensional differential equation plot that uses the classical[foreuler] method.
>
|
|
>
|
|
Now we use the dverk78 method for another plot.
>
|
|
>
|
|
|
|
obsrange
|
|
The obsrange= option indicates whether the internal integration should stop once 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, let us graph two DE plots.
>
|
|
>
|
|
>
|
|
|
|
arrow styles and size
|
|
There are 8 types of arrows available for use in DEplot.
>
|
|
| (2.6.1) |
The 4 original arrow types are 'small', 'medium', 'large' and 'line':
>
|
|
>
|
|
>
|
|
>
|
|
Two of the new standard arrow types are 'smalltwo' and 'mediumfill':
>
|
|
>
|
|
The other two newer arrow types are curved arrows.
These types of arrows, 'comet' and 'curve', are not straight arrows, but have a curvature that is computed from the field:
>
|
|
>
|
|
It is also possible to increase or decrease the size of the arrows with the 'size' argument.
Values larger than 1 increase the arrow size while values smaller than 1 decrease the arrow size.
>
|
|
>
|
|
Finally, it is possible to specify that the size of the arrows increase with the strength of the field:
>
|
|
>
|
|
|
|
arrow placement
|
|
>
|
|
| (2.7.1) |
In addition to the standard placement of arrows in a grid:
>
|
|
Random placement of arrows is also possible by simply specifying an arrow count as the argument to 'dirfield':
>
|
|
|
|
animation
|
|
Two types of animation are possible with DEplot:
1) Curve animation: The solution curve is traced out with each frame of the animation
2) Field animation: The field arrows move in the direction of the field during the animation
These can be used together by the 'animate' option, or separately by the 'animatecurves' and 'animatefield' options, with 'numframes' used to specify the number of animation frames (default is 25)
>
|
|
>
|
|
>
|
|
>
|
|
|
|
plot and dsolve[numeric]
|
|
A variety of standard plot and dsolve[numeric] options are allowed as options to DEplot.
>
|
|
|
|
For more information, consult the DEplot help page. Also, see the worksheet Plotting Three-dimensional Equations
. You can also refer to the following help pages: dsolve[numeric], D operator, classical method, and dverk78 method.
Return to Index for Example Worksheets
|