Commandline Scripting with Maple
As some of my readers may know, I’m a big fan of the commandline. GUI tools are all very neat and stuff, but when it comes to doing bulk operations there really is no substitute for commandline scripting with pipe-and-filter structures. Luckily, the guys at MapleSoft provide a commandline interface to Maple, so it can be called directly from your favourite shell environment, allowing you to do more complicated stuff than possible when using ‘bc’ or AWK.
Calling Maple from the Commandline
maple -q myCalculations.mpl > maple_output.dat
The ‘-q’ option tells Maple to not output all the overhead, you just get the output of your maple script.
Converting Maple’s output to single-line, 1-dimensional text
xmaple (the GUI) provides a nice 2-D in/output environment in mathematical notation. Not very useful for scripting, we want this in the ‘normal’ 1-D notation:
interface(prettyprint=0);
Furthermore, we want no silly linebreaks, especially if you plan to post-process your Maple output with a line-based parser (e.g. AWK):
interface(screenwidth=infinity);
Now, when you call maple from the commanline, your output will be neatly-formatted.