Calculus

Maple supports both differential and integral calculus for a wide range of mathematical expressions. It also easily calculates limits.

For example, we will define an expression called sample:

> sample:=5*x^3-4*x^2+9*x-8;

                                     3      2
                        sample := 5 x  - 4 x + 9 x - 8

Now we will differentiate sample with respect to x using the diff command. The resulting expression will be stored in d_sample:

> d_sample:=diff(sample,x);

                                          2
                          d_sample := 15 x  -8 x + 9

We can now integrate d_sample with respect to x. First off, we shall do so indefinitely:

> int(d_sample,x);

                                  3      2
                               5 x  - 4 x  + 9 x

Now, we shall do so over a specific range of -10 to +10.

> int(d_sample,x=-10..10);

                                     10180

How about another expression, sample2:

> sample2:=(1/(x+exp(x)));

                                             1
                             sample2 :=----------
                                        x +exp(x)

And when we integrate:

> int(sample2,x=0..2);

                                 2
                                 /
                                |       1                                
                                |  ----------dx
                                |  x + exp(x)                               
                               /                               
                              0

What happened here? Well, Maple was not able to calculate an exact answer. But a close approximation of an answer is available with the evalf command:

> evalf(");

                                  .6901755163

Here is another common situation:

> sample3:=1/x;

                                 sample3 :=1/x


> int(sample3,x);

                                     ln(x)

But if we (you know what is coming...) integrate around zero:

> int(sample3,x=0..1);

                                    infinity

Maple does not die like most compilers will.

Maple also allows for the calculation of limits.

> sample4:=1/x;

                                 sample4 :=1/x

> limit(sample4,x=0);

                                   undefined

> limit(sample4,x=infinity);

                                       0

This page Maintained by Dale H. Leschnitzer
Last Modified Monday, November 4, 1996

L O S   A L A M O S   N A T I O N A L   L A B O R A T O R Y
Operated by the University of California for the U.S. Department of Energy

Copyright © 1998 UC - Disclaimer