INTRODUCTION TO MAPLE
Teresa Dern Henson, Lecturer
Department of Mathematics
Naval Postgraduate School
September, 1995
SECTION 2: CALCULUS WITH MAPLE
GOALS:
In this section we will learn how to
1. calculate limits;
2. find derivatives;
3. compute finite sums; and
4. evaluate integrals.
We will also learn about the inert forms of these commands.
: Every input line
must end with either a semicolon (;) or a colon (:). Use a semicolon if
you want to see the output.
To learn more about
the Maple commands discussed below, enter
where command refers to the name of the command.
LIMITS, DIFFERENTIATION, and INTEGRATION
1. Limits. The limit of a function f as x
approaches c, is calculated by
The command can be modified by specifying a direction of approach.
>limit( f, x = c, left ); or >limit( f,
x = c, right );
For the limit at infinity, replace c with infinity.
>limit( f, x = infinity );
If x is approaching negative infinity, use -infinity in place of
infinity.
EXAMPLE: To calculate
,
input
>limit( (x^2-x)/(3+x), x = 3 );
EXAMPLE: To calculate
,
input
>limit( ( x - cos(x) )/x, x = infinity
);
2. Derivatives. The diff command is used to find the derivative
of an expression with respect to a specified variable. It can be use to
find derivatives of both single- and multi-variable functions. Input
to take the derivative of expr with respect to x.
The result of differentiation can be assigned to a variable name. The
input
takes the derivative of expr with respect to x and assigns
the result to a variable named df.
Using subs, derivatives may be evaluated.
EXAMPLE: To differentiate
with
respect to x, input
>diff( ( x^2) * sin (x), x);
EXAMPLE: To find the derivative of the
function
and evaluate it
at x = 1/2, input
>diff( sqrt(x ^ 2 - x), x );
>subs( x = 1/2, " );
where " refers to the last output: the derivative.OR assign the derivative
to a variable name. This would be useful if you wished to evaluate the
derivative at several points.
Derivatives may be plotted by using the plot command just as you would
for a function.
3. Sums. Finite sums can be computed using the sum command.
The syntax is
>sum( expr, k = a .. b );
where k is the index of summation, a is the initial value
of k, b is the final value of k, and expr is
an expression in the variable k.
EXAMPLE: To compute the sum from
k = 1 to k = 10 of the function
input
>sum( k ^ 2 - 2 * k, k = 1 .. l0 );
Infinite sums can also be computed by replacing the upper limit of summation
with infinity. Then the sum command would be entered as
>sum( expr, k = a .. infinity );
In many cases, Maple will be able to determine whether the sum converges
or diverges and will output an answer in the appropriate form. If Maple
cannot find a closed form for the sum, then the output will be the sum
displayed in "prettyprint" form.
4. Integrals. Maple can be used to evaluate both definite
and indefinite integrals; that is, it has both symbolic and numeric integration
capabilities. The same command is used in both cases, with only slight
differences in the syntax.
(a) For definite integrals use
EXAMPLE: To evaluate
input
>int( 5 * x ^ 2 + cos(x), x = -2 .. 3 );
OR first assign f to the expression 5x2 + cos(x)
and then integrate f.
>f:= 5 * x^2 + cos(x);
>int( f, x = -2..3 );
Symbolic limits of integration may be used, as in the Fundamental Theorem
of Calculus.
(b) For indefinite integrals use
where x is the variable of integration.
EXAMPLE: To evaluate
input
> int( x * sqrt(4 – x ^ 2), x );
You may use (4 - x ^ 2) ^ (1/2) in place of sqrt(4 - x ^
2) OR first assign f to the expression
and then integrate f.
5. Inert Functions. The Maple functions which we use to
perform differentiation, integration, -and summation and to find limits
all have inert forms which allow us to output symbols without performing
computations. The inert forms are: Diff, Int, Sum, and Limit. The syntax
is otherwise the same.
For example, to integrate the function f(x) = sin
x in Maple you use the int command and enter
The output is an antiderivative of sin x, namely - cos(x). The inert
form of this command is Int. The input
will result in the output
,
just as we would write it. The two forms may be combined, as in
>Int( sin(x), x) = int( sin(x), x);
which produces
.
The inert forms for the derivative, summation and the limit behave in a
similar way.
Inert forms may be evaluated if they are followed by the command