Search Loci: Developers:
Constructing Mathlets using JavaMath
Server Interactive Web Pages I
Adding Symbolic Computation to the Graph Explorer
An important feature of the JavaMath API is the ease with which it permits calls to a compute engine to be incorporated into an applet. To demonstrate this, we took as a starting point the first named author's mathlet, Graph Explorer.
The existing Graph Explorer has been used to support on-line labs for secondary school and college precalculus students. It accepts user input of the formulae for functions, uses Java code to parse the formulae, and plots their graph in a panel with various controls for zooming and panning. It also recognizes and gives user control over variable parameters in the equation, but it does not have any symbolic manipulation capability. By adding Maple calls via JavaMath, we were able to quickly add the code needed to obtain the exact formula of each root and display it as a label on the x-axis. Click here to try the new version of Graph Explorer.
The key to this was the provision by JavaMath of appropriate supporting classes. In particular, after having imported the package
and adding the lines
ProxyCAServer proxyCAServer = new ProxyCAServer("http://dev.camel.math.ca/ProxyCAS"); proxyMapleSession = proxyCAServer.createSession("Maple");
we were able to evaluate any Maple expression with a line of the form
resultString = proxyMapleSession.nativeEvaluate(inputString);
To enable the reader to gain confidence with using the JavaMath API, we have made available the source code and jars for this applet, which the user may run as a stand-alone Java application and experiment with the JavaMath server.
These pages also contain another applet that uses JavaMath to call the Maple-based RevEng for generating exact expressions for special points that fall within a user-chosen segment of the number line. The Maple session is called repeatedly as the user zooms and pans along the line.