The basic unit for XPP is a file called an ode file that tells XPP the parameter and variable names and other named things. These files are editable ascii files. Use your favorite editor! For class, however, I will give you most of the files so you won't have to learn an editor.
We will look at the differential equation:
where f(t,y) is a continuous scalar function of 2 variables. We want to be able to put initial conditions in with a mouse and XPP prevents this if one of the axes is time, so we will study a two-dimensional system that is identical to the above equation:
# a generic first order equation with parameters f(t,y)=t^2-y^2 param a,b,c,d ds/dt=1 dy/dt=f(s,y) @ xp=s,yp=y,xlo=-5,xhi=20,ylo=-10,yhi=10,total=25 doneThe first line is a comment (all comments start with
#). A function of y and t is defined. Some parameter names are given and since they are not set to any value assume the value of 0. The differential equations are then given. The line beginning with
@tells XPP some things about plotting etc. The last line tells XPP that this is it we are done loading.
first.odeor download it
first.odeand drop it into the
xppaut first.odebut you can also do drag and drop.
XPP lets you use keyboard or mouse shortcuts. Click on (Initialconds)
(Mouse) and then click the mouse somewhere in the upper right
quadrant. A trajectory will be drawn.
Do it again several times in
different locations. Better yet choose Mice from the options and just
keep clicking away. Type ESC to exit this mode
You may get an OUT OF BOUNDS error; dont worry about it.
XPP forgets trajectories when new ones are created. To keep
them on the screen click on (Graphics) (Freeze) (Autofreeze). In
Now when you reintegrate the
equations, the old curve will be saved along with the new one. Up to
20 trajectories can be frozen. Click on (Graphics) (Freeze) (Remove
all) to get rid of the frozen curves.
Freeze 3 or 4 trajectories
using different initial conditions. Now click on (Dir. field/Flow)
(Scaled Direct Field) and accept 10 for the grid.
A field of tangents is
Now save the whole thing in a postscript file by choosing
(Graphics) (Postscript) and choose a file name.
The default is
Note Apparently Windows doesn't do Postscript, so that
instead, you can click on Ctrl PrtSc and grab the XPP window. Paste
this into a word document and then print this.
If you have frozen a bunch of graphs, get rid of them now with the (Graphics) (Freeze) (Remove all) sequence. Turn off the Auto-freeze. Choose (Initial conds) (New) and make s=0 and y=0 and you will get a nice trajectory. Another way to change the initial conditions is to click on the button labeled IC and change the numbers in the windows corresponding to the two variables. Click (OK) to accept the changes. This looks like it is nearly y=t . Can you prove this? (It is not homework, it is a challenge.)
1-y*tClick on (Ok). Draw the direction fields for this model. (First erase the screen with (Erase). Use the (Initialconds) (Mouse) option to choose a bunch of initial conditions. Where do all roads lead to? Can you prove this?
-s^2and clik (OK).
frame_0.gifThis is a GIF file which you can import into any program.