Tutorial |
|
Here are three simple MapleNet applications so you can experiment on your own. Everything you need to create a simple MapleNet application is included, except for the Java Software Developer's kit (JDK), which you can download from www.javasoft.com - but you do need access to a MapleNet server to run the examples.
Step 1: Create a new directory on your hard disk
Step 2: Click on each of the File link shown below and save it to that same directory on your hard drive. You may need to right-click and select "Save As ..." if necessary.
- maplenetclient.jar
- the client classes to access a MapleNet server; they are provided by Waterloo Maple
- MapleEvaluator.java
- a simple text-based example of how to connect to a MapleNet server and execute Maple command; this class is also used by the other two programs
- Evaluator.java
- a more sophisticated graphical program to evaluate Maple commands; uses the previous MapleEvaluator but has better input/output support
- Plotter.java
- an example of how to coax MapleNet to create the graph of any function that Maple can understand
- WindowCloser.java
- a supporting class needed by the previous two GUI classes.
Step 3: Open a command prompt (DOS box), switch into the directory containing your files, and un-compress (un-jar) the MapleNet client classes by typing:
jar -xf maplenetclient.jarThis requires that your previously installed the complete Java Software Developer's Kit and that your path has been modified to include access to the jar, java, and javac programs.
Step 4: Compile the two main sample classes:
javac Evaluator.java javac Plotter.javaNote the other classes are dependent and will automatically compile.
Step 5: Execute your programs, one at a time, to see how they work. Let's start with:
java MapleEvaluator "factor(x^4 - 1)"which will factor the expression x4 - 1 and show the result as plain text. Next, start a more sophisticated program:
java Evaluatorthen enter factor(x^4 - 1) as before and hit the Evaluate button. As before the expression will be factored, but also displayed in proper math format. Finally let's create a graph:
java PlotterEnter the expression, exactly as shown: x -> 5*sin(2*x) and hit the Plot button. Note that the Plotter application uses MapleNet to evaluate the function defined but handles the actual drawing "manually". MapleNet does provide mechanisms to directly obtain a complete graph from Maple and place it into a Java program or applet. See the MapleNet API for further details.
![]() |
![]() |
|
| Screen Shot: Evaluator | Screen Shot: Plotter |
Note that you may have to adjust the parameters in the MapleEvaluator.java file before you can successfully connect to our MapleNet server. If the program compiles but you get a runtime error, it is most likely because our default MapleNet server is shut down, or you have been prevented from accessing our server - you might try again later, or contact Bert Wachsmuth.



