[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Índice] | [ ? ] |
62.1 Introduction to plotdf | ||
62.2 Definitions for plotdf |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Índice] | [ ? ] |
The function plotdf
creates a plot of the direction field of a
first-order Ordinary Differential Equation (ODE) or a system of two
autonomous first-order ODE's.
To plot the direction field of a single ODE, the ODE must be written in the form:
dy -- = F(x,y) dx |
and the function F should be given as the argument for
plotdf
. The independent variable is always identified as x,
and the dependent variable as y. Those two variables should not
have any values assigned to them.
To plot the direction field of a set of two autonomous ODE's, they must be written in the form
dx dy -- = G(x,y) -- = F(x,y) dt dt |
and the argument for plotdf
should be a list with the two
functions F and G, in any order.
If only one ODE is given, plotdf
will implicitly admit
x=t
, and G(x,y)=1
, transforming the non-autonomous
equation into a system of two autonomous equations.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Índice] | [ ? ] |
[
dxdt,dydt]
,...options...)
Displays a direction field in two dimensions x and y.
dydx, dxdt and dydt are expressions that depend
on x and y. In addition to those two variables, the
expressions can also depend on a set of parameters, with numerical
values given with the parameters
option (the option syntax is
given below), or with an range of allowed values specified by a
sliders option.
Several other options can be given within the command, or entered into
the menu that will appear when the upper-left corner of the plot window
is clicked. Integral curves can be obtained by clicking on the plot, or
with the option trajectory_at
. The direction of the integration
can be controlled with the direction
option, which can have values
of "forward", "backward" or "both". The number of integration steps is
given by nsteps
and the time interval between them is set up with
the tstep
option. The Adams Moulton method is used for the
integration; it is also possible to switch to an adaptive Runge-Kutta
4th order method.
Plot window menu:
The menu in the plot window has the following options: "Zoom", will change the behavior of the mouse so that it will allow you to zoom in on a region of the plot by clicking with the left button. Each click near a point magnifies the plot, keeping the center at the point where you clicked. Holding the SHIFT key while clicking, zooms out to the previous magnification. To resume computing trajectories when you click on a point, select "Integrate" from the menu.
The option "Config" in the menu can be used to change the ODE(s) in use and various other settings. After configuration changes are made, the menu option "Replot" should be selected, to activate the new settings. If a pair of coordinates are entered in the field "Trajectory at" in the "Config" dialog menu, and the "enter" key is pressed, a new integral curve will be shown, in addition to the ones already shown. When "Replot" is selected, only the last integral curve entered will be shown.
Holding the right mouse button down while the cursor is moved, can be used to drag the plot sideways or up and down. Additional parameters such as the number of steps, the initial value of t and the x and y centers and radii, may be set in the Config menu.
A copy of the plot can be printed to a Postscript printer, or saved as a postscript file, using the menu option "Save". To switch between printing and saving to a Postscript file, "Print Options" should be selected in the dialog window of "Config". After the settings in the "Save" dialog window are entered, "Save" must be selected in the first menu, to create the file or print the plot.
Plot options:
The plotdf
command may include several commands, each command is
a list of two or more items. The first item is the name of the option,
and the remainder comprises the value or values assigned to the option.
The options which are recognized by plotdf
are the following:
tstep
defines the length of the increments on the
independent variable t, used to compute an integral curve. If only
one expression dydx is given to plotdf
, the x
variable will be directly proportional to t: x - xinitial =
t - tinitial
.
[tstep,0.01] |
The default value is 0.1.
nsteps
defines the number of steps of length tstep
that will be used for the independent variable, to compute an integral
curve.
[nsteps,500] |
The default value is 100.
direction
defines the direction of the independent
variable that will be followed to compute an integral curve. Possible
values are forward
, to make the independent variable increase
nsteps
times, with increments tstep
, backward
, to
make the independent variable decrease, or both
that will lead to
an integral curve that extends nsteps
forward, and nsteps
backward. The keywords right
and left
can be used as
synonyms for forward
and backward
.
[direction,forward] |
The defaul value is both
.
tinitial
defines the initial value of variable t used
to compute integral curves. Since the differential equations are
autonomous, that setting will only appear in the plot of the curves as
functions of t.
[tinitial,6.7] |
The default value is 0.
versus_t
is used to create a second plot window, with a
plot of an integral curve, as two functions x, y, of the
independent variable t. If versus_t
is given any value
different from 0, the second plot window will be displayed. The second
plot window includes another menu, similar to the menu of the main plot
window.
[versus_t,1] |
The default value is 0.
trajectory_at
defines the coordinates xinitial and
yinitial for the starting point of an integral curve.
[trajectory_at,0.1,3.2] |
The option is empty by default.
parameters
defines a list of parameters, and their
numerical values, used in the definition of the differential
equations. The name and values of the parameters must be given in a
string with a comma-separated sequence of pairs name=value
.
[parameters,"k=1.1,m=2.5"] |
sliders
defines a list o parameters that will be changed
interactively using slider buttons, and the range of variation of those
parameters. The names and ranges of the parameters must be given in a
string with a comma-separated sequence of elements name=min:max
[sliders,"k=0:4,m=1:3"] |
xfun
defines a string with semi-colon-separated sequence
of functions of x to be displayed, on top of the direction field.
Those functions will be parsed by Tcl and not by Maxima.
[xfun,"x^2;sin(x);exp(x)"] |
xradius
is half of the length of the range of values that
will be shown in the x direction.
[xradius,12.5] |
the default value is 10.
yradius
is half of the length of the range of values that
will be shown in the y direction.
[yradius,15] |
the default value is 10.
xcenter
is the x coordinate of the point at the center of
the plot.
[xcenter,3.45] |
The default value is 0.
ycenter
is the y coordinate of the point at the center of
the plot.
[ycenter,4.5] |
The default value is 0.
width
defines the width of the plot window, in pixels.
[width,800] |
The default value is 500.
height
defines the height of the plot window, in pixels.
[width,600] |
The default value is 500.
Examples:
NOTE: Due to a bug in openmath
, all commands that use it, in particular
plotdf
, must end with a semicolon and not with a dollar sign. The
dollar sign might work in some of the graphical interfaces to Maxima, but
to avoid problems we will use a semicolon in all the examples below.
(%i1) load("plotdf")$ (%i2) plotdf(exp(-x)+y,[trajectory_at,2,-0.1]); |
(%i3) plotdf(x-y^2,[xfun,"sqrt(x);-sqrt(x)"], [trajectory_at,-1,3], [direction,forward], [yradius,5],[xcenter,6]); |
The graph also shows the function y = sqrt(x).
(%i4) plotdf([y,-k*x/m],[parameters,"m=2,k=2"], [sliders,"m=1:5"], [trajectory_at,6,0]); |
(%i5) plotdf([y,-(k*x + c*y + b*x^3)/m], [parameters,"k=-1,m=1.0,c=0,b=1"], [sliders,"k=-2:2,m=-1:1"],[tstep,0.1]); |
(%i6) plotdf([y,-g*sin(x)/l - b*y/m/l], [parameters,"g=9.8,l=0.5,m=0.3,b=0.05"], [trajectory_at,1.05,-9],[tstep,0.01], [xradius,6],[yradius,14], [xcenter,-4],[direction,forward],[nsteps,300], [sliders,"m=0.1:1"], [versus_t,1]); |
To use this function write first load("plotdf")
.
[ << ] | [ >> ] | [Top] | [Contents] | [Índice] | [ ? ] |
This document was generated by root on Novembro, 10 2006 using texi2html 1.76.