Calculating

Maple always tries to calculate exactly.
For this reason, Irreducible fractions stay as
they are.
> 1/3+1/7;
                                      10
                                      --
                                      21
                                                                              

Of course, a numerical evaluation is possible at
any time and with arbitrary precision.

> evalf(1/3 + 1/7);
                                  .4761904762
 
> evalf(Pi, 50);
              3.1415926535897932384626433832795028841971693993751
                                                                                                                                                         

Maple usually makes no difference between real
and complex numbers. All elementry functions
are also defined for complex arguments.
In Maple, the imaginary unit I is shown in
upper case.

> abs(2+3*I);
                                       1/2
                                     13

> (3+2*I)/(2-I);
                                  4/5 + 7/5 I
                                                                             

Polynormials

Maple's true power lies in the fact that it can
also calculate symbolically, that is, using
variables such as x and y instead of
concrect numerical values
> factor(x^4+2*x^3-12*x^2-40*x-32);
                                              3
                               (x - 4) (x + 2)

> expand((x-1)^4);
                           4      3      2
                          x  - 4 x  + 6 x  - 4 x + 1
                                                                             

Maple is capable of performing very extensive
simplifications.

> simplify(exp(x*log(y)));
                                       x
                                      y
                                                                             
> simplify(sin(x)^2+cos(x)^2);
                                       1
                                                                             

Maple knows many rules for the simplification
of trigonometrical expressions.

> expand(cos(4*x)+4*cos(2*x)+3, trig);
                                           4
                                   8 cos(x)

> combine(4*cos(x)^3, trig);
                              cos(3 x) + 3 cos(x)
                                                                                                                                                          

Solution of equations

The solution of simple equations causes Maple
no problems.
> solve(x^2-x=5, x);

                                   1/2              1/2
                       1/2 + 1/2 21   , 1/2 - 1/2 21
                                                                             

Maple can also cope with equation systems.

>glsys:={2*x + 3*y +   z = 1,
          x -   y -   z = 4,
        3*x       + 7*z = 5}:

solve(glsys);

                               -14      -49      101
                          {z = ---, y = ---, x = ---}
                               41       41       41

Complex equation systems for which no symbolic solution
exists can always be solved numerically.
> fsolve({x^2+y^2=10, x^y=2}, {x, y});

                      {x = 3.102449071, y = .6122170880}
                                                                             

Matrix calculus

Maple has many commands for the definition and
manipulation of vectors and matrices. These commands
are defined in a so-called package and must be
activated with with prior to being used. In
the example, the inverse matrix and the determinant of
a are calculated.
>with(linalg):
a:=matrix([[1,2],[3,4]]);
inverse(a), det(a);

                                      [1    2]
                                 a := [      ]
                                      [3    4]

                               [-2      1  ]
                               [           ], -2
                               [3/2    -1/2]

Calculi involving matrices are normally carried out by
means of the command evalm.

>with(linalg):
b:=matrix([[w,x],[y,z]]):
evalm(a + b);

                                [w + a      x  ]
                                [              ]
                                [  y      z + a]

For manipulation of matrices, the operator &* has
been defined.

>with(linalg):
a:=matrix([[1,2],[3,3]]);
b:=matrix([[w,x],[y,z]]);
evalm(a &* b);

                                      [1    2]
                                 a := [      ]
                                      [3    3]

                                      [w    x]
                                 b := [      ]
                                      [y    z]

                            [ w + 2 y      x + 2 z ]
                            [                      ]
                            [3 w + 3 y    3 x + 3 z]

Limits, sums and products

The calculation of limits is also successful in
relatively complex cases, as show in the second example.
> limit((sqrt(1+x)-1)/x, x=0);
                                      1/2

> limit(x!/x^x, x=infinity);

                                       0
                                                                             

Even when the symbolic calculation of sums or products
fails, a numerical evaluation is often possible (second
example).

> sum(1/2^n, n=1..infinity);

                                       1

> evalf(product(1+1/x^2, x=1..infinity));

                                  3.676077910
                                                                             

Differentiation and integration

The diff command is designed for differentiation.
Often, the result can be further simplified with
simplify. diff can also be used without
problems for partial derivatives of multi-variable
functions.
> simplify(diff((x-1)/(x^2+1), x));
                                   2
                                  x  - 1 - 2 x
                                - ------------
                                     2     2
                                   (x  + 1)

> diff(sin(x*y), x);
                                  cos(x y) y
                                                                              
with integrate, both general and definite integrals
can be calculated (second example). For complex functions, the
results become fairly long-winded.
>integrate(1/(1+x^3), x);
                            2                 1/2                       1/2
    1/3 ln(x + 1) - 1/6 ln(x  - x + 1) + 1/3 3    arctan(1/3 (2 x - 1) 3   )
 
> integrate(sin(x^2), x=a..b);
                       1/2                               1/2
                    b 2      1/2   1/2                a 2      1/2   1/2
       1/2 FresnelS(------) 2    Pi    - 1/2 FresnelS(------) 2    Pi
                      1/2                               1/2
                    Pi                                Pi
                                                                                                                                                          

Differential equations

The formulation of differential equations and side
conditions is somewhat laborious. If the differential
equation is not too complex, Maple rewards your efforts
with correct solution. If too few secondary and boundary
conditions are specified, Maple formulates the solution
using the integration constants _Cn.
>deq:=diff(y(x),x) * y(x) * (1+x^2) = x;
dsolve({deq, y(0)=0}, y(x));
dsolve((y(x)^2 - x)*D(y)(x) + x^2-y(x) = 0, y(x));

                              /d      \            2
                       deq := |-- y(x)| y(x) (1 + x ) = x
                              \dx     /

                                 2 1/2                  2 1/2
                  y(x) = ln(1 + x )   , y(x) = -ln(1 + x )

             1/3       x
y(x) = 1/2 %1    + 2 -----,
                       1/3
                     %1

                   1/3     x            1/2 /      1/3       x  \
    y(x) = - 1/4 %1    - ----- + 1/2 I 3    |1/2 %1    - 2 -----|,
                           1/3              |                1/3|
                         %1                 \              %1   /

                   1/3     x            1/2 /      1/3       x  \
    y(x) = - 1/4 %1    - ----- - 1/2 I 3    |1/2 %1    - 2 -----|
                           1/3              |                1/3|
                         %1                 \              %1   /

                   3          3        2          3    6 1/2
%1 := -12 _C1 - 4 x  + 4 (-4 x  + 9 _C1  + 6 _C1 x  + x )

Series expansion

Where an exact solution of a mathematical problem is
impossible, a series using series will often help.
> series(sin(x), x=0, 10);
                    3          5           7             9      10
           x - 1/6 x  + 1/120 x  - 1/5040 x  + 1/362880 x  + O(x  )
                                                                             

The dsolve command is also capable of calculating
solutions of differential equations in series form.

>Order:=10;
deq:=diff(y(x), x$2) + diff(y(x), x) + y(x) = x+sin(x);
sln1:=dsolve({deq, y(0)=0, D(y)(0)=0}, y(x), series);

                                  Order := 10

                      / 2      \
                      |d       |   /d      \
               deq := |--- y(x)| + |-- y(x)| + y(x) = x + sin(x)
                      |  2     |   \dx     /
                      \dx      /

                    3         4          5          6           7            8
sln1 := y(x) = 1/3 x  - 1/12 x  - 1/120 x  + 1/240 x  - 1/5040 x  - 1/20160 x

                 9      10
     + 1/181440 x  + O(x  )

Laplace and Fourier transformations

The Laplace transformation is executed by means of
Laplace command. laplace is part
of intrans package. Prior to the use of
laplace, the package must be activated with
with(inttrans). invlaplace is available
for inverse transformation. After simplification
with combine, the original function is
reconizable agan.
>with(inttrans):
laplace(cos(t-a), t, s);
invlaplace(%, s, t);
combine(%, trig);

                               cos(a) s   sin(a)
                               -------- + ------
                                 2         2
                                s  + 1    s  + 1

                         cos(t) cos(a) + sin(t) sin(a)

                                  cos(-t + a)

Programming

Maple is not only a system for the calculation of
mathematical expressions, but a programming language
in its own right. the example shows the recursive
definition of the Fibonacci function.
>f:=proc(x::nonnegint)
    option remember;
    if x=0 then 0
    elif x=1 then 1
    else f(x-1)+f(x-2) fi
end:

f(50);

                                  12586269025