Phase Portraits for ODE's and Autonomous Systems


Author of the original version: Richard Mansfield
Modified by Frits Beukers

Click in phase portrait window to select initial conditions!

To plot the solution curves of a two dimensional system of autonomous differential equations, click on the box beside the x'(t) = label and enter an expression. The TAB key will cycle you through to the next field where you can enter the right hand side of the second equation. You will need to reset the screen for these changes to take effect. Click anywhere in the phase portrait window to select an initial condition. You will then see part of the integral through that point. If the curve stops at a point while you really would like to see it continue, push the '>>' button. If you want to see where the integral curve came from, push the '<<' button. If you are sorry about a plot you can use the "undo" button. In the process you can change the colors of the integral curves for a nice visual effect.

By default, clicking in the phase portrait window, only goes forward in time from the cursor location. But, after you have used <<, it will go backwards. >> will then switch it to forwards again, etc.

The solutions window plots the two curves x(t) and y(t) (x in magenta, y in cyan). It only plots the curve corresponding to your last click in the phase portrait window. undo will clear the solutions window and block all solutions plotting until you have clicked again in the phase plane window.

The little direction field lines are dotted to indicate time's arrow. The little dots indicate beginning of time and the little stick indicate forward time. You can toggle the visibility of these line elements.

The nullclines button plots the two nullclines, the x-nullcline in magenta and the y-nullcline in cyan. Note that I use the bisection algorithm so I cannot plot curves like 0=x^2 which have no sign changes. (The x-nullcline is the locus of points where x'=0, and the y-nullcline is where y'=0.)

You may also plot a single first order equation by letting x'=1. Or better yet, since dy/dx = y'/x', to solve dy/dx = f(x,y), choose any two functions whose ratio is f.

The window button will open another panel where you can adjust the range of x and y that are displayed on the screen.

If you enter bad expressions in the x' or y' textfields, clicking to set initial conditions will do nothing. If you enter bad numbers in the window pop-up, "ok" will not hide the box. In any event you can always go back and fix the mistake.

Printing the graphics you generate is not entirely a trivial process. Because of entirely justified security concerns, most web browsers will not give this applet access to your file system and so it cannot print anything. You will have to grab the graphics with your own screen grabber (say xv in linux or snapshot on a Sun system) and print it yourself. There must be some equivalent programs for Win95 or Mac.

The parser was written by Darius Bacon and is available at his web site. Please see his file on copying the software.

Note on stepsize: The stepsize is adjusted dynamically. What I do is set the variable maxjump to be half the perimeter of the window divided by 200. Then at any point in the screen, I define Mod to be the maximum of sqrt((x')^2+(y')^2)) and 1. Then the local stepsize is maxjump/Mod. This prevents huge jumps from one point to the next even when the derivatives are very large.

Undocumented feature: The system does not have to be autonomous. You may use the variable t in x' and y'. The slope field and nullclines are calculated at t=0.