Você está na página 1de 155

A Guide to Maple 8 & 9 Commands

for Calculus I, II & III

By

Dr. Jennifer Bergner


Dr. Don Spickler

Department of Mathematics and Computer Science


Salisbury University
Copyright 2003

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

Table of Contents
Introduction................................................................................................................... 4
Basic Commands & Concepts....................................................................................... 5
Exact verses Approximate Solutions............................................................................ 5
Obtaining Previous Results, The Ditto Operator .......................................................... 5
Expressions ................................................................................................................. 6
Setting a Variable to a Value ....................................................................................... 7
Setting a Variable Back to a Variable .......................................................................... 8
Defining a List and a Set ............................................................................................. 9
The seq Command..................................................................................................... 10
The evalf Command .................................................................................................. 12
The eval Command ................................................................................................... 13
The subs Command ................................................................................................... 15
Mathematical Functions ............................................................................................ 16
Trigonometric and Hyperbolic Functions............................................................... 16
Exponential and Logarithmic Functions................................................................. 17
Root Functions ...................................................................................................... 17
Other Functions..................................................................................................... 17
The solve Command.................................................................................................. 17
The fsolve Command ................................................................................................ 20
Functions ..................................................................................................................... 24
Defining a Function of a Single Variable ................................................................... 24
Using the map Command .......................................................................................... 24
Defining Piecewise Functions ................................................................................... 25
Defining a Function of Several Variables .................................................................. 27
Limits, Differentiation, Integration & Sums.............................................................. 29
Evaluating Limits of Function of a Single Variable ................................................... 29
Evaluating Limits of Multivariable Functions............................................................ 30
Derivatives of Functions of a Single Variable............................................................ 32
Partial Derivatives of Multivariable Functions........................................................... 35
Integration of Single Variable Functions ................................................................... 39
Integration of Multivariable Functions....................................................................... 40
Finite and Infinite Sums ............................................................................................ 43
The taylor Command................................................................................................. 46
Graphing ..................................................................................................................... 48
Two Dimensional Plots ............................................................................................. 48
The plot Command: Plotting Functions.................................................................. 48
The plot Command: Plotting Parametrically Defined Equations............................. 54
The implicitplot Command .................................................................................... 55
The contourplot Command .................................................................................... 57

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

The gradplot Command ......................................................................................... 58


The fieldplot Command ......................................................................................... 60
Infinity Plots.......................................................................................................... 61
The logplot and loglogplot Commands .................................................................. 62
The arrow command.............................................................................................. 63
The display command............................................................................................ 66
Three Dimensional Plots ........................................................................................... 66
The plot3d Command: Plotting Functions.............................................................. 66
The cylinderplot Command ................................................................................... 73
The sphereplot Command ...................................................................................... 74
The arrow Command ............................................................................................. 74
The fieldplot3d Command ..................................................................................... 77
The gradplot3d Command ..................................................................................... 78
The implicitplot3d Command ................................................................................ 79
The spacecurve Command..................................................................................... 80
The display Command........................................................................................... 81
Packages ...................................................................................................................... 83
The student Package.................................................................................................. 83
The changevar Command ...................................................................................... 84
The distance Command ......................................................................................... 85
The intercept Command ........................................................................................ 85
The leftbox, leftsum, rightbox, rightsum, middlebox and middlesum Commands .. 86
The midpoint Command ........................................................................................ 89
The showtangent Command .................................................................................. 89
The trapezoid and simpson Commands.................................................................. 90
The Lineint Command........................................................................................... 91
The Student Package: Student[Calculus1] ................................................................. 92
The AntiderivativePlot Command ......................................................................... 92
The ApproximateInt Command ............................................................................. 93
The DerivativePlot Command ............................................................................... 98
The InversePlot Command .................................................................................... 99
The MeanValueTheorem Command .................................................................... 100
The NewtonsMethod Command .......................................................................... 101
The RiemannSum Command ............................................................................... 103
The RollesTheorem Command ............................................................................ 103
The SurfaceOfRevolution Command ................................................................... 103
The Tangent Command ....................................................................................... 105
The TaylorApproximation Command .................................................................. 106
The VolumeOfRevolution Command .................................................................. 108
The Asymptotes Command ................................................................................. 110
The CriticalPoints Command............................................................................... 111
The ExtremePoints Command ............................................................................. 111
The InflectionPoints Command ........................................................................... 112
The Roots Command ........................................................................................... 112
The linalg Package .................................................................................................. 113
The LinearAlgebra Package .................................................................................... 114
2

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

The VectorCalculus Package ................................................................................... 115


Defining a Vector................................................................................................ 116
The &x Operator and The CrossProduct Command ............................................ 117
The . Operator and The DotProduct Command .................................................... 117
The ArcLength Command ................................................................................... 118
The Binormal Command ..................................................................................... 119
The Curl Command ............................................................................................. 120
The Curvature Command .................................................................................... 120
The Del, Gradient and Nabla Commands............................................................. 122
The diff Command .............................................................................................. 123
The DirectionalDiff Command ............................................................................ 124
The Divergence Command .................................................................................. 125
The Flux Command............................................................................................. 126
The evalVF Command......................................................................................... 128
The int Command................................................................................................ 128
The Jacobian Command ...................................................................................... 131
The limit Command............................................................................................. 133
The LineInt Command......................................................................................... 133
The PathInt Command......................................................................................... 135
The PrincipalNormal Command .......................................................................... 137
The RadiusOfCurvature Command...................................................................... 138
The ScalarPotential Command............................................................................. 139
The SurfaceInt Command .................................................................................... 140
The TNBFrame Command .................................................................................. 140
The TangentLine Command ................................................................................ 142
The TangentPlane Command............................................................................... 142
The TangentVector Command............................................................................. 143
The Torsion Command........................................................................................ 144
The VectorPotential Command............................................................................ 145
The plots Package ................................................................................................... 146
The plottools Package ............................................................................................. 146
Animation .................................................................................................................. 150
Using Maple Help...................................................................................................... 153

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

Introduction
This manual is a quick reference guide to some of the Maple 8 and 9 commands
that are pertinent to Calculus I, II and III. It is designed to show you the syntax and
examples for specific Maple functions. It is not designed to show you how to put the
commands together to solve problems or to explain the ins and outs of Maple
programming. With this guide and your mathematical background you should be able to
use Maple to help solve more difficult problems and explore both the theory and
applications involved in the Calculus sequence.
The guide is organized by topic and is not to be read as a textbook. Many of the
examples that are given in the early sections use commands that are covered later in the
guide. While this may cause some mild frustration when you are first learning Maple,
once you have a little Maple under your belt you will find the extent of the examples
quite helpful.
Most of the material in this guide can also be found in Maple documentation and
the Maple Help System. In fact, both of these other resources offer a more complete
description of the command, its attributes and applicable options. One of the difficulties
with both the written and electronic help systems is that they are too complete. Most
descriptions in the help system explain the command to its fullest extent and offer rather
advanced examples. This guide concentrates on the way you will most likely use the
commands in a Calculus course and leaves the advanced topics alone. Curious readers
are certainly welcome to explore the help system for further explanations of the
commands given in this guide and many commands that we do not cover.

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

Basic Commands & Concepts


Exact verses Approximate Solutions
Maple is a computer algebra system, which means that it does symbol manipulation in
the same way we do when solving a problem by hand. It will keep its answers in exact
form whenever possible and in many cases you need to force it to give you an
approximation. Maple has several built-in commands that will approximate a value,
furthermore, there are some commands that have both exact and approximate forms. The
approximate form usually has an f at the end of the command name.

Obtaining Previous Results, The Ditto Operator


In Maple, percentage signs are used to refer to previously computed expressions.
Specifically, the % operator reevaluates the last expression computed, the %% operator
reevaluates the second last expression computed, and the %%% operator reevaluates the
third last expression computed. Be careful, the last expression is not always the one
directly above the %, it is the last one done in the session. For example, if we execute the
following commands in order,
> x:=2;
x := 2
> y:=3;
y := 3
> z:=x+y;
z := 5
Then the following ditto commands will return the following values.
> %;
5
> %%;
3
> %%%;
2
If we execute the same commands in reverse order then the following ditto commands
will return the following values.
> %;

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

2
> %%;
3
> %%%;
5

Expressions
The syntax for mathematical expressions in Maple is quite similar to other programs like
Excel and to most graphing calculators. The main thing to watch is that you must always
use an * to denote multiplication. Otherwise, it is simply + for addition, for
subtraction, * for multiplication, / for division, ^ for powers and we always use
parentheses ( ) for grouping. Note that [ ] and { } have other uses in Maple. For
example,
> 3*x^2-2*x+7;
3 x2 2 x + 7
> 4^(x-2);
4

( 2 + x )

Maple will also give you an error if the expression you input is in some way ambiguous.
For example,
> x^x^x;
Error, `^` unexpected

> x^(x^x);
x

( xx )

> (x^x)^x;
( xx )

As you know parentheses can make a big difference in the meaning of an expression.
Note the difference in the following outputs.
> (x^2-7*x+2)/(x+3);
x2 7 x + 2
x+3
> x^2-7*x+2/x+3;

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

x2 7 x +

2
+3
x

x2 7 x +

2
x+3

> x^2-7*x+2/(x+3);

Setting a Variable to a Value


To set a variable to a value you simply start the command with the variable name
followed by := and then the value or expression. For example, to define the variable x to
be the number 5 we would use,
> x:=5;
x := 5
To define the variable x to be the expression 2h 7 we would use,
> x:=2*h-7;

x := 2 h 7

Caution:
When you define a variable to be a particular value, every subsequence use of the
variable results in the value being substituted automatically. For example,
> f:=x->2*x^2+3*x-5;
f := x 2 x2 + 3 x 5
> x:=5;
x := 5
> 3*x;
15
> f(x);
60
> f(t);
2 t2 + 3 t 5
> x:=2*h-7;

x := 2 h 7

> f(x);
2 ( 2 h 7 )2 + 6 h 26

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

To reset a variable back to a variable, without any value, start with the variable followed
by the := followed by the variable in single quotes. For example,
> x:='x';
x := x
> f(x);
2 x2 + 3 x 5
Also, do not use this method to define a function, see the How To on defining functions.
For example, if we wanted to define to define the function f ( x ) = 2 x 2 + 3 x 5 the
command
> f:=2*x^2+3*x-5;
f := 2 x2 + 3 x 5
Would not do the trick. It does define f to be the given expression but it does not view f
as a function. Note the output of the following commands.
> f;
2 x2 + 3 x 5
> f(3);
2 x( 3 )2 + 3 x( 3 ) 5
The correct way to define this function is by,
> f:=x->2*x^2+3*x-5;
f := x 2 x2 + 3 x 5
> f(3);
22

Setting a Variable Back to a Variable


Often when a variable is set to an expression you will need to set it back to a variable. To
reset a variable back to a variable, without any value, start with the variable followed by
the := followed by the variable in single quotes. For example,
> x:=5;
x := 5
> x;
8

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

5
> x:='x';
x := x
> x;
x

Defining a List and a Set


In many applications it is advantageous or even necessary to create a list or set of items.
You need to be aware that there is a major difference between the two even though their
syntax is very similar. To define a set we begin with the name of the set followed by :=
followed by a list of items in curly brackets separated by commas. For example,
> t:={1,2,3,4,4,4,5,6};
t := { 1, 2, 3, 4, 5, 6 }
> t;
{ 1, 2, 3, 4, 5, 6 }
> s:={x,y,t,w-2,3,4};

s := { 3, 4, x, y, w 2, t }

Notice that in a set duplicates are removed. We define a list in the same manner except
that we use square brackets instead of curly brackets. Notice here that duplicates are not
removed.
> t:=[1,2,3,4,4,4,5,6];
t := [ 1, 2, 3, 4, 4, 4, 5, 6 ]
> t;
[ 1, 2, 3, 4, 4, 4, 5, 6 ]
Another difference between lists and sets that you may have noticed above is that a set
may rearrange the order of the items whereas a list will not. For example,
> t:={1,2,5,8,3,4,4,4,5,6,2,2,7};
t := { 1, 2, 3, 4, 5, 6, 7, 8 }
> t;
{ 1, 2, 3, 4, 5, 6, 7, 8 }
> t:=[1,2,5,8,3,4,4,4,5,6,2,2,7];
t := [ 1, 2, 5, 8, 3, 4, 4, 4, 5, 6, 2, 2, 7 ]
> t;

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

[ 1, 2, 5, 8, 3, 4, 4, 4, 5, 6, 2, 2, 7 ]

The seq Command


The seq command is for creating a sequence of expressions or objects that are separated
by commas. This makes the creation of special lists easy and quick. This command is
also useful in the creation of animations. It can be used to create a sequence of images
that can be pasted together with the display command. We will start with examples of
non-images. The seq command has the following syntax,
seq(expr, rng);
where expr is the general expression that will change with a change in a variable value
and rng is a range for that variable value. For example,
> seq(n^2,n=1..20);
1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400
It is customary for the range to begin and end at integer values but it not necessary. In
the following example we begin the sequence at 1.5. Note that this creates a sequence of
halves until the point where the next number exceeds the ending value.
> seq(n^2,n=1.5..10);
2.25, 6.25, 12.25, 20.25, 30.25, 42.25, 56.25, 72.25, 90.25
We can create sequences of functional values as well.
> f:=x->x^2-2*x+7;
f := x x 2 2 x + 7
> seq(f(t),t=-5..5);
42, 31, 22, 15, 10, 7, 6, 7, 10, 15, 22
Another option of the seq command is that one can use a list instead of a range. For
example the following command will do the same thing as the map command.
> seq(f(t),t=[1,3/2,5.2,7,9.11235]);
25
6, , 23.64, 42, 71.81022252
4
The seq command is great for defining lists. For example, say we are interested in
creating a list of values to numerically examine the limit of a function. To create a list of
inputs we would need to create a sequence of numbers that is approaching a particular

10

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

number. For example, say that we wanted to create a sequence of numbers that
approached 1 from above. One way to do it would be as follows.
> seq(1+1/2^n,n=0..20);
3 5 9 17 33 65 129 257 513 1025 2049 4097 8193 16385 32769 65537
2, , , , , , ,
,
,
,
,
,
,
,
,
,
,
2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768 65536
131073 262145 524289 1048577
,
,
,
131072 262144 524288 1048576
We can evalf the list to produce decimal approximations to these values.
> evalf(seq(1+1/2^n,n=0..20));
2., 1.500000000, 1.250000000, 1.125000000, 1.062500000, 1.031250000, 1.015625000,
1.007812500, 1.003906250, 1.001953125, 1.000976562, 1.000488281, 1.000244141,
1.000122070, 1.000061035, 1.000030518, 1.000015259, 1.000007629, 1.000003815,
1.000001907, 1.000000954
To create a list we simply need to place the seq command inside square brackets.
> lst:=[evalf(seq(1+1/2^n,n=0..20))];
lst := [ 2., 1.500000000, 1.250000000, 1.125000000, 1.062500000, 1.031250000,
1.015625000, 1.007812500, 1.003906250, 1.001953125, 1.000976562, 1.000488281,
1.000244141, 1.000122070, 1.000061035, 1.000030518, 1.000015259, 1.000007629,
1.000003815, 1.000001907, 1.000000954 ]
To analyze the function we then define the function and use the map command on it and
the list.
> f:=x->(x^2-1)/(x-1);
f := x

x2 1
x1

> map(f,lst);
[ 3.000000000, 2.500000000, 2.250000000, 2.125000000, 2.062500000, 2.031249984,
2.015625024, 2.007812480, 2.003906304, 2.001953280, 2.000976896, 2.000487424,
2.000245760, 2.000122880, 2.000065536, 2.000032768, 2.000000000, 2.000000000,
2.000000000, 2.000000000, 2.000000000 ]
Although you will probably have little use for this we will do a simple animation. We
will display a graph of the function f ( x ) = sin (nx ) as n takes on integer values from 1 to
10. The plot command is what will create each image in the sequence, it would look
something like the following,

11

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

plot(sin(n*x),x=-2*Pi..2*Pi)
To create a sequence of these plots for different values of n, we simply place the plot
command inside the seq command.
seq(plot(sin(n*x),x=-2*Pi..2*Pi),n=1..10)
Finally, to make it an animation we use the display command on the seq command with
the display option of insequence set to true.
display(seq(plot(sin(n*x),x=-2*Pi..2*Pi),n=1..10),
insequence=true)
The display command is in the plots package which can be used once we load it in. All
in all the Maple commands would be,
> with(plots):
Warning, the name changecoords has been redefined

> display(seq(plot(sin(n*x),x=-2*Pi..2*Pi),n=1..10),
insequence=true);

When you click on the image you should see the animation toolbar at the top of the
window.

The evalf Command


The evalf command will find an approximation to whatever it is given. For example,
> evalf(1/3);
0.3333333333
> evalf(Pi);
3.141592654

12

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

There is an optional value you can include to specify the number of decimal places the
approximation will use. This value either goes in square brackets after the evalf name or
as a parameter after the expression to be evaluated.
> evalf[100](Pi);
3.14159265358979323846264338327950288419716939937510582097494459230781\
6406286208998628034825342117068
> evalf(Pi,20);
3.1415926535897932385
Another way to force Maple to give you an approximate answer, or at least a decimal
answer is to at some point place a decimal number onto the expression. For example,
> f(4.7);
22.09
> f(47/100);
2209
10000

The eval Command


The eval command has many different uses. It s mainly used to evaluate an expression or
function at a particular value. For example,
> f:=x->x^2;
f := x x 2
> f(x);
x2
> eval(f(x),x=3);
9
> eval(x^2,x=3);
9
The main difference between the eval command and the subs command is that the subs
command will simply do the substitution, no mater if it makes sense or not. The eval
command on the other hand will do the substitution and then the evaluation of the result.
For example,
> eval(cos(x)/sin(x),x=0);
Error, numeric exception: division by zero

13

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> subs(x=0,cos(x)/sin(x));
cos( 0 )
sin( 0 )

> eval(%);
Error, numeric exception: division by zero

One other use for the command is to investigate the levels of substitution in an expression
that is a composition of several expressions. For example, say we have the following
expressions.
> a:=2*x-1;

a := 2 x 1

> x:=3*y^2+2;
x := 3 y2 + 2
> y:=z^3+z^2+z+1;
y := z 3 + z 2 + z + 1
> a;
2

6 ( z3 + z2 + z + 1 ) + 3

The above command did all of the substitutions automatically and then output the result.
We will get the same output using the eval command.
> eval(a);
2

6 ( z3 + z2 + z + 1 ) + 3

If we include an evaluation level as the second parameter in the eval command it will do
only that many evaluations. For example,
> eval(a,1);

2x1

> eval(a,2);
6 y2 + 3
> eval(a,3);
2

6 ( z3 + z2 + z + 1 ) + 3

> eval(a,4);
2

6 ( z3 + z2 + z + 1 ) + 3

14

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

The subs Command


The subs command is for substituting expressions into expressions. That is, it will take
all occurrences of an expression and replace it with another expression. The syntax for
the command is
subs(eqn,expr);
where eqn is an equation where the left hand side is the expression to be substituted for
and the right hand side is the expression to substituted in. The expr is the expression that
the substitution is being done on. For example,
> subs(x=2,3*x^2+2*x-1);
15
> subs(x=x-h,3*x^2+2*x-1);
3 ( x h )2 + 2 x 2 h 1
> subs(cos(x)=y,cos(x)*(sin(x)+cos(x)));
y ( sin ( x ) + y )
Note that the subs command does not care if the substitution is legitimate or not.
Sometimes the expression is simplified, as above, and sometimes it is not. For example,
> subs(x=0,cos(x)/sin(x));
cos( 0 )
sin( 0 )

> eval(%);
Error, numeric exception: division by zero

Also, there are cases where the substitution does not go through the way we would want
it to. This usually happens when there is a simplification step done, usually without our
knowledge, before the substitution is done. In this case there is another substitution
command called algsubs that is a bit more powerful.
> subs(x+1=x-a,3*(x+1)^2+2*(x+1)-1);
3 ( x a )2 + 2 x + 1
> algsubs(x+1=x-a,3*(x+1)^2+2*(x+1)-1);
3 ( x a )2 1 + 2 x 2 a
The algsubs command will even go as far as to find the expression by factoring or doing
some other manipulation. For example,
> expand((x+1)^4);

15

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

x4 + 4 x3 + 6 x2 + 4 x + 1
> algsubs(x+1=y,x^4+4*x^3+6*x^2+4*x+1);
y4
> expand((x+1)^4+2*x+1);
x4 + 4 x3 + 6 x2 + 6 x + 2
> algsubs(x+1=y,x^4+4*x^3+6*x^2+6*x+2);
2 y 1 + y4

Mathematical Functions
The following is a list of some of the more useful mathematical functions and their Maple
syntax.

Trigonometric and Hyperbolic Functions


Function
sin ( x )
cos( x )
tan ( x )
cot( x )
sec( x )
csc( x )
sinh ( x )
cosh ( x )
tanh ( x )
coth( x )
sech ( x )
csch ( x )
sin 1 ( x )

cos 1 ( x )
tan 1 ( x )

(x )
1
sec ( x )
csc 1 ( x )
sinh 1 ( x )
cosh 1 ( x )
tanh 1 ( x )
cot

Maple Syntax
sin(x)
cos(x)
tan(x)
cot(x)
sec(x)
csc(x)
sinh(x)
cosh(x)
tanh(x)
coth(x)
sech(x)
csch(x)
arcsin(x)

Notes
The sine function.
The cosine function.
The tangent function.
The cotangent function.
The secant function.
The cosecant function.
The hyperbolic sine function.
The hyperbolic cosine function.
The hyperbolic tangent function.
The hyperbolic cotangent function.
The hyperbolic secant function.
The hyperbolic cosecant function.
The inverse sine function.

arccos(x)

The inverse cosine function.

arctan(x)

The inverse tangent function.

arccot(x)

The inverse cotangent function.

arcsec(x)

The inverse secant function.

arccsc(x)

The inverse cosecant function.

arcsinh(x)

The inverse hyperbolic sine function.

arccosh(x)

The inverse hyperbolic cosine function.

arctanh(x)

The inverse hyperbolic tangent function.


16

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

coth 1 ( x )

(x )
csch 1 ( x )

sech

arccoth(x)

The inverse hyperbolic cotangent function.

arcsech(x)

The inverse hyperbolic secant function.

arccsch(x)

The inverse hyperbolic cosecant function.

Exponential and Logarithmic Functions


Function
ex
ln ( x )
log( x )
log b ( x )

Maple Syntax
exp(x)
ln(x)
log10(x)

Notes
The exponential function.
The natural logarithm function.
The common logarithm function.

log[b](x)

The general logarithm function, b > 0.

Root Functions
Function
x
n

Maple Syntax
sqrt(x)

Notes
The square root function.

surd(x,n)

The nth root function.

Other Functions
Function
x

Maple Syntax
abs(x)

Notes
The absolute value function.

The solve Command


The solve command is for finding exact solutions to equations or systems of equations.
The syntax is simple
solve(expr,vars)
where expr represents the equation or system of equations and vars is a variable or list of
variables. Note that the vars argument may be omitted; in this case the variables will be
automatically taken to be all of the variables present in the equation or system of
equations. Also, when inputting a system of equations or a list of more than one variable
you should place them in a list. We will begin with an easy example. To solve the
equation x 4 5 x 2 + 6 x = 2 we could use either
> solve(x^4-5*x^2+6*x=2);
1, 1, 1 + 3 , 1 3

17

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

or
> solve(x^4-5*x^2+6*x=2,x);
1, 1, 1 + 3 , 1 3
In the first solve command we let Maple determine that x was the variable. In the second
solve command we explicitly told Maple that our variable was x. To solve the system of
linear equations
2x + 3 y = 7
5x + 8 y = 9
we could use
> solve({2*x+3*y=7,5*x+8*y=9});
{ y = -17, x = 29 }
or
> solve({2*x+3*y=7,5*x+8*y=9},{x,y});
{ y = -17, x = 29 }
Note that the list of variables that are input in the solve command will make a difference
in the outputs. For example consider the following solve commands.
> solve(2*x+3*y+z=7);
{ z = 2 x 3 y + 7, x = x, y = y }
> solve(2*x+3*y+z=7,z);

2 x 3 y + 7

> solve({2*x+3*y+z-w=7,5*x+8*y-3*w+8*z=9},{x,y});
{ y = 17 11 z + w, x = 29 + 16 z w }
> solve({2*x+3*y+z-w=7,5*x+8*y-3*w+8*z=9},{x,y,z});
{ y = 17 11 z + w, x = 29 + 16 z w, z = z }
> solve({2*x+3*y+z-w=7,5*x+8*y-3*w+8*z=9},{x,y,z,w});
{ y = y, z = z, x = 12 y + 5 z, w = 17 + y + 11 z }
> solve({2*x+3*y+z-w=7,5*x+8*y-3*w+8*z=9});
{ y = y, z = z, x = 12 y + 5 z, w = 17 + y + 11 z }
> solve({2*x+3*y+z-w=7,5*x+8*y-3*w+8*z=9},x);

18

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

Since the solve command finds exact solutions the output can at times be very long. For
example.
> solve(x^3-7*x^2+2*x+3=0,x);
( 1916 + 12 I 9843 )
6

( 1/3 )

86

( 1/3 )

7 ( 1916 + 12 I 9843 )
+ ,
3
12

( 1/3 )

3 ( 1916 + 12 I 9843 )
43
7

+
( 1/3 )
3
3 ( 1916 + 12 I 9843 )
( 1916 + 12 I 9843 ) ( 1/3 )

1
86

,
+ I 3

( 1/3 )
2
6

3 ( 1916 + 12 I 9843 )

( 1916 + 12 I 9843 )

12

( 1/3 )

43
3 ( 1916 + 12 I 9843 )

( 1/3 )

7
3

( 1916 + 12 I 9843 ) ( 1/3 )

1
86

I 3

( 1/3 )
6
2

3 ( 1916 + 12 I 9843 )

To obtain a numeric approximation to solutions of this form simply apply the evalf
command to the output.
> evalf(%);
6.630098729 0.1 10 -9 I, -0.5126801310 0.1732050808 10-8 I,
0.8825814030 + 0.1732050808 10 -8 I
As will frequently happen when you evalf something like this you will get some roundoff error. Note that all of the imaginary parts of the above solution are extremely small.
This is an indication that the solutions are in fact real. Also since the solve command
gives exact solutions there may be times when it can not give you a nice closed form.
When Maple can give you an exact solution it will usually give a RootOf statement.
Consider the following output.
> solve(x^4-5*x^2+6*x=3,x);
RootOf( _Z 4 5 _Z 2 + 6 _Z 3, index = 1 ), RootOf( _Z 4 5 _Z 2 + 6 _Z 3, index = 2 ),
RootOf( _Z 4 5 _Z 2 + 6 _Z 3, index = 3 ),
RootOf( _Z 4 5 _Z 2 + 6 _Z 3, index = 4 )
As you can see, Maple knows that the equation has four solutions but it cant find any of
them exactly. This is why it has essentially given you the question back in the solution.
As above, to obtain an approximate solution to the equation, apply the evalf command to
the above output.
19

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> evalf(%);
1.538751996, 0.6068401503 + 0.5831600070 I, -2.752432296,
0.6068401503 0.5831600070 I

The fsolve Command


The fsolve command is for finding numeric approximations to the solutions of an
equation or system of equations. If the equation to be solved is a polynomial of a single
variable the fsolve command will attempt to find all of the real solutions to the equation.
If the equation is not a polynomial or if there is a system of equations to be solved the
fsolve command will attempt to find a single solution. Note that even for polynomials of
a single variable the fsolve command may not find all of the solutions. It is good practice
to examine any equation or system of equations to determine approximate values for the
solutions and then use the interval option in the fsolve command. The syntactical style of
the fsolve command is the same as the solve command.
fsolve(expr,vars)
where expr represents the equation or system of equations and vars is a variable or list of
variables. Note that the vars argument may be omitted, in this case the variables will be
automatically taken to be all of the variables present in the equation or system of
equations. Also, when inputting a system of equations or a list of more than one variable
you should place them in a list. We will start with a couple polynomials. Note that the
following fsolve command returns two real solutions for the solution.
> fsolve(x^4-5*x^2+6*x=3,x);
-2.752432296, 1.538751996
Using the solve command and the evalf command we see that the other two solutions are
in fact complex (non-real). Hence the fsolve command found all of the real solutions.
> solve(x^4-5*x^2+6*x=3,x);
RootOf( _Z 4 5 _Z 2 + 6 _Z 3, index = 1 ), RootOf( _Z 4 5 _Z 2 + 6 _Z 3, index = 2 ),
RootOf( _Z 4 5 _Z 2 + 6 _Z 3, index = 3 ),
RootOf( _Z 4 5 _Z 2 + 6 _Z 3, index = 4 )
> evalf(%);
1.538751996, 0.6068401503 + 0.5831600070 I, -2.752432296,
0.6068401503 0.5831600070 I
If we omit the variable, Maple assumes that it is x and solves the equation.

20

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> fsolve(x^3-7*x^2+2*x+3=0);
-0.5126801315, 0.8825814030, 6.630098729
For equations that are not polynomials we expect a single solution as output from the
fsolve command, as below.
> fsolve(sin(x)=x-2);
2.554195953
> fsolve(sin(x)=x-2,x);
2.554195953
If we plot the curves we see that there is only one real solution to the equation and hence
no need to look for any more.
> with(plots):
Warning, the name changecoords has been redefined

> implicitplot({y=sin(x),y=x-2},x=-10..10,y=-10..10,
grid=[50,50]);

On the other hand, say we wanted to solve the equation sin ( x ) = 0 . This clearly has an
infinite number of solutions and although we know what they are lets see how the fsolve
command deals with an equation like this. Note that the simple application of the fsolve
command returns 0 as a solution.
> fsolve(sin(x)=0,x);
0.
If we were interested in finding a solution between 3 and 5 we would execute,
> fsolve(sin(x)=0,x=3..5);
3.141592654

21

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

Even if there is more than one solution in a given interval the fsolve command will return
only one. For example,
> fsolve(sin(x)=0,x=20..30);
25.13274123
> fsolve(sin(x)=0,x=27..30);
28.27433388
Lets look at a system of nonlinear equations. The following two commands are
identical, at least to Maple, and they have the same output.
> fsolve({4*x^2+sin(y)=2,y/2+cos(x)=1});
{ x = 0.6361393915, y = 0.3912093747 }
> fsolve({4*x^2+sin(y)=2,y/2+cos(x)=1},{x,y});
{ x = 0.6361393915, y = 0.3912093747 }
Note that we get an error if we try to solve for only one of the variables. The fsolve
command must find a numeric solution to all of the variables in the equations.
> fsolve({4*x^2+sin(y)=2,y/2+cos(x)=1},x);
Error, (in fsolve) y is in the equation, and is not solved for

If we graph the system of equations we see that there is another possible solution.
> implicitplot({4*x^2+sin(y)=2,y/2+cos(x)=1},x=-5..5,y=5..5,grid=[50,50]);

We can use the fsolve command to approximate this solution by restricting both x and y
to a rectangle that contains the other solution. For example,
> fsolve({4*x^2+sin(y)=2,y/2+cos(x)=1},{x=-5..0,y=-2..2});
{ x = -0.6361393915, y = 0.3912093747 }

22

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

There is one more thing to aware of when using the fsolve command. As you know from
linear algebra, if you have n variables and you want to find numeric solutions for all of
them then you will need at least n equations. The same is true for nonlinear equations.
Maple knows this and hence it does not even try to fsolve a system if there are fewer
equations than there are variables.
> fsolve({4*x^2*z+sin(y)=2,y+z/2+cos(x)=1});
Error, (in fsolve) number of equations, 2, does not match number of
variables, 3

23

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

Functions
Defining a Function of a Single Variable
To define a function of a single variable, start the command with the function name
followed by := followed by the independent variable followed by the arrow ->
followed by the mathematical expression for the function. For example, to define the
function f ( x ) = 2 x 2 + 3 x 5 we use the command,
> f:=x->2*x^2+3*x-5;
f := x 2 x2 + 3 x 5
Now you can use standard mathematical function notation to evaluate the function. For
example,
> f(0);
-5
> f(2);
9
> (f(x+h)-f(x))/h;
2 ( x + h ) 2 + 3 h 2 x2
h

Using the map Command


The map command is a quick way to evaluate a function at a number of values. Before
using the map command you should define the function you wish to use and a list of
values you want to use it on. Make sure that you use a list here and not a set.
> f:=x->x^2;
f := x x 2
> lst:=[-2,-1,0,2,5,10,104.8];
lst := [ -2, -1, 0, 2, 5, 10, 104.8 ]
Now type in the map command using the function name and the list name. Note that you
are to use only the function name.
> map(f,lst);
[ 4, 1, 0, 4, 25, 100, 10983.04 ]

24

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

In the same manner we can map an already existing function.


> map(sin,lst);
[ sin ( 2 ), sin ( 1 ), 0, sin ( 2 ), sin ( 5 ), sin ( 10 ), -0.9033180209 ]
> evalf(map(sin,lst));
[ -0.9092974268, -0.8414709848, 0., 0.9092974268, -0.9589242747, -0.5440211109,
-0.9033180209]
Note what happens when we include the (x) in the expression.
> map(f(x),lst);
[ x( -2 )2, x( -1 )2, x( 0 )2, x( 2 )2, x( 5 )2, x( 10 )2, x( 104.8 )2 ]

Defining Piecewise Functions


Piecewise defined functions can be created with the piecewise command. In the
piecewise command you input the piecewise function in pairs. The first component is the
range in which to apply the piece and the second component is the function to apply to
that piece. You may put in as many pairs as you would like and the last entry need not be
a pair but the function to use otherwise. If there is no default (otherwise) function Maple
will assume that it is 0. Note that the output of the piecewise command is in a prettyprint mode unless you use it in a function definition. We would suggest that you try the
command without a function definition to check your syntax before placing the command
in a function definition. For example,
> piecewise( x=0, 1, sin(x)/x );
x=0
1
sin ( x )
otherwise
x

> piecewise( x=0, 1);


{

1
0

x=0
otherwise

1
-1

0<x
otherwise

> piecewise( x>0, 1,-1);

> piecewise( x<0, 1, x<1, 2, x<2, 3, 4);


x<0
1
2
x<1
3
x<2

otherwise
4
25

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> plot(piecewise( x<0, 1, x<1, 2, x<2, 3, 4),x=2..5,y=0..5,discont=true);

> piecewise( x<0, 1, x<1, x, x<2, 3-x, sin(x)+2);


1
x<0

x
x<1
3 x
x<2

otherwise
sin ( x ) + 2
> f:=x->piecewise( x<0, 1, x<1, x, x<2,3-x,sin(x)+2);
f := x piecewise( x < 0, 1, x < 1, x, x < 2, 3 x, sin ( x ) + 2 )
> plot(f(x),x=-2..5,y=0..3,discont=true);

> piecewise( x>=-2 and x<=-1, 1, x<1, x, x<2, 3-x,


sin(x)+2);
1
2 x 0 and x + 1 0

x
x<1
3 x
x<2

otherwise
sin ( x ) + 2
> g:=x->piecewise(x>=-2 and x<=-1, 1, x<1, x, x<2, 3-x,
sin(x)+2);
g := x piecewise( -2 x and x -1, 1, x < 1, x, x < 2, 3 x, sin ( x ) + 2 )
> plot(g(x),x=-5..5,y=-3..3,discont=true);

26

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

Notice the vertical lines at 2 and 1 despite the fact that we used discont=true. This was
due to the use of and in the defining of one of the ranges. If we rearrange the piecewise
command a little we do get a better image of the function.
> g:=x->piecewise(x<-2, x, x<=-1, 1, x<1, x, x<2, 3-x,
sin(x)+2);
g := x piecewise( x < -2, x, x -1, 1, x < 1, x, x < 2, 3 x, sin ( x ) + 2 )
> plot(g(x),x=-5..5,y=-3..3,discont=true);

Defining a Function of Several Variables


To define a function of several variables, start the command with the function name
followed by := followed by an order pair triple or n-tuple in parentheses that represent
your independent variables followed by the arrow -> followed by the mathematical
expression for the function. For example, to define the function
f ( x, y ) = 2 x 2 y + 3xy 3 5 x + 2 y 1 we use the command,
> f:=(x,y)->2*x^2*y+3*x*y^3-5*x+2*y-1;
f := ( x, y ) 2 x2 y + 3 x y3 5 x + 2 y 1

27

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

Now you can use standard mathematical function notation to evaluate the function. For
example,
> f(0,0);
-1
> f(2,7);
2117
Similarly, to define the function g ( x, y, z , w) = sin ( x ) + y ln ( z ) + w 2 we use,
> g:=(x,y,z,w)->sin(x)+y-ln(z)+w^2;
g := ( x, y, z, w ) sin ( x ) + y ln ( z ) + w2
> g(1,2,3,4);

sin ( 1 ) + 18 ln ( 3 )

28

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

Limits, Differentiation, Integration &


Sums
Evaluating Limits of Function of a Single Variable
There are two main commands for limits, limit and Limit. As with most Maple
commands that have both a capitalized and lowercase version the capitalized version will
display the operation in a pretty-print manner and the lowercase version will perform the
operations. If you do use the capitalized form of the command you can then evaluate the
expression using the value command. The general syntax for the limit function is
limit(expr, pos, dir);
where expr represents the expression or function we are taking the limit of, pos represents
the limit point, and dir is an optional argument for the direction of the limit, that is, either
left or right. For example,
> limit(x^2-1,x=2);
3
> Limit(x^2-1,x=2);
lim x 2 1

x 2

> value(%);
3
> limit((x^2-1)/(x-1),x=1);
2
> limit(abs(x)/x,x=0);
undefined
> limit(abs(x)/x,x=0,left);
-1
> limit(abs(x)/x,x=0,right);
1
We can also take limits at infinity by placing infinity or infinity for the position.
> limit(arctan(t),t=infinity);

29

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> limit(arctan(t),t=-infinity);

Evaluating Limits of Multivariable Functions


Limits of functions of two or more variables are substantially different from the limits of
functions of a single variable primarily because you are no longer coming into the limit
point from just two directions but are coming into the limit point from an infinite number
of directions. Due to this fact, Maple has a difficult time finding the limits of functions
of more than one variable. We can use Maple to get an idea if the limit actually exists or
if it does not. If we feel that the limit does not exist we may be able to use Maple to find
two different paths into the limit point that do not agree and hence prove that the limit
does not exist. In our first example we will work with a relatively nice function. To find
the limit of a function of two variables we simply replace the position by a list of
positions.
> f:=(x,y)->x^2-y^2;
f := ( x, y ) x2 y 2
> limit(f(x,y),{x=2,y=3});
-5
> limit(f(x,y),{x=5,y=-2});
21
The same holds true for functions of three or more variables.
> g:=(x,y,z,w)->x^2-y^2/z+2*w;
g := ( x, y, z, w ) x2

y2
+2w
z

> limit(g(x,y,z,w),{x=5,y=-2,z=3,w=sqrt(2)});
71
+2 2
3
Now for functions that are not as nice Maple could have a problem with these. In some
cases Maple will notice that the limit is path dependent and hence does not exist.
> f:=(x,y)->abs(x^2-y^2)/(x^2-y^2);
x2 y2
f := ( x, y ) 2 2
x y
> limit(f(x,y),{x=0,y=0});

30

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

undefined
> plot3d(f(x,y),x=-2..2,y=-2..2,axes=boxed);

In other cases Maple may not recognize the path dependence and simply return the
question.
> f:=(x,y)->(x+y)^2/(x^2+y^2);
f := ( x, y )

( x + y )2
y2 + x2

> limit(f(x,y),{x=0,y=0});
( x + y )2

limit 2 2 , { y = 0, x = 0 }
y + x

> plot3d(f(x,y),x=-2..2,y=-2..2,axes=boxed);

31

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

Derivatives of Functions of a Single Variable


There are four derivative commands: D, Diff, diff and implicitdiff. The implicitdiff
command is for finding derivatives of implicitly defined expressions, that is, for doing
implicit differentiation. The other three are for derivatives of explicitly defined functions
but there are major differences between the D command and the two diff commands. We
will start with Diff and diff since these are the ones that will be used most often. Diff and
diff are another pair of commands that will either produce a pretty-print version, Diff, or
evaluate the derivative, diff. The syntax for either of these commands is
diff(expr,var);
where expr is the function or expression to be derived and var is the variable that we are
differentiating with respect to. For example,
> f:=x->x^2-3*x+2;
f := x x 2 3 x + 2
> diff(f(x),x);

2x3

> Diff(f(x),x);
d 2
(x 3 x + 2)
dx

> value(%);

2x3

We can take higher order derivatives simply by adding more variables to the list of
arguments. For example,
> diff(f(x),x,x);
2
> diff(f(x),x,x,x);
0
> Diff(f(x),x,x);
d2 2
(x 3 x + 2)
d x2
> Diff(f(x),x,x,x);
d3 2
(x 3 x + 2)
d x3
> value(%);

32

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

0
We can also use the $ repeater to do higher order derivatives. The $ will repeat an
expression a given number of times. For example,
> x$2;
x, x
> x+7$2;

x + 7, x + 7

> george$7;
george, george, george, george, george, george, george
Using this in conjunction with the diff command allows us to short-cut some of the
notation for higher order derivatives. For example,
> diff(f(x),x$2);
2
> diff(sin(x),x$1023);

cos( x )

One minor difficulty with the Diff and diff commands is that they return the derivative as
an expression and not as a function. Frequently we wish to have the derivative of a
function defined as a function. If we use the Diff or diff command we must use the
unapply command to turn the expression into a function. The syntax of the unapply
command is
unapply(expr,var)
where expr is the expression to be converted to a function and var is the independent
variable. For example,
> f:=x->x^2-3*x+2;
f := x x 2 3 x + 2
> diff(f(x),x);
> df:=unapply(%,x);
> df(x);

2x3
df := x 2 x 3
2x3

> df(2);

33

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

1
The D command will also find the derivative of a function but its inputs and outputs are
quite different than those of Diff and diff. The D command takes as input a function
name only, just like the map command. It also outputs a function definition and not an
expression. For example,
> f:=x->x^2-3*x+2;
f := x x 2 3 x + 2
> D(f);

x2x3

Notice that the output suggests that what D is returning is a function that maps x to
2 x 3 . To create a function that represents the derivative of f we simply need to assign a
name to the output of the D command, the unapply command is not necessary. For
example,
> df:=D(f);

df := x 2 x 3

> df(2);
1
In fact we can also use the D command output as a function itself simply by appending an
(x) or evaluate it at a particular value.
> D(f)(x);

2x3

> D(f)(2);
1
Higher order derivatives can be accomplished with the D command if we append the
@@n operator, where n denotes the order of differentiation. For example the second and
third derivatives of f can be found using,
> (D@@2)(f);
2
> (D@@3)(f);
0
respectively. The implicitdiff command will find derivatives of implicitly defined
relations. The syntax of the implicitdiff command is as follows,

34

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

implicitdiff(expr,var1,var2)
where expr is the implicitly defined expression, var1 and var2 represent the derivative
d var 1
dy
. For example, to find
we use the command,
d var 2
dx
> implicitdiff(x^2-y^2+x*y=sin(x*y),y,x);
2 x + y cos( x y ) y
2 y x + cos( x y ) x

and to find

dx
we use the command,
dy

> implicitdiff(x^2-y^2+x*y=sin(x*y),x,y);
2 y x + cos( x y ) x

2 x y + cos( x y ) y
Similarly, we can give the implicit expression a name and use it in the implicitdiff
command. Note that the following definition is an assignment of an expression to t and
not a function definition.
> t:=x*y-2*y=x^3;
t := x y 2 y = x3
> implicitdiff(t,y,x);
y + 3 x2
x2

Partial Derivatives of Multivariable Functions


To find partial derivatives in Maple is almost the same as finding derivatives. The Diff,
diff and implicitdiff commands have exactly the same syntax and the D command needs
just a little more information. We will start with the Diff and diff commands. In the
following examples we define a function of two variables and find its first partials in a
number of different ways.
> f:=(x,y)->(y-x)*sin(x+y);
f := ( x, y ) ( y x ) sin ( x + y )
> diff(f(x,y),x);

sin ( x + y ) + ( y x ) cos( x + y )

> diff(f(x,y),y);

35

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

sin ( x + y ) + ( y x ) cos( x + y )
> Diff(f(x,y),x);

> value(%);
> Diff(f(x,y),y);

> value(%);

( ( y x ) sin( x + y ) )
x

sin ( x + y ) + ( y x ) cos( x + y )

( ( y x ) sin( x + y ) )
y

sin ( x + y ) + ( y x ) cos( x + y )

Notice in the Diff command the notation has changed from the derivative to the partial
derivative. Maple automatically recognizes that the function is multivariate and hence
the derivatives will be partial derivatives. For higher order derivatives the order of partial
derivatives is read from left to right. For example,
> Diff(f(x,y),x,y);
2
( ( y x ) sin ( x + y ) )
y x
> value(%);

( y x ) sin ( x + y )

> Diff(f(x,y),y,x);
2
( ( y x ) sin ( x + y ) )
x y
> value(%);
> diff(f(x,y),y,x);

( y x ) sin ( x + y )
( y x ) sin ( x + y )

As with higher order derivatives of functions of a single variable we can use the $
notation to condense the command.
> diff(f(x,y),x$2,y$3,x$4);
3 sin ( x + y ) + ( y x ) cos( x + y )
> Diff(f(x,y),x$2,y$3,x$4);
9
( ( y x ) sin ( x + y ) )
x4 y3 x2

36

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> diff(f(x,y),y$3,x$6);
3 sin ( x + y ) + ( y x ) cos( x + y )
The D command is a bit different for multivariate functions. As with single variable
functions it expects a function name only but if you look closely at the D command we
used for single variable functions there was no place where we told Maple what to take
the derivative with respect to. For single variable functions Maple noticed that there was
only one variable and assumed that that variable was the one you wanted. For
multivariate functions Maple can no longer make that assumption. To tell Maple which
variable to differentiate with respect to we place [i] between the D and the (f). The i
in the brackets is a number that represents the variable that is being differentiated with
respect to. The number corresponds to the position of the variable in the original
definition of the function. For example, to take the partial derivative of the function
> f:=(x,y)->(y-x)*sin(x+y);
f := ( x, y ) ( y x ) sin ( x + y )
with respect to x we use,
> D[1](f);

( x, y ) sin ( x + y ) + ( y x ) cos( x + y )

since x was the first variable in the list of independent variables when the function f was
defined. Likewise to take the partial derivative of f with respect to y we use,
> D[2](f);

( x, y ) sin ( x + y ) + ( y x ) cos( x + y )

since y was the second variable in the list of independent variables when the function f
was defined. Note that if we reverse the order of the variables in the definition, 1 will
correspond to y and 2 will correspond to x.
> f:=(y,x)->(y-x)*sin(x+y);
f := ( y, x ) ( y x ) sin ( y + x )
> D[1](f);
> D[2](f);

( y, x ) sin ( y + x ) + ( y x ) cos( y + x )
( y, x ) sin ( y + x ) + ( y x ) cos( y + x )

To do higher order derivatives we can replace [i] with a list of numbers. For example,
the second partial of f with respect to x would be found by

37

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> f:=(x,y)->(y-x)*sin(x+y);
f := ( x, y ) ( y x ) sin ( x + y )
> D[1,1](f);

( x, y ) 2 cos( x + y ) ( y x ) sin ( x + y )

The second partial with respect to y can be found by,


> D[2,2](f);

( x, y ) 2 cos( x + y ) ( y x ) sin ( x + y )

The mixed partials by either of the following,


> D[1,2](f);

( x, y ) ( y x ) sin ( x + y )

> D[2,1](f);

( x, y ) ( y x ) sin ( x + y )

One thing to note is that the order of differentiation is read from right to left when using
the D command. That is, in our example,
> D[1,2](f);

( x, y ) ( y x ) sin ( x + y )

Maple took the partial with respect to y first and then it took the partial derivative of that
with respect to x. As with the Diff and diff commands we can use the $ option to shortcut the notation, For example,
> D[1$2](f);

( x, y ) 2 cos( x + y ) ( y x ) sin ( x + y )

> D[1$4,2$3,1$7](f);
( x, y ) 8 cos( x + y ) ( y x ) sin ( x + y )
The implicitdiff command for implicit differentiation is exactly the same for expressions
with more than two variables. For example,
> t:=x*y-2*z^2*y=x^3;
t := x y 2 z 2 y = x3
> implicitdiff(t,y,x);
y + 3 x2
x 2 z2

38

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> implicitdiff(t,y,z);
4zy
x 2 z2
> implicitdiff(t,z,y);
x 2 z2
4zy

Integration of Single Variable Functions


Finding definite and indefinite integrals with Maple is a snap. Although there are several
special types of integral commands in Maple you can almost always get by with just two,
Int and int. As with all capitalized and lowercase pairs of commands the capitalized one
returns a pretty-print version and the lowercase one does the operation. Also, as with the
other capitalized commands in Maple, the value command will force Maple to do the
operation. To find an indefinite integral we use the syntax,
int(expr,var)
where the expr is the expression or function to be integrated and the var is the variable we
are integrating with respect to. For example,
> f:=x->x^2-3*x+2;
f := x x 2 3 x + 2
> int(f(x),x);
1 3 3 2
x x +2x
3
2

> Int(f(x),x);

x2 3 x + 2 dx

> value(%);
1 3 3 2
x x +2x
3
2

Definite integrals can be found just as easily, we simply replace the var in the above
syntax with a variable range. The range is, of course, the interval you are integrating
over. For example,
> f(x);
x2 3 x + 2
> int(f(x),x=1..3);

39

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

2
3

> Int(f(x),x=1..3);
3

x2 3 x + 2 dx

> value(%);
2
3

Maple also has some special commands for doing numeric approximations to integrals. It
has commands for Riemann sums, the trapezoidal rule and Simpsons rule. All of these
commands are in Maples student package. For an explanation of these commands please
see the section in this guide on the student package.

Integration of Multivariable Functions


Maples student package has some special functions for finding double and triple
integrals but there is not much more typing involved by simply doing multiple ints or
Ints. For example,
> f:=(x,y)->(y-x)*sin(x+y);
f := ( x, y ) ( y x ) sin ( x + y )
> Int(Int(f(x,y),x),y);

( y x ) sin ( x + y ) dx dy

> value(%);

sin ( x + y ) ( x + y ) + 2 x sin ( x + y )

> int(int(f(x,y),x),y);
sin ( x + y ) ( x + y ) + 2 x sin ( x + y )
> Int(Int(f(x,y),y),x);

( y x ) sin ( x + y ) dy dx

> value(%);

sin ( x + y ) ( x + y ) 2 sin ( x + y ) y

> int(int(f(x,y),y),x);
sin ( x + y ) ( x + y ) 2 sin ( x + y ) y

40

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

Definite integrals can also be found using the same syntax, just replace the variables with
variable ranges. For example,
> Int(Int(f(x,y),x=-2..3),y=0..1);
1

( y x ) sin ( x + y ) dx dy

0
-2
> value(%);

2 sin ( 4 ) 3 sin ( 1 ) 3 sin ( 3 ) + 2 sin ( 2 )

> int(int(f(x,y),x=-2..3),y=0..1);
2 sin ( 4 ) 3 sin ( 1 ) 3 sin ( 3 ) + 2 sin ( 2 )
Maple can also handle ranges that are dependent on other variables.
> Int(Int(f(x,y),x=-2..3*y-2),y=0..1);
1

3y 2

0
-2

( y x ) sin ( x + y ) dx dy

> value(%);
3 sin( 1 ) +

3
sin( 2 )
2

> int(int(f(x,y),x=-2..3*y-2),y=0..1);
3
3 sin( 1 ) + sin( 2 )
2
For triple integrals we simply add on another int.
> f:=(x,y,z)->x*sin(z)+cos(y);
f := ( x, y, z ) x sin ( z ) + cos( y )
> Int(Int(Int(f(x,y,z),z=-2..3),y=0..1),x=0..5);
5

x sin ( z ) + cos( y ) d z dy dx

0
0
-2
> value(%);

25
25
cos( 3 ) +
cos( 2 ) + 25 sin( 1 )
2
2

> int(int(int(f(x,y,z),z=-2..3),y=0..1),x=0..5);
25
25
cos( 3 ) +
cos( 2 ) + 25 sin( 1 )
2
2
> Int(Int(Int(f(x,y,z),z=2*x+3*y-4..3*x-y+7),y=x+1..3*x+2),x=0..5);

41

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

3x+ 2

3xy+7

x sin ( z ) + cos( y ) d z dy dx

0
1 x
2 x + 3 y 4
> value(%);
25
52
23
5
1
1
sin ( 5 ) + cos( 17 ) sin ( 17 ) cos( 57 ) +
sin ( 57 ) sin ( 26 )
2
3
9
33
363
16
5
19
5
2780
+ cos( 26 ) + 9 sin ( 4 ) 32 cos( 4 ) + sin ( 6 ) cos( 6 ) + cos( 2 ) +
sin ( 2 )
4
48
3
1089
26
+
sin( 1 ) + 7 cos( 1 )
3
> evalf(%);
11.70116137
> int(int(int(f(x,y,z),z=2*x+3*y-4..3*x-y+7),y=x+1..3*x+2),x=0..5);
25
52
23
5
1
1
sin ( 5 ) + cos( 17 ) sin ( 17 ) cos( 57 ) +
sin ( 57 ) sin ( 26 )
2
3
9
33
363
16
5
19
5
2780
+ cos( 26 ) + 9 sin ( 4 ) 32 cos( 4 ) + sin ( 6 ) cos( 6 ) + cos( 2 ) +
sin ( 2 )
4
48
3
1089
26
+
sin( 1 ) + 7 cos( 1 )
3
If you really want short-cut syntax for the double and triple integrals you can always
create a new command yourself. For example, we create four commands below that find
double and triple integrals, both have pretty-print versions and evaluation versions.
> dint:=(f,xrng,yrng)->int(int(f,xrng),yrng);
f d xrng dyrng
dint := ( f, xrng, yrng )

> Dint:=(f,xrng,yrng)->Int(Int(f,xrng),yrng);
f d xrng dyrng
Dint := ( f, xrng, yrng )

> tint:=(f,xrng,yrng,zrng)->int(int(int(f,xrng),yrng),zrng);

f dxrng d yrng d zrng


tint := ( f, xrng, yrng, zrng )

> Tint:=(f,xrng,yrng,zrng)->Int(Int(Int(f,xrng),yrng),zrng);

f dxrng d yrng d zrng


Tint := ( f, xrng, yrng, zrng )

Examples of these commands are below.


> f:=(x,y)->(y-x)*sin(x+y);
f := ( x, y ) ( y x ) sin ( x + y )
42

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> Dint(f(x,y),x=-2..4,y=-3..8);
8

( y x ) sin ( x + y ) dx dy

-3
-2
> value(%);

4 sin ( 12 ) + 10 sin ( 6 ) 7 sin ( 1 ) sin ( 5 )

> dint(f(x,y),x=-2..4,y=-3..8);
4 sin ( 12 ) + 10 sin ( 6 ) 7 sin ( 1 ) sin ( 5 )
> f:=(x,y,z)->x*sin(z)+cos(y);
f := ( x, y, z ) x sin ( z ) + cos( y )
> Tint(f(x,y,z),z=2*x+3*y-4..3*x-y+7,y=-x+1..3*x+2,x=0..5);
5

3x+ 2

3xy+7

x sin ( z ) + cos( y ) d z dy dx

0
1 x
2 x + 3 y 4
> value(%);
25
52
23
5
1
1
sin ( 5 ) + cos( 17 ) sin ( 17 ) cos( 57 ) +
sin ( 57 ) sin ( 26 )
2
3
9
33
363
16
5
19
5
2780
+ cos( 26 ) + 9 sin ( 4 ) 32 cos( 4 ) + sin ( 6 ) cos( 6 ) + cos( 2 ) +
sin ( 2 )
4
48
3
1089
26
+
sin( 1 ) + 7 cos( 1 )
3
> tint(f(x,y,z),z=2*x+3*y-4..3*x-y+7,y=-x+1..3*x+2,x=0..5);
25
52
23
5
1
1
sin ( 5 ) + cos( 17 ) sin ( 17 ) cos( 57 ) +
sin ( 57 ) sin ( 26 )
2
3
9
33
363
16
5
19
5
2780
+ cos( 26 ) + 9 sin ( 4 ) 32 cos( 4 ) + sin ( 6 ) cos( 6 ) + cos( 2 ) +
sin ( 2 )
4
48
3
1089
26
+
sin( 1 ) + 7 cos( 1 )
3

Finite and Infinite Sums


Maple can find finite and infinite sums using the two commands, sum and Sum. As with
all of the capitalized lowercase command pairs, the command Sum will set up the sum
and display it in a pretty-print manner. You can get the value of the result by applying
the value command. The lowercase sum command will evaluate the sum without the
need to apply the value command. The syntax of the sum command is
sum(expr,rng);
where expr represents the ith term and rng is the range of the sum. Note that rng can be
finite or infinite. For example,

43

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> Sum(i,i=1..5);
5

i=1

> value(%);
15
> Sum(i^3,i=1..50);
50

i3

i=1

> value(%);
1625625
> sum(i^3,i=1..50);
1625625
> sum(1/i,i=1..50);
13943237577224054960759
3099044504245996706400

> evalf(%);
4.499205338
> sum(1/i,i=1..500);
663338429989119806546143302387421466015138348898782940686870090780227\
937698636415400569017248053724834931036587121859174364111676672813\
949472763785044905480298961334427450045382592284705223585961537823\
8909694581687099

9765282975860379545848516602538973177301511766\

838567872846558671279507656107161785910367975985510264702441680886\
454516761775201775149778279241658755154640446941522074794053108833\
85229609852607806002629415184926954240
> evalf(%);
6.792823430
> sum(1/i-1/(i+1),i=1..1000000);
1000000
1000001
> evalf(%);
0.9999990000
For infinite sums simply set the ending bound to infinity. For example,
> sum(1/i-1/(i+1),i=1..infinity);
44

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

1
> sum(1/i^2,i=1..infinity);
2
6
> sum(1/i^3,i=1..infinity);

( 3 )

> sum(1/i^4,i=1..infinity);
4
90
Finite and infinite sums need not be entirely numeric. For example,
> Sum(1/i!*x^i,i=0..infinity);

i=0

xi
i!

> sum(1/i!*x^i,i=0..infinity);
ex
> sum(1/i*x^i,i=1..infinity);
ln ( 1 x )
Note that in the last couple expressions Maple noticed the form of the sum and simplified
the sum into a function. Similarly, we can define a function to be an infinite (or finite)
sum.
> f:=x->sum(1/i*x^i,i=1..infinity);

xi
f := x
i
i=1
> f(-3);
undefined
> f(-1);

ln ( 2 )

> f(1/2);
ln ( 2 )

45

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

The taylor Command


On the flip-side of the sum command, which can convert a sum to a function, there is the
taylor command that can take a function and return the first n terms of its Taylor series.
The general syntax of the taylor command is
taylor(expr,val,n)
where expr is the expression or function to be taylorized, val should be of the form x=a
where a is the point of expansion and n is the degree of the Taylor polynomial to be
returned. For example,
> taylor(exp(x),x=0,5);
1+x+

1 2 1 3 1 4
x + x +
x + O( x 5 )
2
6
24

> taylor(sin(x),x=0,20);
1
1 5
1 7
1
1
1
x x3 +
x
x +
x9
x11 +
x13
6
120
5040
362880
39916800
6227020800
1
1
1
x15 +
x17
x 19 + O( x 20 )
1307674368000
355687428096000
121645100408832000
Note that in the expansion Maple attaches a O(n) last term that represents the tail of the
series. We can remove it by using the convert command. For example,
> taylor(sin(x),x=0,5);
x

1 3
x + O( x 5 )
6

> convert(taylor(sin(x),x=0,5),polynom);
1
x x3
6
With the convert command we can create a new command, called ntaylor, that will return
the nth degree Taylor polynomial of a function.
> ntaylor:=(f,val,n)->convert(taylor(f,val,n),polynom);
ntaylor := ( f, val, n ) convert( taylor( f, val, n ), polynom )
> ntaylor(sin(x),x=0,6);
x

1 3
1 5
x +
x
6
120

46

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

This command comes in handy when exhibiting the convergence of the Taylor
polynomial to the function, as we show below.
> plot([sin(x),seq(ntaylor(sin(x),x=0,n),n=1..20)],x=10..10,y=-5..5,numpoints=500);

47

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

Graphing
Maple has many advantages for teaching Calculus but one of its strongest is the plethora
of graphing commands and ease of creating animations. Although we will not discuss the
creation of animations here we will cover many of the graphing commands that are
applicable to Calculus I, II and III. After you create a Maple graph you can click on the
image to bring up the image toolbar. This toolbar will allow you to change several of the
image options simply by clicking a button. Another option you have is to right-click on
the image. This will bring up a pop-up menu of options as well as facilities to save the
image in a number of different file formats. As always, you can copy and paste Maple
graphs into any application that supports drag and drop graphics.

Two Dimensional Plots


The plot Command: Plotting Functions
The plot command is for plotting functions or parametrically defined equations. You can
use a large number of options to alter the image to suit your needs as well as use a
number of different coordinate systems. The syntax for the plot command is very simple,
plot(expr,rng,options)
where expr is the expression or function to plot, rng is the range of the independent
variable and options represents a list of options. The expr and rng arguments are
necessary but you do not need to have any. On the other hand, you may have as many
options as you would like. We will not discuss all of the plot options here but we will hit
some of the ones you will use most often. For further option listings please see the Maple
documentation or help system. Lets look at a few examples.
> f:=x->sin(x);
f := sin
> plot(f(x),x=-2*Pi..2*Pi);

48

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

To graph more than one function on the same graph we simply place the set of functions
either in a list or a set. For example,
> plot([f(x),g(x),h(x)],x=-2*Pi..2*Pi);

> plot({f(x),g(x),h(x)},x=-2*Pi..2*Pi);

As with all sets and lists, the list retains its order and a set might not. Hence, if you use a
set here the colors of the different graphs may differ from the same command that uses a
list. When Maple graphs a function it does it so that the graph fits the box. This, in many
cases, will distort the image of the graph. To get a true picture of the function you can
include the scaling=constrained option. This will graph the function in a 1-1 manner.
You can get the same result by clicking the 1-1 button in the toolbar.
> plot(f(x),x=-2*Pi..2*Pi,scaling=constrained);

49

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

Another way to alter the vertical scale is by inputting a vertical scale. For example,
consider the difference between the following two graphs,
> plot(1/(x-1),x=0..2);

> plot(1/(x-1),x=0..2,y=-10..10);

This last image brings up another option that is frequently used with rational functions.
Note that in the above image the vertical asymptote is shown, to eliminate it we can add
the discont=true option.
> plot(1/(x-1),x=0..2,y=-10..10,discont=true);

The color option sets the color of the function. Possible values or the color option are:
aquamarine, black, blue, navy, coral, cyan, brown, gold, green, gray, grey, khaki,

50

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

magenta, maroon, orange, pink, plum, red, sienna, tan, turquoise, violet, wheat, white,
and yellow. For example,
> plot(f(x),x=-2*Pi..2*Pi,color=black);

When plotting more than one function you can use a list for the color option to control
each color independently.
> plot([f(x),g(x),h(x)],x=-2*Pi..2*Pi,
color=[red,black,blue]);

Another way to alter the lines appearance is with the linestyle option. The values for the
linestyle option are SOLID, DOT, DASH, and DASHDOT. Note that as of Maple 8
these options must be typed in uppercase
> plot(f(x),x=-2*Pi..2*Pi,color=black,linestyle=DASHDOT);

51

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

We can control the thickness of a line as well. Thicknesses can range from 1 to 15, a
thickness of 16 results in a thickness of 1, 17 to 2 and so on. For example,
> plot(f(x),x=-2*Pi..2*Pi,color=black,thickness=5);

In Calculus II you use the definite integral to, among other things, find the area between a
curve and the x-axis. To display this area you can add the filled=true option. For
example,
> plot(f(x),x=-2*Pi..2*Pi,filled=true);

In some cases the number of points Maple uses to graph a function is insufficient. To
compensate you can manually set the number of points used in a graph with the
numpoints option. For example,

52

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> plot(sin(1/x),x=0..1);

> plot(sin(1/x),x=0..1,numpoints=10000);

Remember that the larger the number of points the longer it will take Maple to graph the
function. Another option that is used from time to time is the view option. The view
option will display only the portion of the graph you designate, no matter what domain
you gave the plot command. For example,
> plot(sin(x),x=-2*Pi..2*Pi,view=[0..5,0..1]);

The last option we will discuss for the plot command is the coords option. This option
allows you to change the coordinate system you are working with. The available values
for this option are: bipolar, cardioid, cassinian, elliptic, hyperbolic, invcassinian,
invelliptic, logarithmic, logcosh, maxwell, parabolic, polar, rose, and tangent. Most

53

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

likely, the only one you will use in a Calculus sequence is polar. When you include
coords=polar as an option the resulting graph will be graphed using the polar coordinate
system and not the rectangular system. For example,
> plot(sin(t),t=0..2*Pi,coords=polar);

The plot Command: Plotting Parametrically Defined


Equations
To plot a parametrically defined equation we place the x equation, y equation and the
parameter range inside square brackets. Note that the range is inside the brackets. For
example, to plot the equations
x = sin (t )

y = cos(t )
for 0 t 2 , we use,
> plot([sin(t),cos(t),t=0..2*Pi]);

We can use any of the plot options as well as specify and x and y range for graphing. For
example,

54

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> plot([sin(t),cos(t),t=0..2*Pi],x=-2..2,y=-2..2,
color=green,filled=true);

The implicitplot Command


The implicitplot command is for graphing implicitly defined relations. The syntax for the
implicit plot command is similar to the plot command except that it requires ranges for
both x and y. The implicitplot command is not loaded automatically by Maple, it resides
in the plots package and hence needs to be loaded with the with command. For example,
> with(plots):
Warning, the name changecoords has been redefined

Dont worry about the warning.


> implicitplot(x^2-y^2=3,x=-5..5,y=-5..5);

Most of the plot option also work with the implicitplot command, please see the plot
command information in this guide or the Maple documentation for a more detailed
explanation of the available options.
> implicitplot(x^2-y^2=3,x=-5..5,y=-5..5,color=black,
linestyle=DASHDOT);

55

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

One option that is not available is the numpoints option. When graphing an implicitly
defined relation, Maple uses a grid of points and not a list of points. So if you want to
increase the number of points used to graph the curve you need to add the grid option to
the implicitplot command. For example, look at the following image.
> implicitplot(x^2-y^2=0,x=-2..2,y=-2..2);

Notice that there is a square in the center. This square is an error produced by the fact
that the curve has a self-intersection at the origin. We can minimize the size of the
square, and sometimes remove it, by increasing the grid divisions as in the next
command.
> implicitplot(x^2-y^2=0,x=-2..2,y=-2..2,grid=[100,100]);

56

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

As with the numpoints option the larger the grid divisions the longer it will take to
produce an image.

The contourplot Command


The contourplot command is for producing contour plots of a surface. Its syntax is very
similar to that of the implicitplot command, except that in place an implicitly defined
relation we give it a surface. The contourplot command is in the plots package, so you
will have to load the plots package into your worksheet.
> with(plots):
Warning, the name changecoords has been redefined

> f:=(x,y)->sin(x*y);

f := ( x, y ) sin ( y x )

> contourplot(f(x,y),x=-Pi..Pi,y=-Pi..Pi,grid=[50,50]);

In addition to the implicitplot options the contourplot allows you to have some control
over the number and positions of the contours. For example, you can use the
contours=list option to set the contour positions to the values in a list.
> contourplot(f(x,y),x=-Pi..Pi,y=-Pi..Pi,grid=[50,50],
color=black,contours=[-1/2,1/4,1/2,3/4]);

57

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

You can also simply set the number of contours used by contours=n where n is the
number of contours that Maple should plot. Maple will then choose the positions for you.
> contourplot(f(x,y),x=-Pi..Pi,y=-Pi..Pi,grid=[50,50],
color=black,contours=5);

The gradplot Command


The gradplot command is for producing plots of the gradient field of a function of two
variables. There is a corresponding command, gradplot3d, for functions of three
variables. The syntax for the gradplot command is as follows.
gradplot(expr,xrng,yrng)
where expr is the expression or function of two variables, xrng is the range for the x
direction and yrng is the range for the y direction. Of course, you may, in addition, have
any options you wish. The gradplot command is in the plots package, so you will have to
load the plots package into your worksheet.
> with(plots):
Warning, the name changecoords has been redefined

> gradplot(f(x,y),x=-Pi..Pi,y=-Pi..Pi);

58

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

Along with the other plot options the gradplot has an arrows option whose values are
LINE, THIN, SLIM and THICK. The default is THIN, LINE produces a plot without
arrowheads, SLIM and THICK are shown below.
> gradplot(f(x,y),x=-Pi..Pi,y=-Pi..Pi,arrows=SLIM);

> gradplot(f(x,y),x=-Pi..Pi,y=-Pi..Pi,arrows=THICK);

As is commonly done we can graph both the gradplot and contourplot together using the
display command.
> display(gradplot(f(x,y),x=-Pi..Pi,y=-Pi..Pi),
contourplot(f(x,y),x=-Pi..Pi,y=-Pi..Pi,grid=[50,50]));

59

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

Another, more common way, to paste the graphs together is to define a variable name to
each graph and then display the two variables. Note that we use the : to suppress the
output. The output from an assignment statement like the ones below is usually a very
long list of coordinates and basic drawing structures, nothing you want to see.
> a:=gradplot(f(x,y),x=-Pi..Pi,y=-Pi..Pi):
> b:=contourplot(f(x,y),x=-Pi..Pi,y=-Pi..Pi,grid=[50,50]):
> display(a,b);

The fieldplot Command


The fieldplot command is for producing plots of vector fields over R2. There is a
corresponding command, fieldplot3d, for vector fields over R3. The syntax for the
fieldplot command is similar to that of the gradplot command.
fieldplot(expr,xrng,yrng)
where expr is the vector-valued expression or function in R2, xrng is the range for the x
direction and yrng is the range for the y direction. Of course, you may, in addition, have
any options you wish. The fieldplot command is in the plots package, so you will have to
load the plots package into your worksheet.
> with(plots):
Warning, the name changecoords has been redefined

> fieldplot([x,-y],x=-2..2,y=-2..2);

60

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> f := (x,y)-> y: g := (x,y)-> -x:


fieldplot([f,g],-10..10,-10..10,arrows=SLIM);

Infinity Plots
There are no special commands for infinity plots, in fact you simply use the plot
command. Infinity plots are a bit different so we gave them there own small section.
Whenever you place infinity as a bound for one of the ranges in a plot Maple will
automatically create an infinity plot where the endpoints of the axes are infinite. For
example,
> plot(sin(x), x=0..infinity);

> plot([exp(x),ln(x),x^2,sqrt(x),sin(x),(7*x^2-2)/(x^2+5)],
x=-infinity..infinity);

61

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

The logplot and loglogplot Commands


The logplot command produces a semi-log plot of the function or set of functions. The
loglogplot produces a log-log plot of the function or set of functions. The syntax for the
logplot and loglogplot commands is as follows
logplot(expr,xrng)
loglogplot(expr,xrng)
where expr is the function or set of functions and xrng is the range for the x direction. Of
course, you may, in addition, have any options you wish. The logplot and loglogplot
commands are in the plots package, so you will have to load the plots package into your
worksheet.
> with(plots):
Warning, the name changecoords has been redefined

> logplot(exp(x),x=-3..10);

> loglogplot(x^7,x=1..10);

62

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

The arrow command


The arrow command is quite useful when discussing vectors. The arrow command has a
lot of different options for displaying vectors, we will look at just a few here. The arrow
command is in the plots package, so you will have to load the plots package into your
worksheet.
> with(plots):
Warning, the name changecoords has been redefined

In its simplest form, to plot a vector simply input the vector.


> arrow([1,2]);

To alter the appearance of the vector use the shape option with either the arrow or
harpoon value. For example,
> arrow([1,2],shape=arrow);

63

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> arrow([1,2],shape=harpoon);

To plot a vector that begins at one point and ends at another, input both points, as vectors,
and use the difference option, as below.
> arrow([1,2],[3,4],shape=arrow,difference,view=[-2..4,1..5]);

If you input two vectors without using the difference option Maple will graph the second
vector starting at the position of the first vector. For example,
> arrow([1,2],[3,4],shape=arrow,view=[-2..4,-1..7]);

64

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

If you place the two vectors in a single set then the vectors will be graphed together
starting at the origin.
> arrow({[1,2],[3,4]},shape=arrow,view=[-2..4,-1..5]);

Finally, if we input two sets of vectors Maple will graph the second set of vectors starting
at each of the position in the first set of vectors. For example,
> arrow({[0,0],[-3,-4],[1,2],[-1,1]},{[1,2],[3,4]},
shape=arrow);

65

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

The display command


The display command is simply a way to paste several plots together. Its syntax is
simple,
display(expr)
where expr is a sequence of plots separated by commas. Note that the sequence does not
have to be in a list or set. For example,
> a:=plot(x^2,x=-2..2,y=-2..2):
> b:=implicitplot(x^2-y+2=1,x=-2..2,y=-2..2):
> c:=plot(sin(2*t),t=0..2*Pi,coords=polar):
> display(a,b,c);

Three Dimensional Plots


The plot3d Command: Plotting Functions
The plot3d command is for plotting functions or parametrically defined surfaces. You
can use a large number of options to alter the image to suit your needs as well as use a
number of different coordinate systems. The syntax for the plot3d command is very
simple,
plot3d(expr,xrng,yrng,options)
where expr is the expression or function to plot, xrng is the range for the x direction, yrng
id the range for the y direction and options represents a list of options. The expr, xrng
and yrng arguments are necessary but you do not need to have any. On the other hand,
you may have as many options as you would like. We will not discuss all of the plot3d
options here but we will hit some of the ones you will use most often. For further option
listings please see the Maple documentation or help system. Lets look at a few
examples.

66

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> plot3d(x^2-y^2,x=-3..3,y=-3..3);

To plot several surfaces together you simply need to place the expressions in a set.
> plot3d({x^2-y^2,x^2+y^2-3},x=-3..3,y=-3..3);

Many of the following options can be invoked from the image toolbar but we will discuss
them briefly anyway. The axes option controls the style of axes used for the graph, as
you can see the default is none. The values for the axes option are: BOXED, NORMAL,
FRAME, and NONE. For example,
> plot3d({x^2-y^2,x^2+y^2-3},x=-3..3,y=-3..3,axes=boxed);

67

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

The filled option comes in handy when discussing integration. Just like the twodimensional case it fills in the volume between the xy-plane and the surface. For
example,
> plot3d(x^2-y^2,x=-3..3,y=-3..3,axes=boxed,filled=true);

To increase the number of points being used to plot the surface use the grid=[m,n] option.
The values of m and n will determine the number of slices used in the x and y directions
to plot the surface. Remember that the more divisions you use the longer it will take to
graph the surface. Compare the following two graphs.
> plot3d(ln(x/y),x=-5..5,y=-5..5,axes=boxed);

> plot3d(ln(x/y),x=-5..5,y=-5..5,axes=boxed,grid=[50,50]);

68

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

The labels option will label the axes, if shown. The labels must be strings, and one way
to insure that they are strings is to place them in double quotes.
> plot3d(ln(x/y),x=-5..5,y=-5..5,axes=boxed,grid=[50,50],
labels=[x,y,z]);

The projection option can take a value between 0 and 1. The smaller the projection
number the wider the angle of view. The closer the projection is to 1 the more orthogonal
the view becomes. For example,
> plot3d(x^2-y^2,x=-5..5,y=-5..5,axes=boxed,projection=0);

> plot3d(x^2-y^2,x=-5..5,y=-5..5,axes=boxed,projection=0.5);

> plot3d(x^2-y^2,x=-5..5,y=-5..5,axes=boxed,projection=1);

69

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

The style option specifies how the surface is to be drawn. The values are :POINT,
HIDDEN, PATCH, WIREFRAME, CONTOUR, PATCHNOGRID,
PATCHCONTOUR or LINE. The default style is PATCH. For example,
> plot3d(x^2-y^2,x=-5..5,y=-5..5,axes=boxed,style=HIDDEN);

The view option for the plot3d command allows you to set the viewing box to whatever
you desire. Another form of the option will simply scale the z-axis to the input bounds.
For example, if we simply give the view command a range Maple will restrict the z-axis
to be in this range.
> plot3d(x^2-y^2,x=-5..5,y=-5..5,axes=boxed,view=-5..5);

70

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

If, on the other hand, we give view a list of three ranges it will plot the surface inside the
rectangular solid defined by the ranges. For example,
> plot3d(x^2+y^2,x=-5..5,y=-5..5,axes=boxed,grid=[50,50],
view=[-1..2,-3..4,-5..5]);

The last option we will discuss is the coords option. The coords option allows you to
change the coordinate system you are working in. By default the coordinate system is
rectangular but you can choose from any of the following: bipolarcylindrical, bispherical,
cardioidal, cardioidcylindrical, casscylindrical, confocalellip, confocalparab, conical,
cylindrical, ellcylindrical, ellipsoidal, hypercylindrical, invcasscylindrical,
invellcylindrical, invoblspheroidal, invprospheroidal, logcoshcylindrical, logcylindrical,
maxwellcylindrical, oblatespheroidal, paraboloidal, paracylindrical, prolatespheroidal,
rosecylindrical, sixsphere, spherical, tangentcylindrical, tangentsphere, and toroidal. In
most cases you will only use cylindrical and spherical. In cylindrical coordinates Maple
expects the function to be of the form r = r ( , z ) . That is, the function must determine
the radius r in terms of theta and z. Also, the order of the ranges in the command is
important. The theta range must come before the z range. For example, the following
image is a correct view of the surface r = .
> plot3d(theta,theta=0..8*Pi,z=-1..1, coords=cylindrical,
grid=[200,10],axes=boxed);

whereas, the following surface is not. Note that in the following command we simply
switched the order of the ranges.

71

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> plot3d(theta,z=-1..1,theta=0..8*Pi, coords=cylindrical,


axes=boxed);

In spherical coordinates Maple assumes that the surface to be graphed is of the form
r = r ( , ) . That is, the function must determine the radius r in terms of theta and phi.
The order of the ranges in the command is important as well. The theta range must come
before the phi range. For example, the following image is a correct view of the surface
r = .
> plot3d(theta,theta=0..8*Pi,phi=0..Pi, coords=spherical,
grid=[200,10],axes=boxed);

When you are in spherical coordinates many times the surface is defined in the form of
r = r ( , ) . In cylindrical coordinates, on the other hand, there is another common form,
z = z (r , ) . We can graph surfaces of the form z = z (r , ) by adding a coordinate system
with the addcoords command. The command,
addcoords(z_cylindrical,[z,r,theta],[r*cos(theta),
r*sin(theta),z]);
will allow Maple to understand plots of z = z (r , ) surfaces as long as the ranges are in
the order of r and then theta.

72

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

plot3d(r*theta,r=0..10,theta=0..2*Pi,
coords=z_cylindrical,axes=BOXED);

There are many other options for the plot3d command and we encourage you to consult
the Maple documentation.

The cylinderplot Command


The cylinderplot command is another way to produce a cylindrical coordinate plot. With
the cylinderplot command Maple expects the function to be of the form r = r ( , z ) . That
is, the function must determine the radius r in terms of theta and z. Also, the order of the
ranges in the command is important. The theta range must come before the z range. The
cylinderplot command is in the plots package, so this package will need to be loaded
prior to using cylinderplot. For example,
> with(plots):
Warning, the name changecoords has been redefined

> cylinderplot(z+3*cos(2*theta),theta=0..Pi,z=0..3);

Note that the following plot3d command produces the same graph.
plot3d(z+3*cos(2*theta),theta=0..Pi,z=0..3,
coords=cylindrical);

73

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

The sphereplot Command


The sphereplot command is another way to produce a cylindrical coordinate plot. With
the sphereplot command Maple expects the function to be of the form r = r ( , ) . That
is, the function must determine the radius r in terms of theta and phi. Also, the order of
the ranges in the command is important. The theta range must come before the phi range.
The sphereplot command is in the plots package, so this package will need to be loaded
prior to using sphereplot. For example,
> with(plots):
Warning, the name changecoords has been redefined

> sphereplot(1,theta=0..2*Pi,phi=0..Pi/2,
scaling=constrained,axes=boxed);

Note that the following plot3d command produces the same graph.
plot3d(1,theta=0..2*Pi,phi=0..Pi/2,coords=spherical,
scaling=constrained,axes=boxed);

The arrow Command


The arrow command is quite useful when discussing vectors. The arrow command has a
lot of different options for displaying vectors, we will look at just a few here. The arrow
command is in the plots package, so you will have to load the plots package into your
worksheet.
> with(plots):
Warning, the name changecoords has been redefined

In its simplest form, to plot a vector simply input the vector.


> arrow([1,2,3],axes=boxed);

74

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

To alter the appearance of the vector use the shape option with either the arrow or
harpoon value. For example,
> arrow([1,2,3],shape=arrow,axes=boxed,color=black);

> arrow([1,2,3],shape=harpoon,axes=boxed,color=black);

To plot a vector that begins at one point and ends at another, input both points, as vectors,
and use the difference option, as below.
> arrow([1,2,3],[3,4,5],shape=arrow,difference,view=[-2..4,
-1..5,0..6],axes=boxed,color=black);

75

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

If you input two vectors without using the difference option Maple will graph the second
vector starting at the position of the first vector. For example,
> arrow([1,2,3],[3,4,5],shape=arrow,view=[-2..4,-1..7,0..8],
axes=boxed,color=black);

If you place the two vectors in a single set then the vectors will be graphed together
starting at the origin.
> arrow({[1,2,3],[3,4,5]},shape=arrow,view=[-2..4,-1..7,
0..8],axes=boxed,color=black);

Finally, if we input two sets of vectors Maple will graph the second set of vectors starting
at each of the position in the first set of vectors. For example,

76

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> arrow({[1,2,3],[3,4,5]},{[1,1,1],[-2,-1,5],[3,-4,7],[5,9,2]},shape=arrow,axes=boxed,color=black);

The fieldplot3d Command


The fieldplot3d command is for producing plots of vector fields over R3. There is a
corresponding command, fieldplot, for vector fields over R2. The syntax for the
fieldplot3d command is similar to that of the gradplot3d command.
fieldplot3d(expr,xrng,yrng,zrng)
where expr is the vector-valued expression or function in R3, xrng is the range for the x
direction, yrng is the range for the y direction and zrng is the range for the z direction. Of
course, you may, in addition, have any options you wish. The fieldplot command is in
the plots package, so you will have to load the plots package into your worksheet.
> with(plots):
Warning, the name changecoords has been redefined

> fieldplot3d([2*x,2*y,1],x=-1..1,y=-1..1,z=-1..1);

One nice option for the fieldplot3d command is the grid option. In 3d plots the grid
option controls the number of points used in constructing the graph. In many cases we
want to increase the number of points to give the image a finer resolution. In the case of

77

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

the field plot more vectors tends to complicate the image and fewer vectors tend to make
the graph clearer. By setting the grid option to low numbers can sometimes help in
analyzing the vector field.
> F:=(x,y,z)->[2*x,2*y,z^2];
F := ( x, y, z ) [ 2 x, 2 y, z 2 ]
> fieldplot3d(F(x,y,z),x=-1..1,y=-1..1,z=-1..2,axes=boxed,
grid=[5,5,5],color=black);

The gradplot3d Command


The gradplot3d command is for producing plots of the gradient field of a function of
three variables. There is a corresponding command, gradplot, for functions of two
variables. The syntax for the gradplot3d command is as follows.
gradplot3d(expr,xrng,yrng,zrng)
where expr is the expression or function of two variables, xrng is the range for the x
direction, yrng is the range for the y direction and zrng is the range for the z direction. Of
course, you may, in addition, have any options you wish. The gradplot3d command is in
the plots package, so you will have to load the plots package into your worksheet.
> with(plots):
Warning, the name changecoords has been redefined

> gradplot3d(f(x,y,z),x=-2..2,y=-2..2,z=-2..2);

78

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

One nice option for the gradplot3d command is the grid option. In 3d plots the grid
option controls the number of points used in constructing the graph. In many cases we
want to increase the number of points to give the image a finer resolution. In the case of
the field plot more vectors tends to complicate the image and fewer vectors tend to make
the graph clearer. By setting the grid option to low numbers can sometimes help in
analyzing the gradient field. For example,
> gradplot3d(f(x,y,z),x=-2..2,y=-2..2,z=-2..2,grid=[5,5,5],
color=black,axes=boxed);

The implicitplot3d Command


The implicitplot3d command is for graphing implicitly defined relations. The syntax for
the implicit plot3d command is similar to the plot3d command except that it requires
ranges for x, y, and z. The implicitplot3d command is not loaded automatically by
Maple, it resides in the plots package and hence needs to be loaded with the with
command. For example,
> with(plots):
Warning, the name changecoords has been redefined

> implicitplot3d(x^2-y^2+z*x*y=2,x=-5..5,y=-5..5,z=-5..5);

79

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> implicitplot3d(x^2-y^2+z*x*y=2,x=-5..5,y=-5..5,z=-5..5,
axes=boxed,grid=[20,20,20]);

The spacecurve Command


All of the other commands in the three-dimensional graphics section concerned plotting
either vectors or surfaces. To plot a curve in three-dimensions we use the spacecurve
command. The spacecurve command needs a vector valued function or expression and a
range for the parameter. The spacecurve command is in the plots package, so you will
have to load the plots package into your worksheet. For example,
> with(plots):
Warning, the name changecoords has been redefined

> spacecurve([cos(t),sin(t),t/2],t=0..2*Pi);

80

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

As with most of the three dimensional graphics command you can use any of the options
that apply to the plot3d command, except for the surface style options. Also, since this is
a curve and not a surface you would use the numpoints option instead of the grid option
to refine the curve.
> spacecurve([cos(t),sin(t),t/2],t=0..10*Pi,color=black,
axes=boxed,numpoints=500);

The display Command


The display command is simply a way to paste several plots together. Its syntax is
simple,
display(expr)
where expr is a sequence of plots separated by commas. Note that the sequence does not
have to be in a list or set. The display command is in the plots package, so you will have
to load the plots package into your worksheet. For example,
> a:=plot3d(sin(x)+cos(y),x=-5..5,y=-5..5):
> b:=implicitplot3d(x^2+y^2+z^2=17,x=-5..5,y=-5..5,z=-5..5):
> display(a,b,axes=boxed);

81

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

If you read any of the Maple documentation you may notice that there is a display3d
command. The display3d command looks like it is for displaying three-dimensional
graphs but it actually just calls the display command. Hence you never need to use the
display3d command. There is one main restriction to the display command and that is
that it cannot plot a two-dimensional plot with a three-dimensional plot.

82

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

Packages
Maple is a very large and versatile mathematical software package. If we were to load all
of the Maple commands into memory when we started it up it would take up far too many
system resources. Instead, when we load Maple only a small number of commands are
loaded. Basically, there is enough to do simple calculations in a number of mathematical
areas including Calculus but more advanced commands are omitted. These more
advanced commands are in a number of code files called packages. To gain access to
these commands you can either reference the package the command is in or more simply
load the package into memory with the with command. Specifically, the command
with(pkg):
loads in the package named pkg. For example to load the plots package we use the
command
with(plots):
Note that we usually use the colon at the end of the with command. If we use the
semicolon we will get a listing of all of the functions in that package. The colon
suppresses this output. In this section we will discuss some of the Maple packages you
may encounter in Calculus I, II and III. There are many other packages that are specific
to certain areas of mathematics but we will not discuss them here.

The student Package


The student package has many specialized commands primarily for teaching and learning
undergraduate mathematics, specifically Calculus I, II & III. The student package has
recently been superseded by the Student package, which is a package with one
subpackage, Calculus1. We will discuss the Student package later. The student package
can be loaded using the command
with(student):
The commands that are loaded are: D, Diff, Doubleint, Int, Limit, Lineint, Product, Sum,
Tripleint, changevar, completesquare, distance, equate, integrand, intercept, intparts,
leftbox, leftsum, makeproc, middlebox, middlesum, midpoint, powsubs, rightbox,
rightsum, showtangent, simpson, slope, summand, trapezoid. You will note that some of
the commands that are loaded, like D, Diff and Int, already exist in Maple. We will look
at a few of these commands.

83

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

The changevar Command


The changevar command will do a change of variable for an integral. It works for both
definite and indefinite integrals. For the definite integral simply define the integral,
> Int(sqrt(cos(x))*sin(x), x=0..Pi/2);

cos( x ) sin ( x ) dx

then give the changevar command the substitution equation in the following form.
> changevar(cos(x)=u, %, u);
1

u du
0
To do the integral we simply hit the result with the value function.
> value(%);
2
3

The syntax is the same for the indefinite integral, except that we do a substitution at the
end. Take the integral,
> Int(sqrt(x^3-x^2+3*x-4)*(6*x^2-4*x+6), x);

x3 x 2 + 3 x 4 ( 6 x2 4 x + 6 ) dx

do the substitution,
> changevar(u=x^3-x^2+3*x-4, %, u);
2 u d u

find the value,


> value(%);
( 3/2 )

4u
3

84

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

substitute back,
> subs(u=x^3-x^2+3*x-4,%);
4 ( x3 x2 + 3 x 4 )
3

( 3/2 )

and you are done. Below we check our answer.


> diff(%,x);
2

x3 x2 + 3 x 4 ( 3 x2 2 x + 3 )

The distance Command


The distance command simply finds the Euclidean distance between two points.
> distance(-3, 5);
8
> distance([1,2], [3,5]);
13
> distance([a,b], [c,d]);
( a c ) 2 + ( b d )2
> distance([a,b,c,d,e], [f,g,h,i,j]);
( b g )2 + ( a f )2 + ( i d )2 + ( h c )2 + ( e j )2
> distance([6,4,-2,1], [8,-4,-3,8]);
118

The intercept Command


The intercept command will find the intersection between two curves. If one curve is
input the result will be the y intercept and when two curves are input the result will be the
intersection of the two curves. For example,
> intercept(y = x^2+5);

{ y = 5, x = 0 }

> intercept(y = x^2+5,y=0);


{ y = 0, x = RootOf( 5 + _Z 2, label = _L5 ) }
> evalf(%);

85

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

{ y = 0., x = 2.236067978 I }
> intercept(y = x^2-5,y=0);
{ y = 0, x = RootOf( 5 + _Z 2, label = _L3 ) }
> evalf(%);

{ y = 0., x = 2.236067977 }

> intercept(y = sin(x),y=x-2);


{ x = 2 + sin ( RootOf( _Z + 2 + sin ( _Z ) ) ), y = sin ( RootOf( _Z + 2 + sin ( _Z ) ) ) }
> evalf(%);

{ x = 2.554195953, y = 0.5541959527 }

The leftbox, leftsum, rightbox, rightsum, middlebox and


middlesum Commands
All of these commands deal with displaying or finding Riemann sums. The graphing
commands leftbox, rightbox and middlebox will graph the rectangles. Their syntax is all
the same, input a function, range, number of rectangles and any other graphing options
you want. For example,
> leftbox(sin(x)+cos(x), x=0..2*Pi, 5);

> leftbox(sin(x)+cos(x), x=0..2*Pi, 50, shading=BLUE,


color=black);

> rightbox(sin(x)+cos(x), x=0..2*Pi, 5);


86

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> rightbox(sin(x)+cos(x), x=0..2*Pi, 50, shading=BLUE,


color=black);

> middlebox(sin(x)+cos(x), x=0..2*Pi, 5);

> middlebox(sin(x)+cos(x), x=0..2*Pi, 50, shading=BLUE,


color=black);

87

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

To evaluate the sums we use their corresponding sum commands. The sum commands
use the same syntax, except that the graphing options should be omitted. For example,
the Riemann sum values for each of the above images are below.
> leftsum(sin(x)+cos(x), x=0..2*Pi, 5);
2 4 2 i
2 i
sin
+ cos

5 i= 0 5
5

> value(%);

2
2

1 + 2 cos
2 cos
5
5
5

> leftsum(sin(x)+cos(x), x=0..2*Pi, 50);


1 49 i
i
sin
+ cos

25 i = 0 25
25

> value(%);
0
> rightsum(sin(x)+cos(x), x=0..2*Pi, 5);
2 5 2 i
2 i
sin
+ cos

5 i= 1 5
5

> value(%);

2
2

1 + 2 cos
2 cos
5
5
5

> rightsum(sin(x)+cos(x), x=0..2*Pi, 50);


1 50 i
i
sin
+ cos

25 i = 1 25
25

> value(%);
0
> middlesum(sin(x)+cos(x), x=0..2*Pi, 5);

2 i + 1
2 i + 1
4


2
2
2
sin
+
cos


5 i= 0
5
5

> value(%);

2
1 + 2 cos 2 cos

5
5

5

> middlesum(sin(x)+cos(x), x=0..2*Pi, 50);

88

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

1
i + 1
49 i +
2

1
2
sin
+ cos

25
25
25 i = 0

> value(%);
0

The midpoint Command


The midpoint command finds the midpoint between two points. For example,
> midpoint([a,b],[c,d]);
a + c, b + d

2 2 2 2

The showtangent Command


The showtangent command graphs a curve and its tangent line to a specified point on the
curve. All you need to input is the curve and the point of tangency. Other options may
be input as well, the most common are x and y range restrictions. For example,
> showtangent(x^2+x+5, x = 2);

> showtangent(x^2+x+5, x = 2,x=-2..3);

89

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> showtangent(x^2+x+5, x = 2,x=-2..3,y=-5..15);

The trapezoid and simpson Commands


The trapezoid command approximates an integral using the trapezoidal rule and the
simpson command approximates an integral using Simpsons rule. The syntax for each is
identical, input the function, the range and the number of trapezoids or divisions. Note
that the number of divisions for Simpsons rule must be an even integer. For example,
> trapezoid(sin(x)+cos(x), x=1..3, 5);
1
1
2 4
2i
2 i 1
1
sin ( 1 ) + cos( 1 ) + sin 1 +
+ cos 1 +
+ sin ( 3 ) + cos( 3 )
5
5
5 i = 1
5
5
5
5

> value(%);
1
1
2
7
2
7
2
9
2
9
2
11
2
11
sin ( 1 ) + cos( 1 ) + sin + cos + sin + cos + sin + cos
5
5
5 5 5
5 5 5 5
5 5 5 5
5
2
13
2
13
1
1
+ sin + cos + sin ( 3 ) + cos( 3 )
5 5 5
5
5 5
> evalf(%);
0.8188482867
> trapezoid(sin(x)+cos(x), x=1..3, 50);
1
1
1 49
i
i 1
1
sin ( 1 ) + cos( 1 ) + sin 1 +
+ cos 1 +
+ sin ( 3 ) + cos( 3 )
50
50
25 i = 1
25
25 50
50

> evalf(value(%));
0.8298331624
Note that an error is generated if the number of divisions in Simpsons rule is not even.
> simpson(sin(x)+cos(x), x=1..3, 5);
Error, (in simpson) must have an even number of intervals

> simpson(sin(x)+cos(x), x=1..3, 6);

90

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

1
1
1
1
4 3
2 2i
2 2 i
sin ( 1 ) + cos( 1 ) + sin ( 3 ) + cos( 3 ) + sin +

+ cos +
9
9
9
9
9 i = 1 3 3
3 3

2 2
2i
2 i

+ sin 1 +

+ cos 1 +
9 i = 1
3
3

> value(%);
1
1
1
1
4
4
4
4
4
4
sin ( 1 ) + cos( 1 ) + sin ( 3 ) + cos( 3 ) + sin + cos + sin ( 2 ) + cos( 2 )
9
9
9
9
9 3 9
9
3 9
4
8
4
8
2
5
2
5
2
7
2
7
+ sin + cos + sin + cos + sin + cos
9 3 9
3 9 3 9
3 9 3 9
3
> evalf(%);
0.8300015109
> simpson(sin(x)+cos(x), x=1..3, 50);
1
1
1
1
sin ( 1 ) + cos( 1 ) + sin ( 3 ) + cos( 3 )
75
75
75
75
4
sin 24 +

75 i = 1 25

2 24
+ sin 1 +
75 i = 1

25

2i
24 2 i
+ cos +

25
25 25
2i
2 i
+ cos 1 +

25
25

> evalf(value(%));
0.8299438381

The Lineint Command


The Lineint command finds the line integral over a surface above a parametrically
defined curve. Simply input the surface, function of two variables, the parametric
equations for the curve and the bounds for the parameter. For example,
> Lineint(f(x,y),x,y,t=a..b);
b

f( x( t ), y( t ) )

a
> f:=(x,y)->y*cos(x);

d y( t ) + d x( t ) dt
d t
d t

f := ( x, y ) y cos( x )

> Lineint(f(x,y),x=t,y=sin(t),t=1..2);

91

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

cos( t ) sin ( t )

d sin ( t ) + d t dt
d t
dt

> value(%);
( 3/2 )
( 3/2 )
1
1
( cos( 2 )2 + 1 )
+ ( cos( 1 )2 + 1 )
3
3

> evalf(%);
0.0659110793

The Student Package: Student[Calculus1]


The Student package has many specialized commands primarily for teaching and learning
undergraduate mathematics, specifically Calculus I, II & III. The Student package
supersedes the student package The student package can be loaded using the command
with(Student[Calculus1]):
The commands that are loaded are: AntiderivativePlot, ApproximateInt, ArcLength,
Asymptotes, Clear, CriticalPoints, DerivativePlot, ExtremePoints, FunctionAverage,
FunctionChart, GetMessage, GetNumProblems, GetProblem, Hint, InflectionPoints,
Integrand, InversePlot, MeanValueTheorem, NewtonQuotient, NewtonsMethod,
PointInterpolation, RiemannSum, RollesTheorem, Roots, Rule, Show, ShowIncomplete,
ShowSteps, Summand, SurfaceOfRevolution, Tangent, TaylorApproximation,
Understand, Undo, VolumeOfRevolution, WhatProblem. We will look at a few of these
commands.

The AntiderivativePlot Command


The AntiderivativePlot command will plot a function along with one of its
antiderivatives. The syntax for the command is
AntiderivativePlot(expr,rng,opts)
where expr is the expression or function to be graphed, rng is the range of the
independent variable and opts is a list of options. Two of the main options are value and
showclass. The value option allows you to select the y-value of the left hand endpoint
and the showclass option displays a set of antiderivatives. For example,
> with(Student[Calculus1]):
> f := x -> x^2+2*x-7;
f := x x 2 + 2 x 7

92

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> AntiderivativePlot(f(x), x=-3..3, value = 0);

> AntiderivativePlot(f(x), x=-3..3, value = 15);

> AntiderivativePlot(f(x), -3..3, value = 15, showclass);

The ApproximateInt Command


The ApproximateInt command is a very versatile command that allows you to explore a
wide range of integral approximation schemes and output the result in a number of
different ways, including animation. The syntax for the command is
ApproximateInt(expr,rng,opts)

93

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

where expr is the expression or function to be integrated, rng is the range of the
independent variable and opts is a list of options. The real power of this command is the
wealth of options it has. The basic command will find the approximation of the integral
using the midpoint Riemann sum with 10 rectangles. For example,
> with(Student[Calculus1]):
> ApproximateInt(x^2, x=0..1);
133
400
One of the options for the ApproximateInt command is the output option. Output can be
either value, sum, plot or animation. The default is value. Another well used option is
the partition option. The partition option can take on several forms but most often it is
used to set the number of divisions in the interval. For example,
> ApproximateInt(x^2, x=0..1,output=value);
133
400
> ApproximateInt(x^2, x=0..1,partition=100);
13333
40000
> ApproximateInt(x^2, x=0..1, output=sum,partition=10000);
2
1 9999 i
1
+

10000 i
10000 20000
=0

> evalf(value(%));
0.3333333325
Another option is the method option that allows you to set the approximation algorithm.
The method option can take any of the following values.
Value
bode
left
lower
midpoint
newtoncotes[N]
random
right
simpson
simpson[3/8]
trapezoid
upper

Rule
Bodes rule
Left Riemann Sum
Lower Riemann Sum
Midpoint Riemann Sum
Newton-Cotes' method of order N
Random selection of point in each interval
Right Riemann Sum
Simpson's rule
Simpson's 3/8 rule
Trapezoidal rule
Upper Riemann Sum

94

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

For example,
> ApproximateInt(x^2, x=0..1, output=sum,method=simpson);
2
2
1 9 i 2
i
1 i
1

100 + 4 10 + 20 + 10 + 10
60 i


=
0

> value(%);
1
3

Another of the possible outputs is the plot. With this option Maple will display a plot of
the approximation. For example,
> ApproximateInt(x^2, x=0..1, output=plot);

> ApproximateInt(sin(x), x=0..2*Pi, output=plot,


method=lower);

> ApproximateInt(sin(x), x=0..Pi, output=plot,method=upper,


partition=25);

95

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> ApproximateInt(sin(x), x=0..2*Pi, output=plot,


method=trapezoid);

When there are a large number of rectangles being used the image can become cluttered.
To clean it up a bit you can use the outline option that will display just the outline of the
approximation. For example,
> ApproximateInt(sin(x), x=0..Pi, output=plot,method=upper,
partition=25,outline);

You can change the appearance of the boxes and the function by using the boxoptions
and functionoptions options. These two options take lists of options that apply to lines
and functions. For example,

96

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> ApproximateInt(sin(x), x=0..2*Pi, output=plot,


method=trapezoid,boxoptions=[color=blue,thickness=3],
functionoptions=[color=red,thickness=2,filled=true]);

The last output type is animation. This option will create a standard animation of the
approximation using more and more subdivisions. There are three options that control
the way the animation is done. The iterations option sets the number of successive
iterations of the method, that is, the number of frames in the animation. The refinement
option sets the way that the subintervals are divided. The two main values for this option
are halve and random. Halve will divide the interval in half and random will pick a
random point in the subinterval. The subpartition option determines the rectangle that
will be divided next. The values for this option are all, width and area. The value all
value indicates that every subinterval is subpartitioned, width indicates that the interval
with greatest width is subpartitioned and area indicates that the interval with greatest area
is subpartitioned. Note that some of these animations can take a long time to generate
especially if the number of iterations is high. For example, the command
> ApproximateInt(sin(x), 0..Pi, output=animation,
partition=2, refinement=halve, subpartition=all,
iterations=10);

produces the following sequence of images after the one pictured here. The first three
images are shown along with the final image.

97

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

The DerivativePlot Command


The derivativeplot command will graph a function with its derivatives or a set of
derivatives. The syntax for this command is
DerivativePlot(expr,rng,opts)
where expr is the expression or function to be integrated, rng is the range of the
independent variable and opts is a list of options. The main options are derivativeoptions
which takes a list of options for the derivative curve, functionoptions which takes a list of
options for the curve, order which specifies which derivative or set of derivatives to plot,
and view which sets the viewing window. For example,
> with(Student[Calculus1]):
> f:=x->sin(x);
f := sin
> DerivativePlot(f(x), x=-5..5);

> DerivativePlot(f(x),x=-5..5,derivativeoptions=[color=red],
functionoptions=[color=black],order=2);

98

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> DerivativePlot(x^5-7*x^4,x=0..6,
functionoptions=[color=black],order=1..3);

The InversePlot Command


The InversePlot command will graph a function along with its graphical inverse and the
line y = x . For example,
> InversePlot(exp(x), x=-2..2);

There are several options for controlling the curve attributes, the most common are
functionoptions and inverseoptions. Each of these takes a list of options to be applied to
the function or the inverse. For example,

99

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> InversePlot(exp(x), x=-2..2,functionoptions=[color=black],


inverseoptions=[color=red,linestyle=DASH]);

The MeanValueTheorem Command


The MeanValueTheorem command displays a nice graphical image of the Mean Value
Theorem. Simply input the function and an interval and Maple will display the function,
a line segment between the endpoints and every place in the interval where the slope of
the tangent line matches that of the average. For example,
> MeanValueTheorem(x^3 - x^2, x=0..2);

> MeanValueTheorem(sin(x), x=0..10);

The MeanValueTheorem command has several options for customizing the display one
of which is the view option.
100

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> MeanValueTheorem(sin(x), x=0..10,view=[DEFAULT,-2..2]);

The MeanValueTheorem command can also output just the points of tangency with no
graph by adding the output=points option. For example,
> MeanValueTheorem(x^3 - x^2, x=0..2, output=points);
7
1
+

3
3
> MeanValueTheorem(sin(x), x=0..10,output=points);

arccos sin( 10 ) , arccos sin( 10 ) + 2 , arccos sin( 10 ) + 2


10
10
10

By adding the numeric=true option we can convert the output to approximate solutions.
> MeanValueTheorem(sin(x), x=0..10,output=points,
numeric=true);
[ 1.625225308, 4.657959999, 7.908410616 ]

The NewtonsMethod Command


The NewtonsMethod command displays a nice graphical image of Newtons Method
given a function and an initial starting point. The main controlling options for this
command are the output and iterations. The output option can be either: plot, value or
sequence. Plot displays the method graphically, value gives the final approximation and
sequence displays the sequence of approximations. For example,
> NewtonsMethod(x^2+x-1,x=2,output=plot);

101

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> NewtonsMethod(x^2+x+1,x=2,output=plot);

> NewtonsMethod(x^2+x+1,x=2,output=plot,iterations=100,
view=[-2..2,0..10]);

> NewtonsMethod(x^2+x-1,x=2,output=value);
0.6180339889
> NewtonsMethod(x^2+x-1,x=2,output=value,iterations=10);
0.6180339889
> NewtonsMethod(x^2+x-1,x=2,output=value,iterations=3);
0.6190476191
> NewtonsMethod(x^2+x-1,x=2,output=sequence,iterations=3);
2, 1.000000000, 0.6666666667, 0.6190476191
> NewtonsMethod(x^2+x-1,x=2,output=sequence,iterations=10);
2, 1.000000000, 0.6666666667, 0.6190476191, 0.6180344477, 0.6180339889
102

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

Note in the last command that there are not 10 values in the sequence. If Maple sees that
the successive values are the same it will remove them.

The RiemannSum Command


The Student[Calculus1] package also has a RiemannSum command. The capabilities of
this command are contained in the ApproximateInt command discussed earlier. To plot
or get numeric values to Riemann sums please use the ApproximateInt command.

The RollesTheorem Command


The Student[Calculus1] package also has a RollesTheorem command. The capabilities of
this command are contained in the MeanValueTheorem command discussed earlier. To
plot a graphic image of Rolles Theorem please use the MeanValueTheorem command.

The SurfaceOfRevolution Command


The SurfaceOfRevolution command can produce a surface of revolution given a function,
an interval and an axis. The general syntax for this function is
SurfaceOfRevolution(expr,rng,opts)
where expr is the expression or function to be used, rng is the range of the independent
variable and opts is a list of options. The main options are output and axis. Output can
be either plot, integral or value. Plot returns a graphic image of the surface, integral
returns the unevaluated integral that will find surface area and value returns the surface
area. For example,
> SurfaceOfRevolution(cos(x)+1,x=0..Pi,output=plot);

> SurfaceOfRevolution(cos(x)+1,x=0..Pi,output=integral);

2 ( cos( x ) + 1 ) sin ( x )2 + 1 dx

103

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> SurfaceOfRevolution(cos(x)+1,x=0..Pi,output=value);
2

4 2 EllipticE
2
> evalf(%);
24.00301062
> SurfaceOfRevolution(cos(x)+1,x=0..Pi,output=plot,
axis=vertical);

> SurfaceOfRevolution(cos(x)+1,x=0..Pi,output=value,
axis=vertical);

2 x sin ( x )2 + 1 dx

0
> evalf(%);
37.70384091
> SurfaceOfRevolution(sin(1/x),x=1/2..2,output=plot,
axis=vertical);

> SurfaceOfRevolution(sin(1/x),x=1/2..2,output=plot);

104

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

The Tangent Command


The Tangent command can produce a graph, slope or equation of a tangent line to a
curve. The general syntax for this function is
Tangent(expr,pos,opts)
where expr is the expression or function to be used, pos is the position of the tangent line
and opts is a list of options. The main option for this command is the output option.
Output can be either plot, slope or line. Plot returns a graphic image, slope returns just
the slope of the line and line returns the equation of the tangent line. For example,
> Tangent(sin(cos(x)),x=1,output=plot);

> Tangent(sin(cos(x)),x=1,output=slope);
cos( cos( 1 ) ) sin ( 1 )
> evalf(%);
-0.7216061490
> Tangent(sin(cos(x)),x=1,output=line);
x cos( cos( 1 ) ) sin ( 1 ) + sin ( cos( 1 ) ) + cos( cos( 1 ) ) sin ( 1 )
> evalf(%);

0.7216061490 x + 1.236001408

105

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

The TaylorApproximation Command


The TaylorApproximation command can produce a graph, polynomial or animation of
Taylor polynomial approximations to a curve. The general syntax for this function is
TaylorApproximation(expr,pos,opts)
where expr is the expression or function to be used, pos is the position of the expansion
and opts is a list of options. The main options for this command are order and output.
Output can be either plot, polynomial or animation. Plot returns a graphic image,
polynomial (the default) returns the Taylor polynomial and animation returns an
animation of Taylor polynomial graphs as the order moves through a range of orders.
The order option specifics the order of the Taylor approximation. The order option can
be either a single value or a range of values. If it is a range, then Maple will plot, or find,
all of the Taylor polynomials in that range. Note that if pos is left blank Maple assumes
that the expansion point is 0. For example,
> TaylorApproximation(sin(x),order=4);
1
x x3
6
> TaylorApproximation(sin(x),order=10);
1
1 5
1 7
1
x x3 +
x
x +
x9
6
120
5040
362880
> TaylorApproximation(sin(x),order=4,output=plot,view=[10..10,-3..3]);

> TaylorApproximation(sin(x),order=1..10,output=plot,view=[10..10,-3..3]);

106

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> TaylorApproximation(sin(x),x=2,order=1..10,output=plot,
view=[-10..10,-3..3]);

Finally, the command


> TaylorApproximation(sin(x),order=1..20,view=[-10..10,3..3],output=animation);
produces an animation of Taylor polynomials from

to

107

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

The VolumeOfRevolution Command


The VolumeOfRevolution command can produce a volume of revolution given a
function, an interval and an axis. The general syntax for this function is
VolumeOfRevolution(expr,rng,opts)
where expr is the expression or function to be used, rng is the range of the independent
variable and opts is a list of options. The main options are output and axis. Output can
be either plot, integral or value. Plot returns a graphic image of the surface, integral
returns the unevaluated integral representing the volume of the solid and value returns the
volume of the solid. For example,
> VolumeOfRevolution(cos(x), x=0..Pi, output=plot);

> VolumeOfRevolution(cos(x), x=0..Pi, output=integral);

cos( x )2 d x

> VolumeOfRevolution(cos(x), x=0..Pi, output=value);


2
2
> evalf(%);
108

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

4.934802202
> VolumeOfRevolution(x^2, x=0..4, output=plot,
axis=vertical);

> VolumeOfRevolution(x^2, x=0..4, output=integral,


axis=vertical);
4

2 x3 dx

> VolumeOfRevolution(x^2, x=0..4, output=value,


axis=vertical);
128
> evalf(%);
402.1238597
> VolumeOfRevolution(sin(1/x),x=1/2..2, output=plot,
axis=vertical);

> VolumeOfRevolution(sin(1/x),x=1/2..2,axis=vertical);
1
1
1
1
1
2 cos + 4 sin + Si cos( 2 ) sin( 2 ) Si ( 2 )
4
2
2
2 2
> evalf(%);
7.983763275
> VolumeOfRevolution(sin(1/x),x=1/2..2, output=plot);

109

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

The Asymptotes Command


The Asymptotes command will find vertical, horizontal and slanted asymptotes. For
example,
> Asymptotes((2*x-7)/(x-3),x);
[ y = 2, x = 3 ]
> Asymptotes((2*x^2-7)/(x-3),x);
[ y = 2 x + 6, x = 3 ]
If we restrict the domain, only asymptotes in that domain are listed.
> Asymptotes((2*x-7)/(x-3),x=-2..2);
[y = 2]
Maple will also try to find all of the asymptotes of a function. If there are an infinite
number of them Maple will make note of it.
> Asymptotes(tan(x),x);
Warning, the expression has an infinity of asymptotes, some examples of
which are given

x = , x = , x = 3

2
2
2

> Asymptotes(tan(x),x=0..20);
x = , x = 3 , x = 5 , x = 7 , x = 9 , x = 11

2
2
2
2
2
2

> Asymptotes(arctan(x),x);
y = , y =

2
2

110

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> product((x-i),i=1..10);
( x 1 ) ( x 2 ) ( x 3 ) ( x 4 ) ( x 5 ) ( x 6 ) ( x 7 ) ( x 8 ) ( x 9 ) ( x 10 )
> Asymptotes(1/(product((x-i),i=1..10)),x);
[ y = 0, x = 1, x = 2, x = 3, x = 4, x = 5, x = 6, x = 7, x = 8, x = 9, x = 10 ]

The CriticalPoints Command


The CriticalPoints command will find all of the critical points of a function. For
example,
> CriticalPoints(3*x^4-16*x^3-66*x^2+360*x+5,x);
[ -3, 2, 5 ]
If we restrict the domain, critical points outside the domain are ignored.
> CriticalPoints(3*x^4-16*x^3-66*x^2+360*x+5,x=0..10);
[ 2, 5 ]
If Maple notices that there are an infinite number of critical points it make note of it.
> CriticalPoints(sin(x),x);
Warning, the expression has an infinity of critical points, some
examples of which are given

3
, ,

2 2 2

The ExtremePoints Command


The ExtremePoints command will find all of the points that produce an extreme (local or
global) of a function. Note that it is the x value of the extreme point that is returned. For
example,
> ExtremePoints(3*x^4-16*x^3-66*x^2+360*x+5,x);
[ -3, 2, 5 ]
> CriticalPoints(x^3,x);
[0 ]
> ExtremePoints(x^3,x);
[ ]
> ExtremePoints( sin(x), x=0..5 );

111

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

0, , 3 , 5

2 2

> ExtremePoints( sin(x), x);


Warning, the expression has an infinity of extreme points, some
examples of which are given

, , 3

2 2 2

The InflectionPoints Command


The InflectionPoints command will find all of the inflection points of a function. For
example,
> InflectionPoints(x^3,x);
[0 ]
> InflectionPoints(3*x^4-16*x^3-66*x^2+360*x+5,x);
-1, 11

> InflectionPoints(3*x^4-16*x^3-66*x^2+360*x+5,x=0..5);
11

3

The Roots Command


The Roots command will find all of the real roots of a function. As with other commands
of this type we can restrict the domain and we can include the numeric option to force
Maple to return numeric values. For example,
> Roots(3*x^4-16*x^3-66*x^2+360*x+5,x);

( 1/6 )
8 ( 15294 + 6 315595 )
( 98 ( 15294 + 6 315595 )

( 1/3 )

+ 3 ( 15294 + 6 315595 )

+ 2 ( 98 ( 15294 + 6 315595 )
( 196 ( 15294 + 6 315595 )

( 1/3 )

98 ( 15294 + 6 315595 )

( 1/3 )

( 1/3 )

( 2/3 )

( 1/4 )

+ 1818 )

+ 3 ( 15294 + 6 315595 )

+ 3 ( 15294 + 6 315595 )

112

( 2/3 )

( 2/3 )

( 3/4 )

+ 1818 )

+ 1818 3

+ 2

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

98 ( 15294 + 6 315595 )
( 15294 + 6 315595 )
1818

( 1/3 )

+ 3 ( 15294 + 6 315595 )

98 ( 15294 + 6 315595 )

( 1/3 )

15294 + 6 315595 )

( 98 ( 15294 + 6 315595 )
( 15294 + 6 315595 )

+ 1818

( 2/3 )

( 1/2 )

+ 572 2

( 2/3 )

( 1/3 )

+ 3 ( 15294 + 6 315595 )

( 2/3 )

+ 1818

( 1/6 )

6 ( 15294 + 6 315595 )

+ 3 ( 15294 + 6 315595 )

( 2/3 )

+ 3 ( 15294 + 6 315595 )

( 2/3 )

( 1/4 )

+ 1818 )

( 1/6 )

( 98 ( 15294 + 6 315595 )

( 1/3 )

2 ( 98 ( 15294 + 6 315595 )

( 1/3 )


, 8

( 1/4 )

+ 1818 )

+ 3 ( 15294 + 6 315595 )

( 2/3 )

( 3/4 )

+ 1818 )

( 196 ( 15294 + 6 315595 )

( 1/3 )

98 ( 15294 + 6 315595 )

( 1/3 )

+ 3 ( 15294 + 6 315595 )

( 2/3 )

+ 1818 3

98 ( 15294 + 6 315595 )

( 1/3 )

+ 3 ( 15294 + 6 315595 )

( 2/3 )

+ 1818

( 15294 + 6 315595 )
1818

( 2/3 )

98 ( 15294 + 6 315595 )

( 1/3 )

( 1/2 )

+ 572 2

+ 2

15294 + 6 315595 )

( 98 ( 15294 + 6 315595 )

( 1/3 )

+ 3 ( 15294 + 6 315595 )

( 2/3 )

+ 1818

( 1/6 )
6 ( 15294 + 6 315595 )

+ 3 ( 15294 + 6 315595 )

( 2/3 )

( 1/4 )

+ 1818 )

> Roots(3*x^4-16*x^3-66*x^2+360*x+5,x,numeric);
[ -4.714892098, -0.01385382051 ]
> Roots(3*x^4-16*x^3-66*x^2+360*x+5,x=-1..1,numeric);
[ -0.01385382051 ]
> Roots(x^2+1,x);
[ ]

The linalg Package


The linalg package has many specialized commands primarily for teaching and learning
linear algebra. The linalg package has been superseded by the LinearAlgebra package
and the VectorCalculus package, both discussed below. The linalg package can be
loaded using the command

113

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

with(linalg):
The commands that are loaded are: BlockDiagonal, GramSchmidt, JordanBlock,
LUdecomp, QRdecomp, Wronskian, addcol, addrow, adj, adjoint, angle, augment,
backsub, band, basis, bezout, blockmatrix, charmat, charpoly, cholesky, col, coldim,
colspace, colspan, companion, concat, cond, copyinto, crossprod, curl, definite, delcols,
delrows, det, diag, diverge, dotprod, eigenvals, eigenvalues, eigenvectors, eigenvects,
entermatrix, equal, exponential, extend, ffgausselim, fibonacci, forwardsub, frobenius,
gausselim, gaussjord, geneqns, genmatrix, grad, hadamard, hermite, hessian, hilbert,
htranspose, ihermite, indexfunc, innerprod, intbasis, inverse, ismith, issimilar, iszero,
jacobian, jordan, kernel, laplacian, leastsqrs, linsolve, matadd, matrix, minor, minpoly,
mulcol, mulrow, multiply, norm, normalize, nullspace, orthog, permanent, pivot,
potential, randmatrix, randvector, rank, ratform, row, rowdim, rowspace, rowspan, rref,
scalarmul, singularvals, smith, stackmatrix, submatrix, subvector, sumbasis, swapcol,
swaprow, sylvester, toeplitz, trace, transpose, vandermonde, vecpotent, vectdim, vector,
wronskian. Since this guide is primarily for the Calculus sequence we will look at a few
of the commands that pertain to Calculus. Although there are many commands here that
can be used in Calculus the two that we will discuss are dotprod and crossprod. These
find the dot product and cross product respectively. For example,
> dotprod([1,2,3],[5,6,7]);
38
> crossprod([1,2,3],[5,6,7]);
[ -4, 8, -4 ]
> dotprod([a,b,c],[d,e,f]);
ad+be+cf
> crossprod([a,b,c],[d,e,f]);
[ b f c e, c d a f, a e b d ]

The LinearAlgebra Package


The LinearAlgebra package has many specialized commands primarily for teaching and
learning linear algebra. The LinearAlgebra package, with the help of the VectorCalculus
package has superseded the linalg package. The LinearAlgebra package can be loaded
using the command
with(LinearAlgebra):
The commands that are loaded are: Add, Adjoint, BackwardSubstitute, BandMatrix,
Basis, BezoutMatrix, BidiagonalForm, BilinearForm, CharacteristicMatrix,
CharacteristicPolynomial, Column, ColumnDimension, ColumnOperation,

114

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

ColumnSpace, CompanionMatrix, ConditionNumber, ConstantMatrix, ConstantVector,


CreatePermutation, CrossProduct, DeleteColumn, DeleteRow, Determinant,
DiagonalMatrix, Dimension, Dimensions, DotProduct, EigenConditionNumbers,
Eigenvalues, Eigenvectors, Equal, ForwardSubstitute, FrobeniusForm,
GaussianElimination, GenerateEquations, GenerateMatrix, GetResultDataType,
GetResultShape, GivensRotationMatrix, GramSchmidt, HankelMatrix, HermiteForm,
HermitianTranspose, HessenbergForm, HilbertMatrix, HouseholderMatrix,
IdentityMatrix, IntersectionBasis, IsDefinite, IsOrthogonal, IsSimilar, IsUnitary,
JordanBlockMatrix, JordanForm, LA_Main, LUDecomposition, LeastSquares,
LinearSolve, Map, Map2, MatrixAdd, MatrixInverse, MatrixMatrixMultiply,
MatrixNorm, MatrixScalarMultiply, MatrixVectorMultiply, MinimalPolynomial, Minor,
Modular, Multiply, NoUserValue, Norm, Normalize, NullSpace, OuterProductMatrix,
Permanent, Pivot, PopovForm, QRDecomposition, RandomMatrix, RandomVector,
Rank, ReducedRowEchelonForm, Row, RowDimension, RowOperation, RowSpace,
ScalarMatrix, ScalarMultiply, ScalarVector, SchurForm, SingularValues, SmithForm,
SubMatrix, SubVector, SumBasis, SylvesterMatrix, ToeplitzMatrix, Trace, Transpose,
TridiagonalForm, UnitVector, VandermondeMatrix, VectorAdd, VectorAngle,
VectorMatrixMultiply, VectorNorm, VectorScalarMultiply, ZeroMatrix, ZeroVector,
Zip. Since this guide is primarily for the Calculus sequence we will look at a few of the
commands that pertain to Calculus. Although there are many commands here that can be
used in Calculus the two that we will discuss are DotProduct and CrossProduct. These
find the dot product and cross product respectively. For example,
> DotProduct(<1,2,3>,<5,6,7>);
38
> DotProduct(<a,b,c>,<d,e,f>);
ad+be+cf
> CrossProduct(<1,2,3>,<5,6,7>);
-4

8
-4
> CrossProduct(<a,b,c>,<d,e,f>);
b f c e
c d a f
a e b d

The VectorCalculus Package


The VectorCalculus package has many specialized commands primarily for teaching and
learning Calculus III. The VectorCalculus package, with the help of the LinearAlgebra
package has superseded the linalg package. The VectorCalculus package can be loaded
using the command
115

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

with(VectorCalculus):
The commands that are loaded are: `&x`, `*`, `+`, `.`, `<,>`, `<|>`, AddCoordinates,
ArcLength, BasisFormat, Binormal, CrossProduct, Curl, Curvature, Del, DirectionalDiff,
Divergence, DotProduct, Flux, GetCoordinateParameters, GetCoordinates, Gradient,
Hessian, Jacobian, Laplacian, LineInt, MapToBasis, Nabla, PathInt, PrincipalNormal,
RadiusOfCurvature, ScalarPotential, SetCoordinateParameters, SetCoordinates,
SurfaceInt, TNBFrame, Tangent, TangentLine, TangentPlane, TangentVector, Torsion,
Vector, VectorField, VectorPotential, Wronskian, diff, evalVF, int, limit, series. We will
look at a few of these commands.

Defining a Vector
To define a vector, vector-valued function or vector field we place the coordinates inside
angled brackets, <>. For example,
> with(VectorCalculus):
Warning, the assigned names <,> and <|> now have a global binding
Warning, these protected names have been redefined and unprotected: *,
+, ., Vector, diff, int, limit, series

> a:=<1,2,3>;

a := e + 2 e + 3 e
x
y
z

> b:=<4,5,6>;

b := 4 e + 5 e + 6 e
x
y
z

> F:=t-><t,t^2,-3*t>;
F := t VectorCalculus:-`<,>`( t, t 2, VectorCalculus:-`*`( VectorCalculus:-`*`( 3, t ), -1 ) )
> F(3);

3e +9e 9e
x
y
z

> F(s-3);
( s 3 ) e + ( s 3 )2 e + ( 3 s + 9 ) e
x
y
z
> G:=(s,t)-><t-s,s+t^2,s^3-3*t>;
G := ( s, t ) VectorCalculus:-`<,>`( VectorCalculus:-`+`( t, VectorCalculus:-`*`( s, -1 ) ),
VectorCalculus:-`+`( s, t 2 ),
VectorCalculus:-`+`( s 3, VectorCalculus:-`*`( VectorCalculus:-`*`( 3, t ), -1 ) ) )
> G(2,4);

2 e + 18 e 4 e
x
y
z

116

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> G(r,2);
( r + 2 ) e + ( r + 4 ) e + ( r 3 6 ) e
x
y
z

The &x Operator and The CrossProduct Command


The &x operator and CrossProduct commands find the cross or vector product between
two vectors. For example,
> with(VectorCalculus):
Warning, the assigned names <,> and <|> now have a global binding
Warning, these protected names have been redefined and unprotected: *,
+, ., Vector, diff, int, limit, series

> a:=<1,2,3>;

> b:=<4,5,6>;

> a &x b;

a := e + 2 e + 3 e
x
y
z
b := 4 e + 5 e + 6 e
x
y
z
( -3 ) e + 6 e 3 e
x
y
z

> CrossProduct(a,b);

( -3 ) e + 6 e 3 e
x
y
z

> F(t) &x G(r,s);


( t 2 ( r 3 3 s ) + 3 t ( r + s 2 ) ) e + ( 3 t ( s r ) t ( r 3 3 s ) ) e +
x
y
( t ( r + s2 ) t 2 ( s r ) ) e

The . Operator and The DotProduct Command


The . operator and DotProduct commands find the dot or scalar product between two
vectors. For example,
> with(VectorCalculus):
Warning, the assigned names <,> and <|> now have a global binding
Warning, these protected names have been redefined and unprotected: *,
+, ., Vector, diff, int, limit, series

117

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> a:=<1,2,3>;

a := e + 2 e + 3 e
x
y
z

> b:=<4,5,6>;

b := 4 e + 5 e + 6 e
x
y
z

> a.b;
32
> DotProduct(a,b);
32
> F(t) . G(r,s);
t ( s r ) + t 2 ( r + s 2 ) 3 t ( r3 3 s )

The ArcLength Command


The ArcLength command will find the arclength of a space curve over the given range of
the independent variable. The general syntax of the ArcLength command is
ArcLength(expr,rng)
Where expr is a vector-valued function of a single variable and rng is the range of the
parameter over the arc. For example,
> with(VectorCalculus):
Warning, the assigned names <,> and <|> now have a global binding
Warning, these protected names have been redefined and unprotected: *,
+, ., Vector, diff, int, limit, series

> F:=t-><t,t^2,-3*t>;
F := t VectorCalculus:-`<,>`( t, t 2, VectorCalculus:-`*`( VectorCalculus:-`*`( 3, t ), -1 ) )
> ArcLength(F(t), t=0..2);
5
5
5
26 ln( 5 ) ln( 2 ) + ln( 4 10 + 26 10 )
2
2
2
> evalf(%);
7.741204804
> ArcLength(<cos(t),sin(t),t>, t=0..s);
2 2 sin ( s )2 arcsin( sin ( s ) )
cos( s )
> ArcLength(<cos(t),sin(t),t>, t=0..Pi);

118

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

The Binormal Command


The Binormal command computes a vector in the direction of the binormal vector to a
curve in R3. Note that this vector is not necessarily the unit binormal vector. To get the
unit binormal you should use the TNBFrame command. The syntax to the Binormal
command is,
Binormal(expr,var)
Where expr is the vector-valued function of a single variable and var is the variable
name. For example,
> with(VectorCalculus):
Warning, the assigned names <,> and <|> now have a global binding
Warning, these protected names have been redefined and unprotected: *,
+, ., Vector, diff, int, limit, series

> F:=t-><t,t^2,-3*t>;
F := t VectorCalculus:-`<,>`( t, t 2, VectorCalculus:-`*`( VectorCalculus:-`*`( 3, t ), -1 ) )
> Binormal(<cos(t),sin(t),t>, t);
1
1
1
1
sin ( t ) e cos( t ) e + sin ( t )2 + cos( t )2 e
2
2
x 2
y 2
z
> simplify(%);
1
1
1
sin ( t ) e cos( t ) e + e
2
x 2
y 2 z
> Binormal(F(t), t);
8 t2
2

+
3

( 3/2 )
2
( 10 + 4 t 2 )
10 + 4 t
24 t 2

e +
+

2
x
2
10 + 4 t
( 10 + 4 t 2 )

8 t2
2

( 3/2 )
10 + 4 t 2
8 t2
( 10 + 4 t 2 )

2
e z
2
10 + 4 t 2
( 10 + 4 t )

> simplify(%);
3
1
e +
e
2
5 + 2 t x 5 + 2 t2 z

119

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

The Curl Command


The Curl command computes the curl of a vector field in R3. The general syntax for the
Curl command is simply,
Curl(F)
where F is a vector field object. A vector field object is defined using the VectorField
command, which requires that a coordinate system be set with the SetCoordinates
command. For example,
> with(VectorCalculus):
Warning, the assigned names <,> and <|> now have a global binding
Warning, these protected names have been redefined and unprotected: *,
+, ., Vector, diff, int, limit, series

> SetCoordinates( 'cartesian'[x,y,z] );


cartesianx, y, z
> F:=VectorField(<x^2,y^2,z^2>);
F := x2 e + y2 e + z 2 e
x
y
z
> Curl(F);
0e

> F:=VectorField(<y,-x,x+y>);
F := y e x e + ( x + y ) e
x
y
z
> Curl(F);

e e 2e
x
y
z

The Curvature Command


The Curvature command finds the general formula for the curvature of a vector-valued
function of a single variable. The syntax for the Curvature command is,
Curvature(expr,var)
where expr is the curve and var is the parameter name. For example,
> with(VectorCalculus):

120

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

Warning, the assigned names <,> and <|> now have a global binding
Warning, these protected names have been redefined and unprotected: *,
+, ., Vector, diff, int, limit, series

> F:=t-><sin(t),cos(t),t>;
F := t VectorCalculus:-`<,>`( sin ( t ), cos( t ), t )
> Curvature(F(t),t);
1
4

2 sin( t ) 2 + 2 cos( t ) 2

> simplify(%);
1
2

> F:=t-><sin(t),cos(t),t^2>;
F := t VectorCalculus:-`<,>`( sin ( t ), cos( t ), t 2 )
> Curvature(F(t),t);

4 cos( t ) t

( 3/2 )

( 4 t2 + 1 )

sin ( t ) 4 sin ( t ) t
cos( t )

+
( 3/2 )
2
4 t + 1 ( 4 t2 + 1 )
4 t2 + 1

8t

+
+
( 4 t 2 + 1 )( 3/2 )

4 t2 + 1

( 1/2 )

4 t2 + 1

> simplify(%);
4 t2 + 5
( 4 t2 + 1 )

4 t2 + 1
> CF:=unapply(%,t);
4 t2 + 5
( 4 t2 + 1 )

CF := t

4 t2 + 1

> CF(2);
21

289
4913

17

> evalf(%);
0.06537869769
> CF(0);
5

121

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

The Del, Gradient and Nabla Commands


The Del, Gradient and Nabla commands all find the gradient vector of a multivariable
function. The syntax for these functions is simply,
Del(expr)
Gradient(expr)
Nabla(expr)
where expr is the function. For example,
> with(VectorCalculus):
Warning, the assigned names <,> and <|> now have a global binding
Warning, these protected names have been redefined and unprotected: *,
+, ., Vector, diff, int, limit, series

> f:=(x,y)->x^2-y^2;
f := ( x, y ) VectorCalculus:-`+`( x2, VectorCalculus:-`*`( y2, -1 ) )
> Del(f(x,y));

> Gradient(f(x,y));

> Nabla(f(x,y));

2xe 2ye
x
y
2xe 2ye
x
y
2xe 2ye
x
y

> f:=(x,y,z,w)->(sin(x*w)-cos(y*z))/(sin(x*y)-cos(w*z));
f := ( x, y, z, w ) VectorCalculus:-`*`( VectorCalculus:-`+`(
sin ( VectorCalculus:-`*`( x, w ) ),
VectorCalculus:-`*`( cos( VectorCalculus:-`*`( y, z ) ), -1 ) ), 1/VectorCalculus:-`+`(
sin ( VectorCalculus:-`*`( x, y ) ),
VectorCalculus:-`*`( cos( VectorCalculus:-`*`( w, z ) ), -1 ) ) )
> f(x,y,z,w);

sin( x w ) cos( y z )
sin( x y ) cos( w z )

> Del(f(x,y,z,w));

122

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

cos( x w ) w
( sin ( x w ) cos( y z ) ) cos( x y ) y

e +
sin ( x y ) cos( w z )
( sin ( x y ) cos( w z ) )2
x
sin ( y z ) z
( sin ( x w ) cos( y z ) ) cos( x y ) x

e +
2
sin
(
x
y
)

cos
(
w
z
)
(
sin
(
x
y
)

cos
(
w
z
)
)

y
sin
(
y
z
)
y
(
sin
(
x
w
)

cos
(
y
z
)
)
sin
(
w
z
)
w

2
sin ( x y ) cos( w z )
z
( sin ( x y ) cos( w z ) )

The diff Command


The diff command finds the partial derivative of a multivariable function. The syntax of
the diff command is,
diff(expr,vars)
where expr is the function to be differentiated and vars is one or more variables
(separated by commas) that represent the variable or variables we are differentiating with
respect to. In other words the diff command in the VectorCalculus package is the same
as the diff command loaded by Maple on start-up. Recall that the order of differentiation
is read from left to right. For example,
> with(VectorCalculus):
Warning, the assigned names <,> and <|> now have a global binding
Warning, these protected names have been redefined and unprotected: *,
+, ., Vector, diff, int, limit, series

> f:=(x,y)->sin(sqrt(x)+y^2);
f := ( x, y ) sin ( VectorCalculus:-`+`( x , y2 ) )
> diff(f(x,y),x);
1 cos( x + y2 )
2
x
> diff(f(x,y),y);
2 cos( x + y2 ) y
> diff(f(x,y),x,y);
sin ( x + y2 ) y

x
> diff(f(x,y),y,x);

sin ( x + y2 ) y
x

> f:=(x,y,z,w)->(sin(x*w)-cos(y*z))/(sin(x*y)-cos(w*z));

123

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

f := ( x, y, z, w ) VectorCalculus:-`*`( VectorCalculus:-`+`(
sin ( VectorCalculus:-`*`( x, w ) ),
VectorCalculus:-`*`( cos( VectorCalculus:-`*`( y, z ) ), -1 ) ), 1/VectorCalculus:-`+`(
sin ( VectorCalculus:-`*`( x, y ) ),
VectorCalculus:-`*`( cos( VectorCalculus:-`*`( w, z ) ), -1 ) ) )
> f(x,y,z,w);

sin( x w ) cos( y z )
sin( x y ) cos( w z )

> diff(f(x,y,z,w),z);
sin ( y z ) y
( sin ( x w ) cos( y z ) ) sin ( w z ) w

sin ( x y ) cos( w z )
( sin ( x y ) cos( w z ) )2
> diff(f(x,y,z,w),z,z,z);
sin ( y z ) y3
3 cos( y z ) y2 sin ( w z ) w 6 sin ( y z ) y sin ( w z )2 w2

+
sin ( x y ) cos( w z )
( sin ( x y ) cos( w z ) )2
( sin ( x y ) cos( w z ) )3
3 sin ( y z ) y cos( w z ) w2 6 ( sin ( x w ) cos( y z ) ) sin ( w z )3 w3

( sin ( x y ) cos( w z ) )2
( sin ( x y ) cos( w z ) )4
6 ( sin ( x w ) cos( y z ) ) sin ( w z ) w3 cos( w z ) ( sin ( x w ) cos( y z ) ) sin ( w z ) w3
+
+
( sin ( x y ) cos( w z ) )3
( sin ( x y ) cos( w z ) )2

The DirectionalDiff Command


The DirectionalDiff command computes the directional derivative of a function in a
given direction. The syntax of the command is,
DirectionalDiff(expr,vec,varlist)
where expr is the function, vec is the direction vector and varlist is a list of independent
variables of the function. Note that the vector need not be a unit vector, simply a
direction vector. For example,
> with(VectorCalculus):
Warning, the assigned names <,> and <|> now have a global binding
Warning, these protected names have been redefined and unprotected: *,
+, ., Vector, diff, int, limit, series

> f:=(x,y)->sin(sqrt(x)+y^2);
f := ( x, y ) sin ( VectorCalculus:-`+`( x , y2 ) )
> DirectionalDiff(f(x,y),<1,1>,[x,y]);

124

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

1
1 cos( x + y2 )

+ 2 cos( x + y2 ) y
2
2
x
2

> DirectionalDiff(x^2-y^2,<1,1>,[x,y]);
2 (2 x 2 y)
2
> DirectionalDiff(x^2-y^2,<a,b>,[x,y]);
2xa2yb
a 2 + b2
> DirectionalDiff(sin(x^2-y^2)/z^2,<1,1,3>,[x,y,z]);
1
2 cos( x2 y 2 ) x 2 cos( x2 y2 ) y 6 sin ( x2 y 2 )

11

11
z2
z2
z3

> ddf:=unapply(%,x,y,z);
1
2 cos( x2 y 2 ) x 2 cos( x2 y2 ) y 6 sin ( x2 y 2 )
11

ddf := ( x, y, z )

11
z2
z2
z3

> ddf(3,5,9);
1
4
2
11 cos( 16 ) +
sin( 16 )
11
81
243

> evalf(%);
0.01354456847

The Divergence Command


The Divergence command computes the divergence of a vector field in R3. The general
syntax for the Divergence command is simply,
Divergence(F)
where F is a vector field object. A vector field object is defined using the VectorField
command, which requires that a coordinate system be set with the SetCoordinates
command. For example,
> with(VectorCalculus):
Warning, the assigned names <,> and <|> now have a global binding
Warning, these protected names have been redefined and unprotected: *,
+, ., Vector, diff, int, limit, series

> SetCoordinates( 'cartesian'[x,y,z] );


cartesianx, y, z

125

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> F:=VectorField(<x^2,y^2,z^2>);
F := x2 e + y2 e + z 2 e
x
y
z
> Divergence(F);

2x+2y+2z

> F:=VectorField(<y,-x,x+y>);
F := y e x e + ( x + y ) e
x
y
z
> Divergence(F);
0
> F:=VectorField(<sin(x),cos(y),tan(z)>);
F := sin ( x ) e + cos( y ) e + tan( z ) e
x
y
z
> Divergence(F);
cos( x ) sin ( y ) + 1 + tan( z )2

The Flux Command


The Flux command computes the flux of a vector field through a surface. The general
syntax for the Flux command is,
Flux(expr,surface)
where expr is a vector field object and surface is a surface object. A vector field object is
defined using the VectorField command, which requires that a coordinate system be set
with the SetCoordinates command. The surface can be either a Box, Sphere or Surface.
The Box surface has syntax
Box(xrng,yrng,zrng,dir)
where xrng, yrng and zrng are the face limits of the box and an optional fourth parameter
represents the direction of the normal vector. The dir option can be either inward or
outward. The Sphere surface has syntax,
Sphere(center,radius,dir)
where center is the center of the sphere given as a vector and radius is the radius of the
sphere. An optional third parameter represents the direction of the normal vector. The
dir option can be either inward or outward. The syntax for the Surface surface is
Surface(v,paramrngs)

126

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

where v is the vector formula for the surface and paramrngs are the ranges of the
parameters that trace out the surface. For example,
> with(VectorCalculus):
Warning, the assigned names <,> and <|> now have a global binding
Warning, these protected names have been redefined and unprotected: *,
+, ., Vector, diff, int, limit, series

> SetCoordinates( 'cartesian'[x,y,z] );


cartesianx, y, z
> F:=VectorField(<x^2,y^2,z^2>);
F := x2 e + y2 e + z 2 e
x
y
z
> Flux(F,Surface(<s,t,s^2-t^2>, s=-3..3,t=-3..3));
2592
5
> F:=VectorField(<y,-x,x+y>);
F := y e x e + ( x + y ) e
x
y
z
> Flux(F,Surface(<s^2,t^3,s+t^2>, s=0..1,t=0..1));
1
> F:=VectorField(<y,-x,0>);
F := y e x e
x
y
> Flux(F,Surface(<s,t,s^2+t^2>, s=0..1,t=2..3));
0
> F:=VectorField(<y^2,-x^3,z>);
F := y2 e x3 e + z e
x
y
z
> Flux(F,Sphere(<0,0,0>,1));

> Flux(F,Sphere(<3,5,9>,1));

4
3
4
3

> Flux(F,Box(-1..1,1..2,3..7));
8
> Flux(F,Box(-1..1,1..2,3..7,inward));
-8

127

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> Flux(F,Box(-1..1,1..2,3..7,outward));
8

The evalVF Command


The evalVF command evaluates a vector field at a particular vector. The general syntax
for the Flux command is,
evalVF(expr,vec)
where expr is a vector field object and vec is the vector. A vector field object is defined
using the VectorField command, which requires that a coordinate system be set with the
SetCoordinates command. For example,
> with(VectorCalculus):
Warning, the assigned names <,> and <|> now have a global binding
Warning, these protected names have been redefined and unprotected: *,
+, ., Vector, diff, int, limit, series

> SetCoordinates( 'cartesian'[x,y,z] );


cartesianx, y, z
> F:=VectorField(<x^2,y^2,z^2>);
F := x2 e + y2 e + z 2 e
x
y
z
> evalVF(F,<1,2,3>);

e +4e +9e
x
y
z

> F:=VectorField(<cos(x),sin(y),z>);
F := cos( x ) e + sin ( y ) e + z e
x
y
z
> evalVF(F,<Pi,Pi/2,3>);

e +e +3e
x
y
z

The int Command


The int command finds the integral of a function over a region or it can find the integral
of a vector field or vector-valued function. The syntax of the int command that finds the
integral of a function over a region is
int(expr,region)
128

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

where expr is the expression to be integrated and region id the region we are integrating
over. The region argument if of the form
[x,y] = RegionType
or
[x,y,z] = RegionType
where the RegionType is any of the following: Circle, Ellipse, Parallelepiped, Rectangle,
Region, Sector, Sphere, Tetrahedron or Triangle. The Circle has syntax,
Circle(center,radius)
where center is the center of the sphere given as a vector and radius is the radius of the
sphere. Note that the center must be a two-dimensional vector. The Ellipse has syntax,
Ellipse(eqn)
where eqn is the equation of the ellipse, in the form of eqn = 0. The Parallelepiped has
syntax,
Parallelepiped(rng1,rng2,rng3,)
where rng1, rng2, are all ranges. Note that the number of ranges must match the
number of variables and that the ranges may not depend on the variables of integration.
The Rectangle has syntax,
Rectangle(rng1,rng2)
where rng1 and rng2 are ranges. The Region has syntax,
Region (rng1,rng2,rng3,)
where rng1, rng2, are all ranges. Note that the number of ranges must match the
number of variables and that the ith range may only depend on the first i1 variables. The
Sector has syntax,
Sector(obj,start,finish)
where obj is either a circle or ellipse. The start is the angle measure (in radians) of the
beginning point of the sector and finish is the angle measure (in radians) of the ending
point of the sector. The Sphere has syntax,
Sphere(center,radius)

129

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

where center is the center of the sphere given as a vector and radius is the radius of the
sphere. The Tetrahedron has syntax,
Tetrahedron(v1,v2,v3,v4)
where v1, v2, v3 and v4 are three-dimensional vectors representing the vertices. The
Triangle has syntax,
Triangle(v1,v2,v3)
where v1, v2 and v3 are two-dimensional vectors representing the vertices. For example,
> with(VectorCalculus):
Warning, the assigned names <,> and <|> now have a global binding
Warning, these protected names have been redefined and unprotected: *,
+, ., Vector, diff, int, limit, series

> int( x*y, [x,y] = Triangle( <0,0>, <1,0>, <0,1> ) );


1
24
> int( x+y+sin(z), [x,y,z] = Sphere(<1,0,Pi>,Pi/2) );
4
6
> int( x^2+y^2, [x,y] = Circle( <0,0>, r ) );
r4
2
> int( sin(x)*cos(y)+z, [x,y,z] = Parallelepiped( 0..Pi/2,
0..Pi, 0..2 ) );
2
> int( x^2+y^2, [x,y] = Rectangle( 1..5, 1..3 ) );
352
3
> int( 1, [x,y] = Region( 0..1, x^2..sqrt(x) ) );
1
3
> int( x+y+z, [x,y,z] = Tetrahedron( <0,0,0>, <4,0,0>,
<0,2,3>, <0,0,7> ) );
112
3
> int( x^10*y^2, [x,y] = Ellipse( x^2/2 + y^2/3 - 1 ) );

130

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

9 2
32

> int( y^2, [x,y] = Sector( Circle( <0,0>, 4 ), 0, Pi/2 ) );


16
> int( x, [x,y] = Sector( Ellipse( x^2 + y^2/9 - 1 ), 0,
Pi/2 ) );
1
You can also use int to find the integral of a vector-valued function.
> int( <t,t^2,t^3>, t );
t2
t3
t4
e + e + e
2 x 3 y 4 z
The int command may also be used to find the integral of a vector field. For example,
> SetCoordinates( 'cartesian'[x,y,z] );
cartesianx, y, z
> F:=VectorField(<cos(x),sin(y),z>);
F := cos( x ) e + sin ( y ) e + z e
x
y
z
> int(F,x=0..Pi);

> int(F,y=-Pi..Pi);

sin ( y ) e + z e
y
z
2 cos( x ) e + 2 z e
x
z

> int(F,z=0..1);
1
cos( x ) e + sin ( y ) e + e
y 2 z
x
> int(int(int(F,x=0..Pi),y=-Pi..0),z=0..2);
4 e + 2 2 e
y
z

The Jacobian Command


The Jacobian command will return the Jacobian matrix of a list or vector of functions.
The syntax for the Jacobian command is

131

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

Jacobian(expr,vars,det)
where expr is the list or vector of vectors, vars is a list of variables and an optional
argument det which is input as 'determinant' and will force the evaluation of the
determinant. If the det argument is not present the command will return just the Jacobian
matrix. For example,
> with(VectorCalculus):
Warning, the assigned names <,> and <|> now have a global binding
Warning, these protected names have been redefined and unprotected: *,
+, ., Vector, diff, int, limit, series

> Jacobian([r*cos(t),r*sin(t)],[r,t]);
cos( t ) r sin( t )

sin( t ) r cos( t )
> Jacobian([r*cos(t),r*sin(t)],[r,t],'determinant');
cos( t ) r sin( t ), cos( t ) 2 r + r sin( t ) 2

sin( t ) r cos( t )
> (J,d):=Jacobian([r*cos(t),r*sin(t)],[r,t],'determinant');
cos( t ) r sin( t )
J, d :=
, cos( t ) 2 r + r sin( t ) 2
sin( t ) r cos( t )
> d;
cos( t )2 r + r sin ( t )2
> simplify(d);
r
> Jacobian(<r*cos(t),r*sin(t)>,[r,t],'determinant');
cos( t ) r sin( t ), cos( t ) 2 r + r sin( t ) 2

sin( t ) r cos( t )
> (J,d):=Jacobian(<r*sin(phi)*cos(theta),
r*sin(phi)*sin(theta),r*cos(phi)>,[r,phi,theta],
'determinant');
sin ( ) cos( ) r cos( ) cos( ) r sin ( ) sin ( )
J, d := sin ( ) sin ( ) r cos( ) sin ( ) r sin ( ) cos( ) , sin ( )3 cos( )2 r 2
cos( )

r sin ( )
0
+ sin ( )3 sin ( )2 r 2 + r 2 cos( )2 cos( )2 sin ( ) + r 2 cos( )2 sin ( )2 sin ( )
> d;
sin ( )3 cos( )2 r 2 + sin ( )3 sin ( )2 r 2 + r 2 cos( )2 cos( )2 sin ( )
+ r 2 cos( )2 sin ( )2 sin ( )
> simplify(d);

132

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

sin ( ) r 2
> (J,d):=Jacobian(<u+v,u-v>,[u,v],'determinant');
1 1
J, d :=
, -2
1 -1

The limit Command


The limit command works the same way here as it does outside the VectorCalculus
package. The syntax is
limit(expr,pt)
where expr is the vector-valued function we are finding the limit of and pt is the limit
point. For example,
> limit(<t^2,1/t>,t=2);
1
4e + e
x 2 y
> limit(<arctan(t),1/t,(t^2+1)/(t^2-1)>,t=infinity);

e +e
2 x
z

The LineInt Command


The LineInt command will find the line integral of a vector field over a specified path.
The syntax for the LineInt command is
LineInt(expr,path)
where expr is the vector field and path represents the path of the integral. The path must
use one of the following forms: Arc, Circle, Ellipse, Line, LineSegments, or Path. The
Arc has syntax,
Arc(obj,start,finish)
where obj is either a circle or ellipse. The start is the angle measure (in radians) of the
beginning point of the arc and finish is the angle measure (in radians) of the ending point
of the arc. The Circle has syntax,
Circle(center,radius)

133

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

where center is the center of the sphere given as a vector and radius is the radius of the
sphere. Note that the center must be a two-dimensional vector. The Ellipse has syntax,
Ellipse(eqn)
where eqn is the equation of the ellipse, in the form of eqn = 0. The Line has syntax,
Line(pt1,pt2)
where pt1 and pt2 are two points that represent the directed line segment from pt1 to pt2.
The LineSegments has syntax,
LineSegments(pt1,pt2,pt3,pt4,)
where pt1, pt2, pt3, pt4, are all points. The only points that are required are pt1 and
pt2. The path of integration will be the directed line segment from pt1 to pt2 followed by
the directed line segment from pt2 to pt3, then pt3 to pt4 and so on. The Path has syntax,
Path(expr,rng)
where expr is the vector-valued function that represents a general path and rng is the
range of the parameter. For example,
> with(VectorCalculus):
Warning, the assigned names <,> and <|> now have a global binding
Warning, these protected names have been redefined and unprotected: *,
+, ., Vector, diff, int, limit, series

> SetCoordinates(cartesian[x,y]);
cartesianx, y
> F:=VectorField(<x^2,y>);
F := x2 e + y e
x
y
> LineInt(F,Line(<1,2>,<3,-4>));
44
3
> LineInt(F,LineSegments(<0,0>,<1,1>,<1,-1>));
5
6
> F:=VectorField(<x^2,y^2>);
F := x2 e + y2 e
x
y
> LineInt(F,Path(<t,t^4>,t=0..5));

134

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

81380250
> F:=VectorField(<-y,x>);
F := y e + x e
x
y
> LineInt(F,Circle(<0,0>,r));
2 r2
> LineInt(F,Ellipse(x^2/4+y^2/9-1));
12
> LineInt(F,Arc(Circle(<0,0>,r),0,Pi));
r2
> LineInt(F,Arc(Ellipse(x^2/4+y^2/9-1),0,Pi/2));
3

The PathInt Command


The PathInt command will find the path integral of a function over a specified path. The
syntax for the PathInt command is
PathInt(expr,path)
where expr is the function and path represents the path of the integral. The path must
have the form vars=obj where vars is a list of variables and obj is one of the following
objects: Arc, Circle, Ellipse, Line, LineSegments, or Path. The Arc has syntax,
Arc(obj,start,finish)
where obj is either a circle or ellipse. The start is the angle measure (in radians) of the
beginning point of the arc and finish is the angle measure (in radians) of the ending point
of the arc. The Circle has syntax,
Circle(center,radius)
where center is the center of the sphere given as a vector and radius is the radius of the
sphere. Note that the center must be a two-dimensional vector. The Ellipse has syntax,
Ellipse(eqn)
where eqn is the equation of the ellipse, in the form of eqn = 0. The Line has syntax,
Line(pt1,pt2)

135

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

where pt1 and pt2 are two points that represent the directed line segment from pt1 to pt2.
The LineSegments has syntax,
LineSegments(pt1,pt2,pt3,pt4,)
where pt1, pt2, pt3, pt4, are all points. The only points that are required are pt1 and
pt2. The path of integration will be the directed line segment from pt1 to pt2 followed by
the directed line segment from pt2 to pt3, then pt3 to pt4 and so on. The Path has syntax,
Path(expr,rng)
where expr is the vector-valued function that represents a general path and rng is the
range of the parameter. For example,
> with(VectorCalculus):
Warning, the assigned names <,> and <|> now have a global binding
Warning, these protected names have been redefined and unprotected: *,
+, ., Vector, diff, int, limit, series

> SetCoordinates(cartesian[x,y]);
cartesianx, y
> f:=(x,y)->x^2+y;
f := ( x, y ) VectorCalculus:-`+`( x 2, y )
> PathInt(f(x,y),[x,y]=Line(<1,2>,<3,-4>));
20 10
3
> PathInt(f(x,y),[x,y]=LineSegments(<0,0>,<1,1>,<1,-1>));
5 2
+2
6
> PathInt(f(x,y),[x,y]=Path(<t,t^2>,t=0..2));
33 17
1
+
ln( 4 + 17 )
8
32
> PathInt(f(x,y),[x,y]=Circle(<0,0>,2));
8
> PathInt(f(x,y),[x,y]=Ellipse(x^2+y^2/3-1));
2
6 10
6
3 EllipticK
+
3 EllipticE

3
3 3
3
1
1
1

2 3 ln ( 2 ) +
3 ln ( 5 2 4 3 )
2
4
8

1
1
1

2
3 ln( 2 )
3 ln( 5 2 4 3 )
2
8
4

136

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> evalf(%);
4.938620310
> PathInt(f(x,y),[x,y]=Arc(Circle(<0,0>,1),0,Pi/2));

+1
4
> PathInt(x,[x,y]=Arc(Ellipse(x^2+y^2/2-1),0,Pi/2));
1
+
2 4

The PrincipalNormal Command


The PrincipalNormal command will find a vector in the direction of the normal vector to
a curve. Note that this vector is not necessarily a unit vector. To acquire the unit normal
vector use the TNBFrame command. The syntax for the PrincipalNormal command is
PrincipalNormal(expr,var)
where expr is the vector-valued function and var is the parameter variable. Note that var
can be omitted if there is only one variable in the expr. For example,
> with(VectorCalculus):
Warning, the assigned names <,> and <|> now have a global binding
Warning, these protected names have been redefined and unprotected: *,
+, ., Vector, diff, int, limit, series

> PrincipalNormal(<cos(t),sin(t)>,t);
cos( t ) e sin( t ) e
x
y
> PrincipalNormal(<cos(t),sin(t)>);
cos( t ) e sin( t ) e
x
y
> PrincipalNormal(<cos(t),sin(t),t>,t);
1
1
2 cos( t ) e
2 sin ( t ) e
2
x 2
y
> PrincipalNormal(<cos(t),sin(t),t>);
1
1
2 cos( t ) e
2 sin ( t ) e
2
x 2
y
> PrincipalNormal(<t,t^2,t^3>);

137

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

8 t + 36 t 3

t ( 8 t + 36 t 3 )

+
e
+

( 3/2 )
( 3/2 )
2
4
x
2
4
2 (1 + 4 t + 9 t )
(1 + 4 t + 9 t )
3 t 2 ( 8 t + 36 t 3 )
6t

+
e

( 3/2 )
2
4

2
4
z
1
+
4
t
+
9
t
2 (1 + 4 t + 9 t )

e +
1+4t +9t y

> simplify(%);
2 t ( 2 + 9 t2 )
2 ( 9 t4 1 )
6 t ( 2 t2 + 1 )

e
+
e
( 3/2 )
( 3/2 )
( 3/2 )
2
4
2
4
2
4
x
y
z
(1 + 4 t + 9 t )
(1 + 4 t + 9 t )
(1 + 4 t + 9 t )

The RadiusOfCurvature Command


The RadiusOfCurvature command will find the formula for the radius of curvature of a
curve. The syntax for the RadiusOfCurvature command is
RadiusOfCurvature(expr,var)
where expr is the vector-valued function and var is the parameter variable. Note that var
can be omitted if there is only one variable in the expr. For example,
> with(VectorCalculus):
Warning, the assigned names <,> and <|> now have a global binding
Warning, these protected names have been redefined and unprotected: *,
+, ., Vector, diff, int, limit, series

> RadiusOfCurvature(<cos(t),sin(t)>,t);
1
> RadiusOfCurvature(<cos(t),sin(t),t>,t);
2
> RadiusOfCurvature(<cos(t),sin(t),t>);
2
> RadiusOfCurvature(<t,t^2,t^3>);
1 + 4 t2 + 9 t4
2

9 t4 + 9 t2 + 1
( 1 + 4 t2 + 9 t4 )

> RadiusOfCurvature(<t,2*t,3*t>);

138

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

The ScalarPotential Command


The ScalarPotential command will find the potential function to a vector field if one
exists. The syntax for the ScalarPotential command is
ScalarPotential(expr)
where expr is the vector field. For example,
> with(VectorCalculus):
Warning, the assigned names <,> and <|> now have a global binding
Warning, these protected names have been redefined and unprotected: *,
+, ., Vector, diff, int, limit, series

> SetCoordinates(cartesian[x,y,z]);
cartesianx, y, z
> F:=VectorField(<x,y^2,z^3>);
F := x e + y2 e + z 3 e
x
y
z
> ScalarPotential(F);
x2 y3 z 4
+
+
2
3
4
> F:=VectorField(<6*x*sin(y)+z^x*ln(z),3*x^2*cos(y),
z^x*x/z>);
zx x
e
F := ( 6 x sin ( y ) + z x ln ( z ) ) e + 3 x2 cos( y ) e +
z z
x
y
> ScalarPotential(F);
3 x 2 sin ( y ) + z x
> Del(3*x^2*sin(y)+z^x);
zx x
( 6 x sin ( y ) + z x ln ( z ) ) e + 3 x2 cos( y ) e +
e
z z
x
y
> F:=VectorField(<x^2*sin(y),z*cos(x),z^2>);
F := x2 sin ( y ) e + z cos( x ) e + z 2 e
x
y
z
> ScalarPotential(F);

139

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

The SurfaceInt Command


The SurfaceInt command computes the surface integral function over a specified surface.
The general syntax for the Flux command is,
Flux(expr,surface)
where expr is a function and surface is a surface object. The surface can be either a Box,
Sphere or Surface. The Box surface has syntax
Box(xrng,yrng,zrng)
where xrng, yrng and zrng are the face limits of the box. The Sphere surface has syntax,
Sphere(center,radius)
where center is the center of the sphere given as a vector and radius is the radius of the
sphere. The syntax for the Surface surface is
Surface(v,paramrngs)
where v is the vector formula for the surface and paramrngs are the ranges of the
parameters that trace out the surface. For example,
> with(VectorCalculus):
Warning, the assigned names <,> and <|> now have a global binding
Warning, these protected names have been redefined and unprotected: *,
+, ., Vector, diff, int, limit, series

> SurfaceInt(x^2+y^2+z^2,[x,y,z]=Surface(<s,t,2*s-t>,
[s,t]=Triangle(<0,0>,<2,0>,<0,1>)));
3 6
> SurfaceInt(y^2,[x,y,z]=Sphere(<0,0,0>,3));
108
> SurfaceInt(x*y*z,[x,y,z]=Box(1..2,3..4,5..6));
693
4

The TNBFrame Command


The TNBFrame command computes the unit tangent, normal and binormal vectors to a
curve. The syntax for the TNBFrame command is
140

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

TNBFrame(expr,var,out)
where expr is the curve, var is the parameter for the curve. The out argument is optional
and has the form output=[T] where T can be replaced by B or N or a list of these. The
out specifies the desired vectors in the output. If the out is absent the output will be all
three vectors. For example,
> with(VectorCalculus):
Warning, the assigned names <,> and <|> now have a global binding
Warning, these protected names have been redefined and unprotected: *,
+, ., Vector, diff, int, limit, series

> TNBFrame(<sin(t),cos(t),t>,t);
1
1
2
2 cos( t ) e
2 sin ( t ) e +
e , sin ( t ) e cos( t ) e ,
2
2 z
x 2
y
x
y
1
1
1
1
2 cos( t ) e
2 sin ( t ) e + 2 cos( t )2
2 sin ( t )2 e
2
2
x 2
y 2
z
> TNBFrame(<sin(t),cos(t),t>,t,'output'=['T']);
1
1
2
2 cos( t ) e
2 sin ( t ) e +
e
2
2 z
x 2
y
> TNBFrame(<sin(t),cos(t),t>,t,'output'=['N']);
sin( t ) e cos( t ) e
x
y
> TNBFrame(<sin(t),cos(t),t>,t,'output'=['B']);
1
1
1
1
2 cos( t ) e
2 sin ( t ) e + 2 cos( t )2
2 sin ( t )2 e
2
2
x 2
y 2
z
> TNBFrame(<sin(t),cos(t),t>,t,'output'=['T','B']);
1
1
2
2 cos( t ) e
2 sin ( t ) e +
e ,
2
2 z
x 2
y
1
1
1
1
2 cos( t ) e
2 sin ( t ) e + 2 cos( t )2
2 sin ( t )2 e
2
2
2
2
x
y
z
> sqrt(add((TNBFrame(<sin(t),cos(t),t>,t,
'output'=['T'])[i])^2,i=1..3));
1
2 + 2 sin( t ) 2 + 2 cos( t )2
2
> simplify(%);
1
> simplify(sqrt(add((TNBFrame(<sin(t),cos(t),t>,t,
'output'=['N'])[i])^2,i=1..3)));
141

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

1
> simplify(sqrt(add((TNBFrame(<sin(t),cos(t),t>,t,
'output'=['B'])[i])^2,i=1..3)));
1

The TangentLine Command


The TangentLine command computes the tangent line to a curve at a specified point. The
syntax for the TangentLine command is
TangentLine(expr,pos)
where expr is the curve and pos is the position of the tangent line. For example,
> with(VectorCalculus):
Warning, the assigned names <,> and <|> now have a global binding
Warning, these protected names have been redefined and unprotected: *,
+, ., Vector, diff, int, limit, series

> TangentLine(<t,t^3,sqrt(t)>,t=3);
t 3

e
( 3 + t ) e + ( 27 + 27 t ) e + 3 +
6 z
x
y
> TangentLine(<sin(t),cos(t),sin(cos(t))>,t=Pi/2);
e te te
x
y
z
> TangentLine(<sin(t),cos(t),sin(cos(t))>,t=a);
( sin ( a ) + t cos( a ) ) e + ( cos( a ) t sin ( a ) ) e +
x
y
( sin ( cos( a ) ) t cos( cos( a ) ) sin ( a ) ) e
z

The TangentPlane Command


The TangentPlane command produces the vector form of the equation of a tangent plane
to a surface at a specified point. The syntax for the TangentPlane command is
TangentLine(expr,pos)
where expr is the vector form of the surface and pos is the position of the tangent plane.
For example,

142

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> with(VectorCalculus):
Warning, the assigned names <,> and <|> now have a global binding
Warning, these protected names have been redefined and unprotected: *,
+, ., Vector, diff, int, limit, series

> TangentPlane(<s,t,s^2+t^2>,s=a,t=b);
( a + s ) e + ( b + t ) e + ( a 2 + b2 + 2 s a + 2 t b ) e
x
y
z
> TangentPlane(<s,t,s^2-t^2>,s=0,t=0);
se +te
x
y
> TangentPlane(<s,t,s^2-t^2>,s=1,t=1);
(1 + s) e + (1 + t) e + (2 s 2 t) e
x
y
z
> TangentPlane(<s^2,t^3,s+t>,s=a,t=b);
( a 2 + 2 s a ) e + ( b3 + 3 t b2 ) e + ( a + b + s + t ) e
x
y
z

The TangentVector Command


The TangentVector command will find a vector in the direction of the tangent vector to a
curve. Note that this vector is not necessarily a unit vector. To acquire the unit tangent
vector use the TNBFrame command. The syntax for the TangentVector command is
TangentVector(expr,var)
where expr is the vector-valued function and var is the parameter variable. Note that var
can be omitted if there is only one variable in the expr. For example,
> with(VectorCalculus):
Warning, the assigned names <,> and <|> now have a global binding
Warning, these protected names have been redefined and unprotected: *,
+, ., Vector, diff, int, limit, series

> TangentVector(<t,t^2,t^3>,t);
e + 2 t e + 3 t2 e
x
y
z
> TangentVector(<sin(t),cos(t),t>,t);
cos( t ) e sin( t ) e + e
x
y
z
> TangentVector(<t^2,t^3>,t);

143

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

2 t e + 3 t2 e
x
y
> TangentVector(<t,t^2,t^3>);
e + 2 t e + 3 t2 e
x
y
z
> TangentVector(<sin(t),cos(t),t>);
cos( t ) e sin( t ) e + e
x
y
z
> TangentVector(<t^2,t^3>);
2 t e + 3 t2 e
x
y
> TangentVector(<a*t^2,b*t^3>);
Error, (in VectorCalculus:-TangentVector) could not determine unique
indeterminate: {a, b, t}

The Torsion Command


The Torsion command calculates the torsion of a curve in R3. The syntax of the Torsion
command is,
Torsion(expr,var)
where expr is the vector-valued function and var is the parameter. For example,
> with(VectorCalculus):
Warning, the assigned names <,> and <|> now have a global binding
Warning, these protected names have been redefined and unprotected: *,
+, ., Vector, diff, int, limit, series

> Torsion(<sin(t),cos(t),t>,t);
1
2 sin( t ) 2 + 2 cos( t ) 2 2
4
> simplify(%);
1
2

> simplify(Torsion(<sin(t)+cos(t),cos(t)-sin(t),ln(t)>,t));
( 2 t2 + 1 ) ( t2 + 2 )
( 1 + t2 + 2 t4 )
2 t2 + 1
t2

144

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> simplify(Torsion(<sin(t)+cos(t),cos(t)-sin(t),t^2>,t));
t2 ( 2 t2 + 1 )
2
2
( 3 + 2 t2 )
4 t2 + 2
> tc:=unapply(%,t);
t2 ( 2 t2 + 1 )

( 3 + 2 t2 )

tc := t

4 t2 + 2

> tc(2);
2

36 121
2178

18

> tc(100);
2

200010000 400120009 40002


16005600600018

> limit(tc(t),t=infinity);
0

The VectorPotential Command


The VectorPotential command will find the vector potential function to a vector field if
one exists. The syntax for the VectorPotential command is
VectorPotential(expr)
where expr is the vector field. For example,
> with(VectorCalculus):
Warning, the assigned names <,> and <|> now have a global binding
Warning, these protected names have been redefined and unprotected: *,
+, ., Vector, diff, int, limit, series

> SetCoordinates(cartesian[x,y,z]);
cartesianx, y, z
> F:=VectorField(<y,-x,0>);
F := y e x e
x
y
> VectorPotential(F);

145

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

x z e y z e
x
y
> Curl(%);

ye xe
x
y

> VectorPotential(VectorField(<-y,-z,-x>));
z 2

2 + x y e + y z e
x
y
> Curl(%);

y e z e x e
x
y
z

The plots Package


The plots package has many commands for advanced plotting. The plots package can be
loaded using the command
with(plots):
The commands that are loaded are: animate, animate3d, animatecurve, arrow,
changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot,
contourplot3d, coordplot, coordplot3d, cylinderplot, densityplot, display, display3d,
fieldplot, fieldplot3d, gradplot, gradplot3d, graphplot3d, implicitplot, implicitplot3d,
inequal, interactive, listcontplot, listcontplot3d, listdensityplot, listplot, listplot3d,
loglogplot, logplot, matrixplot, odeplot, pareto, plotcompare, pointplot, pointplot3d,
polarplot, polygonplot, polygonplot3d, polyhedra_supported, polyhedraplot, replot,
rootlocus, semilogplot, setoptions, setoptions3d, spacecurve, sparsematrixplot,
sphereplot, surfdata, textplot, textplot3d, tubeplot.
The main commands from this package that are used in a Calculus sequence are:
arrow, contourplot, cylinderplot, display, fieldplot, fieldplot3d, gradplot, gradplot3d,
implicitplot, implicitplot3d, loglogplot, logplot, polarplot, spacecurve and sphereplot.
Each of these commands is discussed in detail in other sections of this guide.

The plottools Package


The plottools package has many commands for specialized plots. Most of these
commands do not apply to Calculus but there are some that do. The plottools package
can be loaded using the command
with(plottools):

146

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

The commands that are loaded are: arc, arrow, circle, cone, cuboid, curve, cutin, cutout,
cylinder, disk, dodecahedron, ellipse, ellipticArc, hemisphere, hexahedron, homothety,
hyperbola, icosahedron, line, octahedron, pieslice, point, polygon, project, rectangle,
reflect, rotate, scale, semitorus, sphere, stellate, tetrahedron, torus, transform, translate,
vrml. The plottools package is mainly for the study of planer and solid geometry. Since
this guide is primarily for the Calculus sequence we will look at a couple of the
commands that pertain to Calculus.
As for visualizing situations in Calculus the two commands worth mentioning are
rectangle and cubiod. These two commands can help create images of Riemann sums in
both two and three dimension. For example,
> with(plots):
Warning, the name changecoords has been redefined

> with(plottools):
Warning, the name arrow has been redefined

> f:=x->x*sin(x);

f := x x sin ( x )

> display(plot(f(x),x=-4..4,y=-1..2),seq(rectangle([3+6*i/25,0],[-3+6*(i+1)/25,evalf(f(3+6*i/25))],color=yellow),i=0..24));

> display(plot(f(x),x=-4..4,y=-1..2),seq(rectangle([3+6*i/50,0],[-3+6*(i+1)/50,evalf(f(3+6*i/50))],color=yellow),i=0..49));

147

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

Note that we needed the plots package for the display command. If we want to visualize
Riemann sums in three dimensions we need the plottools package. In the
Student[Calculus1] package there are commands for producing two-dimensional left,
right, midpoint, lower and upper Riemann sum images. Maple does not have built-in
commands to find the three dimensional analogs to these. So if you want images of
Riemann sums in three dimensions you need to create them from scratch. For example,
the following display command plots a grid of 25 by 25 rectangular solids representing a
Riemann sum.
> with(plots):
Warning, the name changecoords has been redefined

> with(plottools):
Warning, the name arrow has been redefined

> f:=(x,y)->x*sin(y)+y*sin(x+y);
f := ( x, y ) x sin ( y ) + y sin ( x + y )
> display(plot3d(f(x,y),x=-2..2,y=-2..2,axes=boxed),
seq(seq(cuboid([-2+4*i/25,-2+4*j/25,0],[-2+4*(i+1)/25,2+4*(j+1)/25,evalf(f(-2+4*i/25,-2+4*j/25))],color=yellow),
i=0..24),j=0..24));

If you would like a little bit of a challenge read through the next command definition and
determine what it does.
> plotRS3dMP:=(f,xrng,yrng,xdiv,ydiv,boxcolor)->
display(plot3d(f,xrng,yrng,seq(args[n],n=7..nargs)),seq(seq
(cuboid([lhs(rhs(xrng))+(rhs(rhs(xrng))-lhs(rhs(xrng)))*
i/xdiv,lhs(rhs(yrng))+(rhs(rhs(yrng))-lhs(rhs(yrng)))*
j/ydiv,0],[lhs(rhs(xrng))+(rhs(rhs(xrng))-lhs(rhs(xrng)))*
(i+1)/xdiv,lhs(rhs(yrng))+(rhs(rhs(yrng))-lhs(rhs(yrng)))*
(j+1)/ydiv,evalf(subs(lhs(xrng)=(lhs(rhs(xrng))+
(rhs(rhs(xrng))-lhs(rhs(xrng)))*i/xdiv+lhs(rhs(xrng))+
(rhs(rhs(xrng))-lhs(rhs(xrng)))*(i+1)/xdiv)/2,lhs(yrng)=
(lhs(rhs(yrng))+(rhs(rhs(yrng))-lhs(rhs(yrng)))*j/ydiv+
lhs(rhs(yrng))+(rhs(rhs(yrng))-lhs(rhs(yrng)))*

148

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

(j+1)/ydiv)/2, f))],color=boxcolor),i=0..xdiv-1),
j=0..ydiv-1)):
The next statement uses this new command.
> plotRS3dMP(f(x,y),x=-5..5,y=-5..5,30,30,yellow,
axes=boxed);

149

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

Animation
Maple has a very nice feature that allow you to create a sequence of images and paste
them together to create an animation. The plots package has three built-in commands,
animate, animate3d, and animatecurve, which make the process of creating animations
easier. Unfortunately these commands are very limited. Creating an animation from
scratch is not very difficult and it allows you to have complete control over the type of
animation that is created. The basic idea is to create a sequence of plots, usually with the
seq command and any of the plotting commands, then place these plots in a display
command that has the option insequence=true. Since the display command is in the plots
package make sure you load the package into your worksheet.
> with(plots):
Warning, the name changecoords has been redefined

Consider the following command,


> display(seq(plot(sin(n*x),x=-5..5),n=1..10),
insequence=true);
The plots are all of the sin (nx ) on the range 5..5. Since the seq command is being used
with n=1..10 the n in the expression sin (nx ) takes on the values 1, 2, 3, , 10. Hence we
have 10 plots each with increasing n. This list of 10 plots is then placed in order and
pasted together with the display command. The result is an animation that goes between
the following two images.

In the following animation we are graphing left Riemann sums using 10 to 100
rectangles. Hence we are generating 91 images and pasting them together in an
animation. Since the leftbox command is in the student package we need to load it into
our worksheet.
> with(student):

150

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> display(seq(leftbox(sin(x)+cos(x), x=0..2*Pi, n),


n=10..100),insequence=true);
The result is an animation that adds one rectangle at each step to the image of the
Riemann sum. That is it goes in between the following two images.

As you can see, animations are relatively simple to create. Place a general plot in a seq
and place all of that in a display. As with anything in Maple we can create new functions
that allow us to do more complicated animations by using a simple command. For
example, say we load the VectorCalculus package,
> with(VectorCalculus):
Warning, the assigned names <,> and <|> now have a global binding
Warning, these protected names have been redefined and unprotected: *,
+, ., Vector, diff, int, limit, series

And then create the following three procedures.


> plotvvfT1:= proc(r,rng,pos,vcol)
> display(spacecurve([seq(r[n],n=1..3)],rng,seq(args[n],
n=5..nargs)),arrow(unapply(r,lhs(rng))(pos),
unapply(TNBFrame(r,lhs(rng))[1],lhs(rng))(pos),shape=arrow,
color=vcol));
> end proc:
> plotvvfTanmseq:= proc(r,rng,numfrms,vcol)
> seq(plotvvfT1(r,rng,lhs(rhs(rng))+(rhs(rhs(rng))lhs(rhs(rng)))*n/numfrms,vcol,seq(args[n],n=5..nargs)),
n=0..numfrms);
> end proc:
> plotvvfTanm:= proc(r,rng,numfrms,vcol)

151

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

> display(plotvvfTanmseq(r,rng,numfrms,vcol,seq(args[n],
n=5..nargs)),insequence=true);
> end proc:
These procedures will take a vector-valued function, graph it along with its unit tangent
vector and animate this as the unit tangent vector moves along the curve. To use them we
simply define the vector-valued function.
> r:=t-><cos(t),sin(t),t>;
r := t VectorCalculus:-`<,>`( cos( t ), sin ( t ), t )
Then to graph the curve from 0 to 15 using 20 frames in the animation with the curve
graphed in black and the vector in red, requires only.
> plotvvfTanm(r(t),t=0..15,20,red,color=black);

152

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

Using Maple Help


The Maple help system is quite different from other help systems you may have used.
This can make it very frustrating at first when you want to find something. In fact, the
most frustrating part of the help system is its lack of a search mechanism. We have found
that once you know a little about the Maple program the help system becomes easier to
use since you have more of an idea of what to look for. There are two main ways to
invoke the help system. One is by selecting Help > Introduction from the menu. This
will bring up the help system beginning at the Maple introduction, as below.

Notice the 5 panels across the top. These are subtopic panels. If you select an option that
has subtopics the subtopic listing will be displayed in the panel directly to the right. So
you keep selecting subtopics until you get to a topic that does not have a subtopic listing
and then help text will be displayed in the window below the panels. The help text
usually starts out with a statement of general syntax, followed by a list of options for the
command, followed by examples and ending with links to related topics. For example,
the help image below is for the solve command. Note that we went all the way down to
the fourth panel before we found the help we needed. This is another reason the Maple
help system is frustrating at first, you need to have an idea where the command fits in the
scheme of Maple if you have any hope of finding it. This is also why the help system

153

A Guide to Maple 8 & 9 Commands for Calculus I, II & III

gets much easier to use after you have a little experience with Maple. At that point you
will have a better idea where commands are located.

Another way to invoke the help system is by using the ? command in the worksheet.
That is, at any time you can type in ? followed by the name of the command you want to
look up and press enter (no semicolon needed). This will automatically search for the
command in the help system and send you directly to the page for that command. The
unfortunate thing here is that you need to know the name of the command. For example,
the above screen was obtained by the command,
?solve

154

Você também pode gostar