Next: Forcing Floating Point Evaluation Up: Numbers Previous: Numbers

Simple Arithmetic

You  can use all three systems as a calculator. For example, Maxima (note that at this stage I'll quit Bill Shelter's book mode and switch directly to the Maxima buffer):

(C1) 23 * 11 - 252.52;
(D1)                          0.47999999999998977

And now the same in Maple:
> 23 * 11 - 252.52;
.48

>

and in Mathematica:
In[2]:= 23 * 11 - 252.52

Out[2]= 0.48

In[3]:=


Mathematica and Maple sensibly round the result to give the same number of decimal digits as used in the input. Maxima, interestingly, shows you the whole truth, i.e., you can see the rounding error that always accompanies floating point  computations.

Factorials: Maxima first:

Now Maple:

and Mathematica:

In Maple  and in Mathematica we can now factor this very long integer as follows:

Maple:

and Mathematica:

In all three systems, the percent symbol, %, brings back  the last computed expression.

Maxima, unfortunately, does not provide a precooked function for doing this. In general, although Maxima does provide some support for number theory, it lags behind her two sisters in a few places. But watch this space! You are going to address this shortcoming and write ifactor for Maxima yourself at some stage!

In Maple the expression obtained by ifactoring 200! can be put back into a single number with

because ifactor returns a single numerical expression. But since Mathematica's FactorInteger returns a list, we would have to write a simple Mathematica program in order to wind that list back into 200!.

When it comes to arithmetic all three try to compute things as accurately as possible, i.e., they will try not to convert results of integer division and other algebraic operations into floating point numbers, unless specifically requested. This is Maxima trying to compute :

Maple does much the same:

Mathematica returns a result, which looks different, but only because it used one of the 3-s in the denominator to move downstairs:

Next: Forcing Floating Point Evaluation Up: Numbers Previous: Numbers
Zdzislaw Meglicki
2001-02-26