Next: Mistakes and Errors Up: Maple: An Introduction Previous: Getting Started

Arithmetic and Maple Notation

The basic arithmetic operators and constants known to Maple are

Notice that Maple does arithmetic with integers exactly. I.e. exact arithmetic is used instead of decimal arithmetic. Use decimal numbers if you want decimal numbers. Examples


> 2*3+2/7;
                                      44/7

> 2.0*3.0+2.0/7;
                                  6.285714286

This principle works for formulae too. Use the evalf function if you want a decimal approximation.


>  sin(Pi/3);
                                         1/2
                                    1/2 3

>  evalf(");
                                  .8660254040

There is no limit on the length of integers in Maple. It is quite common to compute with integers several hundred digits long. It is also possible to do decimal arithmetic to more than the default 10 digits of precision. You can compute to a 1000 digits if you want. This is done by assigning the the global variable Digits to the desired precision. Note, don't forget to reset Digits to 10 if you don't need more than 10 Digits! High precision operations take longer! Here are some examples


> 2^100;
                        1267650600228229401496703205376

> Digits := 50:
> evalf( sin(Pi/3) );

              .86602540378443864676372317075293618347140262690520

> Digits := 10:

In the above examples we have used the colon to terminate a command. Use the colon : instead of a semicolon ; if you don't want to see the output.


bondaren@thsun1.jinr.ru