5
Plots the direction field of a first-order ordinary equation (ODE) or
6
a system of two autonomous ODE's
12
plotdf(expr, ...options...);
13
plotdf([expr1,expr2], ...options...);
15
In Maxima 5.9.0, plotdf will only work from xmaxima and you cannot use
16
the option "trajectory_at". In Maxima 5.9.1, in addition to those two
17
limitations there will also be two options missing from the plot menu:
18
"Integrate" and "Plot vs t". To solve those problems see
19
http://fisica.fe.up.pt/maxima/plotdf/download.html
21
In recent CVS versions plotdf should work fine both from xmaxima and maxima.
29
plotdf (expr,...,options,..)
31
where expr is an expression depending on x and y, which represents the
32
right-hand side of the ODE:
38
expr can also depend on a set of parameters that must be given numerical
39
values with the "parameters" option and those parameters can be changed
40
interactively with the "sliders" option (see "PLOTDF OPTIONS" below).
42
For numerical values of x, y, and the parameters, float(ev(expr, numer))
45
For a system of two autonomous, first-order ODE's, use:
47
plotdf ([expr1,expr2],...,options,..)
49
Where expr1 and expr2 are two expressions that depend on x and y (but not
50
on t), and represent the right-hand side of the ODE's:
56
as in the first case, options "parameters" and "sliders" can be used.
58
Several options can be given to the plotdf command, or entered into
59
the menu that will appear when you click on the upper-left corner of
60
the plot window. Integral curves can be obtained by clicking on the
61
plot, or with the option "trajectory_at". The direction of the
62
integration can be controlled with the "direction" option. The number of
63
integration steps is given by "nsteps" and the time interval between
64
them is "tstep". The Adams Moulton method is used for the integration;
65
it is also possible to switch to an adaptive Runge-Kutta 4th order
72
The menu in the plot window has the following options: "Zoom", will
73
change the behavior of the mouse so that it will allow you to zoom in
74
on a region of the plot by clicking with the left button. Each click
75
near a point magnifies the plot, keeping the center at the point where
76
you clicked. Holding the SHIFT key while clicking, zooms out to the
77
previous magnification. To resume computing trajectories when you
78
click on a point, select "Integrate" from the menu.
80
To change the ODE(s) in use, or change other settings, select "Config"
81
in the menu, enter new values in the dialog window, and then click on
82
"Replot" in the main menu bar. If you enter a pair of coordinates in
83
the field "Trajectory at" in the Config dialog menu, and press the
84
"enter" key, a new integral curve will be shown, in addition to the
85
ones already shown. You can change the color before you enter the
86
point coordinates. When you select "Replot" all integral curves, except
87
the last one, will erased.
89
Holding the right mouse button down while you move the cursor allows
90
you to drag (translate) the plot sideways or up and down. Additional
91
parameters such as the number of steps (nsteps), the initial t value
92
(tinitial), and the x and y centers and radii, may be set in the
95
You may print to a Postscript printer, or save the plot as a
96
postscript file, with the menu option "Save". To switch between
97
printing and saving to a Postscript file, select the "Print Options"
98
in the dialog window of "Config", change the settings, go back to
99
the main menu ("OK" twice) and select "Save".
106
Determines the width in x direction of the x values shown by plotdf.
111
Defines the height in y direction of the y values shown by plotdf.
114
[xcenter,0.0],[ycenter,0.0]
116
(xcenter,ycenter) is the origin of the window shown by plotdf.
121
Width of plotdf's canvas in pixels.
126
Height of plotdf's canvas in pixels.
129
[bbox, -2, -1.2, 3.5, 6]
131
Bounding box (xmin ymin xmax ymax) of the region shown by plotdf. It
132
will override the values o xcenter, ycenter, xradius, yradius.
137
The intial value of the t variable used by plotdf to compute integral
143
Number of steps to do in one pass by the integrator of plotdf.
148
t step size used by plotdf's integrator.
151
[xfun,"x^2;sin(x);exp(x)"]
153
A semicolon separated list of functions that plotdf will plot on top
154
of the direction field.
159
The direction (in time) that the integral curves will follow in a
160
direction field produced by plotdf. It may be "forward",
161
"backward" or "both".
166
Any value different from zero will make plotdf open a window showing
167
the time dependence of the independent variables in the last integral
171
[trajectory_at,0.1,3.2]
173
(x,y) coordinates of a point through which an integral curve
174
should be shown by plotdf.
177
[parameters,"k=1.1,m=2.5"]
179
List of parameters, and their numerical values, used in the
180
differential equation(s) given to plotdf.
183
[sliders,"k=0:4,m=1:3"]
185
Ranges of the parameters that plotdf will use to put sliders to
186
accept interactive change of the equations parameters.
193
To show the direction field of the differential equation
195
and the solution that goes through (2, -0.1):
197
plotdf(exp(-x)+y,[trajectory_at,2,-0.1]);
200
To obtain the direction field for the equation
202
and the solution with initial condition y(-1) = 3, we can use the
205
plotdf(x-y^2,[xfun,"sqrt(x);-sqrt(x)"],[trajectory_at,-1,3],
206
[direction,forward],[yradius,5],[xcenter,6]);
209
The following example shows the direction field of a harmonic oscillator,
210
and the integral curve through (x,y) = (6,0), with a slider that
211
will allow you to change the value of m interactively (k is fixed at
214
plotdf([y,-k*x/m],[parameters,"m=2,k=2"],[sliders,"m=1:5"],
215
[trajectory_at,6,0]);
218
The direction field of a Duffing equation:
220
plotdf([y,-(k*x + c*y + l*x^3)/m],[parameters,"k=-1,m=1.0,c=0,l=1"],
221
[sliders,"k=-2:2,m=-1:1"],[bbox,-3,-3,3,3],[tstep,0.1]);
224
The direction field for a damped pendulum, including the
225
solution for the given initial conditions, and with a slider that
226
can be used to change the value of the mass m:
228
plotdf([y,-g*sin(x)/l - b*y/m/l],[parameters,"g=9.8,l=0.5,m=0.3,b=0.05"],
229
[trajectory_at,1.05,-9],[tstep,0.01],[xradius,6],[yradius,14],
230
[xcenter,-4],[direction,forward],[nsteps,300],[sliders,"m=0.1:1"]);
234
$Id: plotdf.usg,v 1.1 2004/10/30 08:21:08 vvzhy Exp $
b'\\ No newline at end of file'