Contents | < Browse | Browse >

===========================================================================
                 Review: Maple V Release 3 for the Amiga.
  Stephen Judd                                              sjudd@nwu.edu
===========================================================================

Chances are good that you have heard of Maple, and wondered about it a
little.  It doesn't change colors in Autumn.  And although I haven't tried
it, I don't think it tastes very good on pancakes.  What Maple is and what
it is useful for is something that will hopefully be addressed in the text
which follows.

This review is going to be at a semi-highbrow level.  It seems to me that
if you think an eigenvalue is some kind of German bargain price, that a
phase portrait is used for identification purposes on Star Trek, or maybe
think that the only people interested in natural logs would be Greenpeace,
then this software will probably not be very eigenvaluable to you.  (On the
other hand, if you spend a lot of time doing problem solving in science and
mathematics, you will probably find this to be one of the more powerful
tools in your arsenal.)

Accordingly, I am not going to spend time explaining mathematics; I assume
that you either understand or at least can appreciate my examples.

This review will be in three parts.  First is a brief introduction to and
overview of Maple and symbolic mathematics in general.  The next part will
be some more detailed examples of using Maple to analyze and solve
problems.  The final part will deal with the Amiga-specific aspects of the
implementation.

I should also point out that I am an Applied Mathematician, and that the
examples I give reflect the kinds of things I personally use Maple for;
other disciplines may find Maple useful for other things, and this review
will barely scratch the surface of Maple's capabilities (the
quick-reference guide is over 500 pages long).  There are a number of books
available on Maple which will of course give much more detail about its
various capabilities.

Finally, since Applied Mathematicians are universally recognized as being
the most handsome, witty, brilliant, literate, and downright humble
examples of God's grandeur, I, well...  I forget what else I was going to
say.

So without further ado about nothing:

What in the world _is_ Maple?
-----------------------------

Although Maple is capable of a wide variety of numeric computations, the
real power of Maple is it's ability to deal with things symbolically.
Simply put, it can do calculations in the abstract, much as you or I can.

For example, how would you factor x^2 - 4?  Even a juror knows that it
factors into (x-2)*(x+2).  Let's see what Maple has to say about it:

    > factor(x^2-4);

            (x-2)(x+2)

What is the derivative of sin(x)?

    > diff(sin(x),x);

            cos(x)

How about the integral of cos(x), from some number a to pi/2?

    > int(cos(x), x=a..Pi/2);

            1 - sin(a)

Neat, huh?  Maple is of course useful for things besides doing Calculus
homework:

    > readlib(fourier);
    > fourier(t/(1+t^2), t, w);

        I Pi (e^w Heaviside(-w) - e^(-w) Heaviside(w))

Maple knows about many special functions:

    > assume(n>0);
    > int(exp(-t) * t^n, t=0..infinity);

        GAMMA(n~) n~

i.e.  n*gamma(n).  Maple knows plenty about most of the common special
functions (Bessel, Gamma, Dirac Delta, etc.), and knows quite a few others
besides!  Maple can solve large sets of equations, algebraic as well as
differential.  Maple also has powerful routines for generating plots in 2D
and 3D, even animations.  Maple has a programming language associated with
it, so you can write large programs to perform more complicated
calculations with Maple (e.g.  write a program to perform a Center Manifold
reduction); in fact, many such programs are included with Maple.  Maple
knows sequences and series (asymptotic series, power series, etc.), number
theory, graph theory, statistics...  and on, and on, and on.

Finally, Maple can save output in many ways.  It can save it to a file.
Maple can save it in LaTeX form (the double quote " is shorthand for the
previous expression, e.g.  GAMMA(n) n).:

    > latex(");

        Gamma (mbox {{tt `n`}})mbox {{tt `n`}}

You can even save stuff as FORTRAN or C code:

    > f:= sin(x^2 + y^2):
    > g:= cos(x^3 + y^3):
    > J:= jacobian([f,g],[x,y]):
    > fortran(J, optimized);

        t1 = x**2
        t2 = y**2
        t4 = cos(t1+t2)
        t10 = sin(t1*x + t2*y)
        J(1,1) = 2*t4*x
        J(1,2) = 2*t4*y
        J(2,1) = -3*t10*t1
        J(2,2) = -3*t10*t2

Very cool.  Maple is the cutting edge of symbolic mathematical programs.

Yeah, okay, fine; what is it Good For?
--------------------------------------

Maple, like computers in general, will not solve your problems for you.
Maple is a very powerful tool when you already know what you are doing,
e.g.  what kind of answer to expect, etc.  I use it in two ways: first, as
a program for doing massive amounts of grunt work, and second, as a tool
for analyzing various aspects of a problem.  That is, it may not solve my
problem, but I can use it to look at various specific parts of the problem,
to gain further insight into the problem.  Maple can tell you what happens,
but not why it happens.

The best way to demonstrate this is to work through some problems where I
have personally found Maple helpful.  Consider the following differential
equation:

    du/dt = f(u,v)
    dv/dt = g(u,v) 

Now let's say we can Taylor-expand f and g about the origin, to cubic
order:

    f(u,v) = au + bv + cu^2 + duv + ev^2 + ju^3 + ku^2v + luv^2 + mv^3
    g(u,v) = pu + qv + ...

Now let's expand u and v as a Fourier sine and cosine series.

    u = a_0 + a_1 cos(t) + b_1 sin(t) + a_2 cos(2t) + ...
    v = c_0 + c_1 cos(t) + d_1 sin(t) + ...

Now we need to substitute these expressions into the Taylor expanded f(u,v)
and g(u,v), and simplify all of the trigonometric expressions, e.g.  cos^2
(t) = (1 + cos(2t))/2.  Now, I am certainly capable of doing this, but it
is quite a tedious process, and doing it doesn't give me any great insight
into the problem.  Maple on the other hand is more than happy to chug
through something like this.  Maple is also happy to solve the sets of
algebraic equations which will result.

I am currently solving a problem similar to this one, but my equations
involve various x-derivatives as well, so my expansions are Fourier
expansions in space with time-dependent amplitudes.  Interestingly, by
writing a large Maple code to solve some things for me, I realized that I
could calculate things by hand, very simply.  So my big Maple code is now
just a check of my hand calculations.  But it does have an important moral:
using Maple helped me to gain some insight into solving the problem as a
whole.

There is another important moral: Maple will solve things as it sees fit. 
In the example of my program, when I first saved my results to a file, the
resulting file was some 6000 lines long!  So I had to reorganize the code
to make Maple calculate things in a different order, so that I could
interperet the resulting expressions.  In the process I realized that I
could write them in a fairly compact way.  Unfortunately there was no way
for me to trick Maple into writing them in that particular way!  So, as
always, a brain and a pencil still play the most important role.

To stress the point, I once wrote a program to perform a center manifold
reduction in Maple.  At one point I ended up with a rather large matrix,
which I needed to calculate the eigenvalues of.  Maple got a little
confused trying to calculate these symbolically; it just so happened that
the matrix had a lot of structure, though, so by breaking the problem into
smaller parts -- finding the eigenvalues of some small block-matrices -- I
could make Maple happy once again.

    How about another example:

        d^2x/dt^2 + w^2*x + b*x^2 + c*x^3 = 0

where w,b,c > 0, i.e.  a nonlinear pendulum with no damping.  A regular
pendulum has nice closed orbits -- it just oscillates back and forth about
the origin, and trajectories in phase space are circles.  What effect do
the nonlinear terms have on these trajectores?

This equation is pretty easy to analyze, since we can use a simple energy
argument.  Multiply the equation by dx/dt and integrate to get,

    (dx/dt)^2 + w^2*x^2 + 2/3 b*x^3 + 1/2 c x^4 = E

Constant values of E represent trajectories.  There is a quartic potential,
so I know the trajectories are closed.  Here is where Maple comes in handy:
what do the trajectories look like in phase space (that is, a plot not of x
versus time but of dx/dt versus x)?  I know they are roughly circular.  I
also know that a new pair of fixed points appear when b^2/4 = c*w^2, so I
should look at it in the two different cases:

    > with(plots):
    > Energy:= y^2 + x^4 + 2*x^3 + w^2*x^2;
    > e1:= subs(w=2, Energy);
    > e2:= subs(w=0.5, Energy);
    > contourplot(e1, x=-2..2, y=-4..4);
    > contourplot(e2, x=-2..2, y=-4..4);

This will plot level curves of Energy, which represent solutions to the
equation.  Contourplot is actually a three-dimensional plot, so with a
simple click and drag of the mouse I can look at it from a different
perspective -- instead of a bunch of circles it now looks like a bowl, so
you can really see the energy well.  Now I'll stick some sort of axis on
the graph.  All that remains is to print it out or save it to a postscript
file, publish a paper, become famous, and retire to an idyllic life of
writing entertaining Commodore 64 programs.

Incidentally, if you want to see Maple choke, try to look at the closed
orbits of e2 near the origin.  The plot routine does some pretty funky
disco if, say, x=-0.001..0.001 y=-0.00001..0.00001.

I could have used Maple in a few other ways as well for this problem.
After all, we very often can't use an energy argument.  First I write the
system as a two-dimensional coupled system:

        dx/dt = y
        dy/dt = -c*x^3 - b*x^2 - w^2*x

Now I can do a couple of things with these.  An easy thing to do would be
to plot the vector field (e.g.  the tangent lines to solution curves in
phase space):

    > u:= -2*x^3 - 3*x^2 - x;
    > fieldplot([y,u], x=-2..2, y=-4..4);

I could just generate a (numerically generated) phase portrait directly by
using the command phaseportrait(), and I really could just use the command
odeplot() to calculate the solution x(t) numerically.

Just for fun, let's try to get Maple to solve the equation analytically,
with initial conditions x(0)=1 and dx/dt(0)=0: (the fake TeX output is by
me, not Maple)

    > deqn:= diff(x(t), t$2) + w^2*x(t) + b*x(t)^2 + c*x(t)^3 = 0;
    > initcons:= x(0)=1, D(x)(0)=0;
    > dsolve(deqn, x(t));

        t = +/- int_0^x(t) 6 over sqrt(-36 w^2 y^2 - 24 b y^3 - 
            18 c y^4 + 72 C1) dy - C2

    > dsolve({deqn, initcons}, x(t), series);

        x(t)= 1 + (-1/2 b - 1/2 w^2 - 1/2 c) t^2 + 
              (5/24 c b + 1/6 c w^2 + 1/8 c^2 + 1/12 b^2 +
               1/8 b w^2 + 1/24 w^4) t^4 + O(t^6)

    > dsolve({deqn, initcons}, x(t), laplace);
    >

In the last example, Maple does not even return an error message!  It is
supposed to generate a solution by using Laplace transforms, but doesn't
like something about this equation.

Finally, to generate a particular solution curve:

    > d1:= subs(c=2, b=3, w=2, deqn):
    > dsolve({deqn, initcons}, x(t), type=numeric):
    > odeplot(p, [t,x(t)], -4..4);

From the earlier analysis I know that there will be very different looking
solution curves based on how large w is, and also depending on what initial
condition I choose, e.g.

    > d2:= subs(c=2, b=3, w=0.5, deqn):
    > ic:= x(0)=-1, D(x)(0)=0:

Plots of d2 will differ greatly depending on which initial condition is
used!  There are now three fixed points, one of which is unstable, and the
two initial conditions start near different fixed points.

So, once again, Maple can say what happens, but not why it happens.

In summary, I find Maple to be a very useful tool for analyzing problems
which involve tedious if not downright formidable calculations, such as
huge algebraic manipulations.  The ability to generate various types of
graphs such as vector fields is also helpful.  The ability to output in
LaTeX and also to write code to evaulate complicated mathematical
expressions is a very powerful and useful feature as well.  Finally, I find
it very handy to have for checking calculations of my own, both algebraic
and numerical (for instance, it provides an easy way to check if that FFT
code you just wrote works like you think it does).

Now, I don't even want to get started about the state of education in
America, but I will once again suggest that tools like Maple are of
tremendous value once you know what you are doing.  The downside to tools
of this sort is that there is a certain temptation to become dependent on
it for many trivial calculations!  Overall, though, it is a tool well worth
a place in any researcher's toolbox.

Hey, What Happened To The "Amiga" Part?
---------------------------------------

The Amiga version of Maple comes on nine disks, and the full installation
takes up around 25 Megabytes of disk space.  The main Maple package
consists of the disks, two hardcover Springer-Verlag books entitled "First
Leaves: A Tutorial Introduction" and "Maple V Language Reference Manual", a
small softcover set of Release 3 notes (about sixty pages long), a
double-wire-ring bound quick reference guide (about 500 pages), a list of
Maple related books, and a sheet of paper for the Amiga describing
installation instructions, online documentation, getting help, etc.

The rest of the Amiga-specific documentation is contained in two Amigaguide
files.  While some of you might have some apprehensions about this, you
shouldn't.  It was some time before I even got around to looking at them. 
Most of what you are doing is related to Maple, not the Amiga, and most of
the Amiga-specific features are very natural.

That said, the Amiga version has lots of really neat features.  The Amiga
version of Maple Vr3 was written by Willy Langeveld out at the Stanford
Linear Accelerator and Tomas Rokicki of Radical Eye software.  Both of
these names should be familiar to any Amiga user; they have both been
active in the Amiga community for many years.  Willy, whose background is
in particle physics, is probably best known in the Amiga community for
programs such as VLT and the XPK standard, and was instrumental in getting
ARexx included with the Amiga operating system.  Tomas is the author of
programs such as AmigaTex, dvips, and blitter Life, but is probably BEST
known for his BADGE killer demo "RadBoogie", with the mysterious quote "Or
I Won't Get Dressed...", which after some six years now I hope will finally
be explained to me ;).

What this means is that Amiga Maple was written by people who understand
both the needs of the scientist and the needs of the Amiga user -- a rare
treat in the Amiga world!  It means that you get a 'real' Amiga program --
one which is memory and CPU efficient, OS friendly, contains Amigaish
features, an ARexx port, etc.  -- which is also a tremendously powerful
tool for scientific research.
    
I should probably mention my setup.  I am running Maple on an Amiga 1200
with a DKB Mongoose 50MHz 030/882, 4+2M RAM, a 3.5" Maxtor IDE drive in an
external (Dataflyer) housing, PanaSync C1391 monitor, and other irrelevant
stuff (Supra 28.8, lame Chinon CD-ROM attached to SCSI option on the DKB
board, etc.).  The machine is running OS 3.0 (KS 39.106, WB39.29).

Hmmmmm, where to begin?  Maple can open on the workbench or on a custom
(public) screen.  I personally have it open up on a custom screen, Super72
interlaced.  This gives me a nice large worksheet area, and keeps the
workbench uncluttered.  Since the screen is public, I jump my editor (ame)
to that screen, so that I can work on my programs on the same screen (in
case this is not clear, I edit a large file containing my Maple code, and
then read the file into Maple's worksheet).  Maple has a problem with
stealing pens from the workbench and not giving them back, but a simple
patch is available.

You have a fair amount of control over things like fonts -- what kind of
font to use for equations, for text entry, etc.  This was very useful
indeed to me, because the default font for text entry is a CG font -- too
bad I don't have any CompuGraphic fonts!  (I think Commodore ran out of
money and deleted them from the OS distribution).  I changed the font to
Ruby, and everything was fine.

You can customize things in other ways, but I'm that type of user that
usually doesn't bother with something if I don't have to :).  For instance,
there is a tool bar at the top of the worksheet which you can customize,
etc.

Plots are pretty neat.  There are lots of dither and coloring options.
Plots can be saved as IFF files (in addition to PostScript etc.). 
Furthermore, plots can be clipped into the system clipboard, and hence
pasted into other programs easily.  I tried generating some 3D animations,
and they ran very smoothly.

Willy Langeveld et.al.  went to extraordinary lengths to make the program
memory and processor efficient.  It won't run on a 1M 1.3 Amiga 500, but
Willy tells me it will run on a 2000 with a few megs of RAM on it (and,
presumably, OS2.1 or so).  I was worried that with a mere six megabytes
about all I could do was integrate e^x dx, but so far I have been able to
do just about everything I have set out to do.  Sometimes I feel the memory
crunch, but I have zero complaints here: I am more surprised at how much I
can do with 6M.

Maple dynamically allocates memory as it needs it, but one downer is that
it doesn't give it back when it doesn't need it any more.  This is endemic
to the Maple core program, and is not fixable at the Amiga program level. 
One fix is to just quit Maple and start it again.  Another fix is to buy
more memory.  Still another is to use a program like VMM.  I have not tried
this, but it is supposed to work with Maple.  (One place this has bitten me
is in a loop, where I accidentally ended the loop with a ";" instead of a
":", which had the result of printing out each loop variable, etc.  This
then filled up the worksheet, which starts chomping up memory pretty
quick.)

The main Maple library is some 10 megabytes large; Amiga Maple searches
through the library to find what it needs, so you don't want to store that
library on a fragmented disk!  (In fact, it is recommended that you place
the library on its own partition).  On the plus side, functions and such
only need to be loaded once.

The rather extensive interactive help facility is all done in AmigaGuide
format.  You can also access help from the worksheet in the usual way, i.e.
>?int.  Revision 3 has the nice feature that you can access just the
examples, or just the calling format, etc., instead of the entire help
file.

Amiga Maple has an ARexx port with about 70 commands.

Support is excellent: you can't beat talking to the programmer!  I know
they've released at least one patch to fix the WB pen allocation problem,
and they are looking at the CG font issue.  Willy answered all of my
questions quickly, no matter how strange they were, and was quite enjoyable
to talk to.  Note that I am referring to Amiga specific issues here; for
Maple issues Waterloo is also very accessible.

So, how does this compare to similar products?  There is nothing similar to
it on the Amiga.  Software-wise, the closest thing to Maple is Mathematica.
I used Mathematica for several years before using Maple, and I greatly
prefer Maple.  Last time I checked, the ubiquitous, all-knowing "they"
seemed to feel that the Maple algorithms were more robust, but I really
have nothing to support such a claim.  Universities often support one
program or the other; here at Northwestern we are a "Maple School".  If you
are lucky and your school has a site license, you can get Maple at a very
substantial discount.  (It is also worth noting that programs like Matlab
are now using part of the Maple kernal).

Platform-wise, I use Maple on Suns and HPs (and Amigas :).  I think the
interactive help is better on those machines, but overall I like the Amiga
version better!  Manipulating plots is a snap.  Speed is very comfortable
(I haven't tried to do any comparisons with massive CPU- intensive
calcuations though).  I like having it on a separate screen.  Maybe I just
like having menus work in the Amiga way.  Suffice to say that I find it to
be entirely comparable to Maple on other platforms, to have a very
comfortable feeling about it, and an excellent example of properly written
Amiga software.

There is, I think, a certain stigma attached to the Amiga, that in terms of
serious scientific research it is not "professional".  May I suggest that
this is, in the words of a television censor, Bullstuff.  With Maple,
AmigaTeX, a good 2D plotting program like xmgr or gnuplot, and a decent
X-server, the Amiga literally becomes a mini workstation.  Granted, it
would be nice to have things like Matlab and IDL for the Amiga, but the
tools I mention above are just about "it" when it comes to tools in use
around the department here at Northwestern.

In short, then, with the addition of Maple to my software library, I now
have a mini-workstation which runs AmigaDOS.  Think about that: a
workstation with screens and ARexx and MODs and ArmyMiner and all the other
great things that are Amiga.  The only things I really need a true
workstation for are CPU-intensive tasks (and, truth be told, X-intensive
tasks).

While Maple is clearly not for everyone, it is a very valuable tool for any
serious researcher in the sciences.  It is my feeling that the mere
presence of Maple for the Amiga makes the machine a very credible platform
for performing scientific research, not to mention a very viable machine
for the 'education' market.  There isn't much scientific software for the
Amiga, but the few programs that do exist are excellent.  Thus I highly
recommend Maple Vr3 for the Amiga.  Maple is an outstanding piece of
software, and the Amiga version is excellent.  I exhort you to go forth and
purchase, and when the price sends you into shock, remember that you are
not just investing in your research, you are investing in the future of the
Amiga.