This is the second piece of what will hopefully be a detailed graphics package. The first is a real-valued function plotter.

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. Click anywhere in the top window to select an initial condition.

The Endpoints button will open another panel where you can adjust the range of x and y that are displayed on the screen. You may also change the time interval over which the solution is computed. You will need to Erase the screen for the changes to take effect.

The Show/Hide Vectors button toggles the display of the vector field of the differential equation.

I.C. Grid starts 8 solution curves from a grid of initial conditions.

The parser recognizes all of the standard math functions defined in java.lang.Math. The symbols "E" and "PI" are recognized as java's Math.E and Math.PI.

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

The java source for the rest of the applet lives in the three files: DrawCanvas.java, Grapher.java, and InputPanel.java. Please do not use it as an example of good java code.

The package uses a 4th order Runge-Kutta solver with a constant width mesh of 400 points, 200 from t = 0 to t = tmax and 200 from t = 0 to t = tmin. With this rather crude method it is easy to generate equations for which the solver fails badly (try x' = x^3). (As an aside, I have noticed that it is very easy to convert the code in Numerical Recipies in C into java code. A much better solver would be easy to write.)


Return to Applied Math or to Scott Herod's home page.
Copyright © 1997 by Scott A. Herod. All rights reserved.
Last updated by Scott Herod on January 27, 1997.