You are on page 1of 31

Scientic WorkPlace Demonstration Document

Roger Hunter and Fred Richman and John Thomas and Elbert Walker
Contents
1 Introduction 3
2 Getting Started 3
2.1 Where to Place the Insertion Point . . . . . 3
2.2 How Scientic WorkPlace Selects an Ex-
pression . . . . . . . . . . . . . . . . . . . . 3
2.3 Selecting Expressions for Operations . . . . 4
2.4 A Keyboard Shortcut for Evaluate . . . . . 4
2.5 Stopping a Computation . . . . . . . . . . . 4
2.6 The Settings Menu . . . . . . . . . . . . . . 4
3 Working with Expressions and Functions 5
3.1 The Slash Operator (/) . . . . . . . . . . . 5
3.2 Standard Mathematical Functions . . . . . 6
3.3 More Operations . . . . . . . . . . . . . . . 7
3.4 Some Special Operations and Commands . 7
3.5 Constants . . . . . . . . . . . . . . . . . . . 8
3.6 Polynomials . . . . . . . . . . . . . . . . . . 8
3.7 Limits . . . . . . . . . . . . . . . . . . . . . 9
3.8 Dierentiation . . . . . . . . . . . . . . . . 9
3.9 Indenite Integration . . . . . . . . . . . . . 9
3.10 Sequences of Operations . . . . . . . . . . . 10
3.11 Denite Integrals . . . . . . . . . . . . . . . 10
3.12 Numerical Integration . . . . . . . . . . . . 11
3.13 Innite Series . . . . . . . . . . . . . . . . . 11
3.14 Substituting a Value into an Expression . . 11
4 Matrices 11
4.1 Standard Operations . . . . . . . . . . . . . 11
4.2 The Matrices Submenu . . . . . . . . . . . . 12
5 Solving Systems of Equations 13
5.1 Solve Exact . . . . . . . . . . . . . . . . . . 13
5.2 Solve Numeric . . . . . . . . . . . . . . . . . 14
5.3 Solve Integer . . . . . . . . . . . . . . . . . 14
5.4 Solve Recursion . . . . . . . . . . . . . . . . 14
6 Modular Arithmetic 14
6.1 The Integers modulo : . . . . . . . . . . . 14
6.2 Matrices Modulo : . . . . . . . . . . . . . . 15
6.3 Polynomials Modulo : . . . . . . . . . . . . 15
6.4 Polynomials Modulo Polynomials . . . . . 15
7 Denitions 15
7.1 New Denition, Undene, Show Deni-
tions, and Clear Denitions . . . . . . . . . 15
7.2 Denitions with Deferred Evaluation . . . . 18
7.3 Remembering Solutions . . . . . . . . . . . 18
7.4 Save Denitions & Restore Denitions . . . 18
7.5 Functions of Several Variables . . . . . . . . 18
7.6 Row and Column Arguments . . . . . . . . 18
7.7 Matrix Valued Functions . . . . . . . . . . . 19
7.8 Piecewise-Dened Functions . . . . . . . . . 19
7.9 Access to Other Maple Functions . . . . . . 19
7.10 User Dened Maple Functions . . . . . . . . 19
8 2D Plots 20
8.1 Frame Properties Dialog Box . . . . . . . . . 20
8.2 Plotting More than one Function at a Time . 20
8.3 Plot Components Page . . . . . . . . . . . . 21
8.4 Axes & View Page . . . . . . . . . . . . . . . 21
8.5 Plotting Points . . . . . . . . . . . . . . . . . 21
8.6 Conformal Plots . . . . . . . . . . . . . . . . 21
8.7 Plots of Vector and Gradient Fields . . . . . . 21
8.8 Parametric Equations . . . . . . . . . . . . . 22
8.9 Implicit Equations . . . . . . . . . . . . . . . 22
8.10 Polar Coordinates . . . . . . . . . . . . . . . 22
8.11 Parametric Polar Plots . . . . . . . . . . . . 22
9 3D Plots 22
9.1 Plotting Tools for 3D Plots . . . . . . . . . . 22
9.2 Implicit Functions . . . . . . . . . . . . . . . 23
9.3 Parameterized Surfaces . . . . . . . . . . . . 23
9.4 Curves in Space . . . . . . . . . . . . . . . . 23
9.5 Cylindrical Coordinates . . . . . . . . . . . . 23
9.6 Parameterized Surfaces in Cylindrical Coordi-
nates . . . . . . . . . . . . . . . . . . . . . . 24
9.7 Spherical Coordinates . . . . . . . . . . . . . 24
9.8 Parameterized Surfaces in Spherical Coordinates 24
9.9 Exercises . . . . . . . . . . . . . . . . . . . . 24
9.10 Solutions to Exercises . . . . . . . . . . . . . 24
10 Calculus 25
10.1 Implicit Dierentiation . . . . . . . . . . . . 25
10.2 Iterate . . . . . . . . . . . . . . . . . . . . . 25
10.3 Find Extrema . . . . . . . . . . . . . . . . . 25
10.4 Methods of Integration . . . . . . . . . . . . 26
10.5 Pictures of Riemann Sums . . . . . . . . . . 26
10.6 Approximation Methods . . . . . . . . . . . . 26
11 Dierential Equations 27
11.1 Exact Methods . . . . . . . . . . . . . . . . . 27
11.2 Initial Value Problems . . . . . . . . . . . . . 27
12 Vector Calculus 28
12.1 Dot and Cross Products . . . . . . . . . . . . 28
12.2 Vector Norms . . . . . . . . . . . . . . . . . 29
12.3 Gradient, Divergence and Curl . . . . . . . . 29
12.4 Hessian . . . . . . . . . . . . . . . . . . . . . 29
12.5 Jacobian . . . . . . . . . . . . . . . . . . . . 29
2
12.6 Curl and Vector Potential . . . . . . . . . . . 30
12.7 Divergence . . . . . . . . . . . . . . . . . . 30
13 Statistics 30
13.1 Lists and Matrices . . . . . . . . . . . . . . 30
13.2 Mean, Median, Mode, Moment, Quantile,
Mean Deviation, Standard Deviation, and
Variance . . . . . . . . . . . . . . . . . . . . 30
13.3 Correlation and Covariance . . . . . . . . . . 31
13.4 Random Numbers . . . . . . . . . . . . . . . 31
13.5 Distributions and Densities . . . . . . . . . . 31
Introduction
The work on this interface between Scientic Word and
Maple was supported by a National Science Foundation
SBIR (Small Business Innovation Research) grant. The
goal is to provide an interface which:
1. Uses natural mathematical notation only, and
2. Uses free-form editing.
Scientic Word's interface satises both criteria. All
of the signicant problems arise from the free-form require-
ment. Maple and Mathematica both have notebook sys-
tems which use the natural form for output, but which
insist upon complete, syntactically correct, mathematical
expressions, allowing the user only minimal variation in
ways to enter a given expression. We want to make sense
out of as many dierent forms as possible, not requiring
the user to adhere to a rigid syntax or just one way of writ-
ing an expression. For example, it is essential that both
_
Jr
r
and
_
1
r
dr be acceptable. The ease of use is further
enhanced by the acceptance of incomplete forms which are
often seen in the literature, such as
_
r
2
for
_
r
2
dr.
This implementation covers much of high school and
undergraduate level mathematics, and is a useful mathe-
matical tool. Also, it has great potential as a classroom
device and is being tested in this regard. The combina-
tion of a free form scientic word processor and compu-
tational package makes it a possible replacement for the
blackboard.
The system consisting of Scientic Word and its in-
terface to Maple is called Scientic WorkPlace. It is new
and dierent and we are very interested in receiving feed-
back from our users. Any suggestions or reactions would
be appreciated. Our address is
TCI Software Research
1190 Foster Road
Las Cruces, NM 88001
tel 505-522-4600
fax 505-522-0116
email support@tcisoft.com
Getting Started
The current system is described using a series of examples
that you can try. These examples range from trivial arith-
metic to advanced linear algebra. They include complete
computations and various pathologies and oddities. This
le is write protected so that computing in it won't mess
it up. And you can save it under some other name and
use the new le to play with. In any case, we suggest that
you print out a copy. Then you can nd quickly examples
and explanations of computations of various kinds, using
the table of contents. The document is loosely structured
around the Maple menu.
Before you start, check that the word Maple appears
on the menu at the top of the Scientic WorkPlace window
to the right of Tools. If not, your installation is incomplete.
We'll start with two examples of factoring.
Factoring a Number Place the insertion point within
the number 234567890 and from the Maple menu
choose Factor. Note that the answer is placed imme-
diately to the right, following an = sign. The result,
, 2 3
2
5 3803 3607, contains only where nec-
essary. The presence of the superscript following the
3 means that is not necessary before the following
5. Scientic WorkPlace automatically chooses integer
factorization.
Factoring a Polynomial Place the insertion point
within r
5
+7r
3
41r
4
j 41r
2
j +80r
3
j
2
+80rj
2

52j
3
r
2
52j
3
, =
_
r
2
+ 1
_
(7r 13j) (2j +r)
2
and
choose Factor from the Maple menu. Scientic Work-
Place automatically chooses polynomial factorization.
Where to Place the Insertion Point
Scientic WorkPlace shows mathematics in red. When
the insertion point is within mathematics, the Math/Text
icon at the top of the screen displays a red '. When we
say \place the insertion point in the following expression",
anywhere that shows the red ' is sucient. Valid posi-
tions are anywhere within, or immediately to the right of,
the expression. The position immediately to the left of the
expression is not valid.
Expand Place the insertion point in the expression r
2j)
2
(7r 13j)(r
2
+ 1) and from the Maple menu
choose xpand. You should get the polynomial in the
previous example r2j)
2
(7r13j)(r
2
+1) = 7r
5
+
7r
3
41r
4
j41r
2
j+80r
3
j
2
+80rj
2
52j
3
r
2
52j
3
,
of course.
How Scientic WorkPlace Selects an Expression
When you place the insertion point in a mathematical ex-
pression and choose an operation from the Maple menu,
Scientic WorkPlace automatically selects either the en-
tire expression, or the part containing the insertion point
which is enclosed between a combination of text and binary
relations, depending on the operation you chose. Here are
some examples that illustrate the various possibilities.
An Equation Place the insertion point anywhere within
the equation r + 3r = 1 and from the Maple menu
3
choose Solve + Exact. In this case, Scientic Work-
Place selected the entire expression. The solution
is not equal to the original expression, so Scientic
WorkPlace does not make it part of the original equa-
tion:
2r + 3r = 1, Solution is :
_
r =
1
5
_
Now place the insertion point in the left hand side of
the equation and from the Maple menu choose Evalu-
ate.
2r + 3r = 5r = 1
This time, Scientic WorkPlace selected only the left
hand side of the equation for evaluation. Notice too
that since the result of the evaluation was equal to
the original expression, the result was placed next to
the expression, preceded by an equals sign. The in-
sertion point is placed at the right end of the result
so that you can select another operation to apply to
the result without moving the insertion point.
Selecting Expressions for Operations
If you want to restrict the computation to a particu-
lar selection, or override Scientic WorkPlace's automatic
choice, you can use a selection. The next few examples
illustrate this feature. There are two options.
Operating on a Selection Use the mouse or the shift
and rrow keys to select (r + j)
5
in the expression
(r + j)
5
_
7r 13j
3
_
+ sin
2
r, from the Maple menu
choose Expand.
(r + j)
5
_
7r 13j
3
_
+ sin
2
r : r
5
+ 5r
4
j + 10r
3
j
2
+
10j
3
r
2
+ 5rj
4
+ j
5
Scientic WorkPlace puts the answer to the right of the
whole expression, following a colon (:). In general, ci-
entic WorkPlace assumes that the result of applying
an operation to a selection is not equal to the entire
original expression and so it places the result at the
end of the mathematics, separated by something (in
this case a colon) in text.
Replacing a Selection Scientic WorkPlace will let you
replace part of an expression by the result of a com-
putation on that part. Suppose you want to replace
(r2j)
2
in the expression r2j)
2
(7r13j)(r
2
+1)
by its expansion. Select (r2j)
2
in |c)t(r2j
2
(7r
13j)(r
2
+1) and hold down the ctrl key (Windows)
or the cmd key (Mac) while choosing Expand from the
Maple menu.
(r 2j)
2
(7r 13j)(r
2
+ 1)
The eect is that (r2j)
2
is replaced by r
2
4rj +4j
2
.
It has no parentheses around it, but since it remains
selected, you can simply click on () to add the needed
parentheses. Now return the expression to its original
form by selecting
_
r
2
4rj + 4j
2
_
, holding down the
ctrl/cmd key, and from the Maple menu choosing
Factor. Here are some more examples.
1. Select the denominator in
2r
2
+2r+1
(r+1)(r1)
, hold down the
ctrl/cmd key, and from the aple menu choose Ex-
pand. Now undo what you just did by doing the ap-
propriate operations.
2.
2r
2
+2r+1
(r+1)(r1)
3. Select 2r
2
+2r in the numerator of
_
2r
2
+2r+1
(r+1)(r1)
, hold
down the ctrl/cmd key, and from the Maple menu
choose Factor.
4.
_
2r(r+1)+1
(r+1)(r1)
5. Select 7891011 in the denominator of
5280
1234567891011
and factor it, replacing 7891011 by the result. Now
replace the numerator by its factored form.
6.
2
5
3511
1234563
2
5371233
This \computing in place", that is, holding down
the ctrl/cmd key while performing operations from the
Maple menu on a selection, is a key feature of Scientic
WorkPlace. It provides a very convenient way to manipu-
late expressions into the form desired.
It is even possible to force Scientic WorkPlace to
work with text. Try selecting 7 and from the Maple menu
choosing Evaluate.
A Keyboard Shortcut for Evaluate
Pressing ctrl/cmd + e acts the same as choosing Evalu-
ate from the Maple menu. (There are some exceptions.)
This is generally easier than choosing Maple and then
choosing Evaluate with the mouse.
Stopping a Computation
Most computations are done more or less instantaneously,
but there are some that take several minutes to complete.
Occasionally it is convenient to be able to have Maple
stop computing and return control to Scientic WorkPlace.
This is accomplished by choosing ctrl + break (Win-
dows) or cmd + . (Mac) after a computation has begun.
Try it out by applying Factor to 2
91
+ 3. Maple will actu-
ally factor this in two or three minutes, but you can stop
the computation if you wish.
2
91
+ 3 = 97 317 1589 80621 71463 50647 08073
The Settings Menu
The number of digits used in numerical computations and
the display of numerical results are controlled by choices
from the Settings menu. From the Maple menu choose
Settings. The Engine Parameters page shows the settings
that you can make. We concern ourselves only with the
rst three now. They have to do only with computations
4
using oating point arithmetic, that is, with numbers with
decimals in them. Their settings do not aect computa-
tion or display of integer and rational number arithmetic.
The rst choice, Digits Used in Computations, is self ex-
planatory. You can choose any integer up to 1000. If a
large number is chosen, computations may be signicantly
slower. You can try various settings later on numerical
integration and the like to see just how speed is aected.
Digits Used in Display is simply the number of digits
put on the screen. This setting does not aect accuracy in
computations. Nonsignicant trailing zeros are suppressed
and scientic notation is avoided where possible. If the
Threshold for Scientic Notation is set to the positive in-
teger :, then any decimal number whose absolute value
rounds to a number _ 10
n
will be displayed in scientic no-
tation. What a number rounds to depends on the number
of display digits. The program insures that the scientic
notation threshold cannot exceed the number of display
digits. For example, when Digits Used in Display = 5 any
setting of the scientic notation threshold greater than 5
is equivalent to Threshold for Scientic Notation = 5.
In the examples below, put Digits Used in Computation
= 10, igits Used in Display = 5, and Threshold for Scientic
Notation = 4 Evaluate the following expressions, and see if
these evaluations agree with what you think they should
be.
1. 1.2345 = 1. 2345
2. 1.23454 = 1. 2345
3. 1.23455 = 1. 2346
4. 12.3456 = 12. 346
5. 1234.56 = 1234. 6
6. 12345.6 = 12346.
7. 12345.0 10
3
= 1. 2345 10
7
8. 999994 1.0 = 9. 9999 10
5
9. 999995 1.0 = 1. 0 10
6
10. 999996.0 = 1. 0 10
6
11. 999986.0 = 9. 9999 10
5
12. 999995.9 10
2
13. 999994. 10
2
14. 999995.0 10
12
15. 888895 1.0
16. 889995 1.0
17. 899995 1.0
18. 123 .01
19. 123 .0001
20. 123 .00001
21. 123 .000001
22. 12 .00001
23. 12 .000001
The Series Order for ODE Solutions item species the
number of terms you get in a series solution of a dierential
equation.
The Error Level setting determines what messages are
given to you when making a computation. The higher the
level the more messages you get. Here are the meanings
of the various error levels:
Level Meaning
0 No messages under any circumstances
1 Beep if there is an error
2 Display errors in a dialog box
3 Display memory use in status area
4 Show all Maple commands sent in the
status area
5 3 and 4
6 Show memory use in dialog boxes
7 Show all Maple commands sent in
dialog boxes
8 6 and 7
Working with Expressions and Functions
The Slash Operator (/)
Interpreting the slash operator in the absence of adequate
parentheses is an entertaining pastime. There is a special
keyboard command to obtain Scientic WorkPlace's inter-
pretation of an expression. It is ctrl/cmd + ?. Apply
this command to the following expressions, seeing if you
can predict each interpretation. Of course, possible ambi-
guities can always be eliminated by adding parentheses.
a,/c =
o
bc
a,/ + c =
o
b
+ c
a,/(c + d) =
o
b
(c + d)
(a +/),(c + d) =
o+b
(c+J)
Note the dierence in the treatment of , in the next
two examples:
sin,2 = sin
t
2
sina, cos / =
sin o
cos b
a,/c sin0 =
o
bc
sin0
sin,(a +/)(c + d) = sin
t
(o+b)
(c +d)
a,/c =
o
bc

2,3(4) =
2
3
4
2,(3)4 =
2
34
sin,2(3) = sin
t
2
3 = 1
sin,(2)3 = sin
t
23
=
1
2
sin,(2)(3)
sin,(2 3)
sin 2
5
Standard Mathematical Functions
There are over 2500 functions in Maple, and one goal is to
be able to use them easily via Scientic WorkPlace. Many
of these are directly available in Scientic WorkPlace. The
following examples illustrate the use of several of the most
common and simplest.
For trigonometric functions, the parentheses around
the argument are optional. For most functions however,
it is customary to put parentheses around the argument.
Scientic WorkPlace does not care whether you put paren-
theses, brackets, or braces. In fact, for most functions of
one variable, Scientic WorkPlace does not care whether
or not you put anything around the argument. Gener-
ally, the functions that do not require parentheses around
their arguments are those for which common usage is to
leave them o. But Scientic WorkPlace has to decide
what the argument is, parenthesized or not. From the
Maple menu choose Evaluate for the expressions cos rj,
cos r
_
jdj, cos cos ,2 cos r, and
_
cos rdr and note the
behavior.
Of course, one can always parenthesize away any pos-
sible ambiguities. But the point is to have a system that
will correctly interpret common mathematical expressions.
For example, in
_
cos rdr, the system should know that dr
is not part of the argument of cos, and it does.
If you prefer to work only with ordinary functions
that require parentheses, you can set this choice. From the
Maple menu choose Settings, and on the Denition Options
page check the Convert Trigtype to Ordinary box.
Apply Evaluate and Evaluate Numerically to the fol-
lowing expressions.
1. exp(2)
2. exp2
3. arcsin1
4. sin
1
r
What did you expect Evaluate Numerically to do to
this one?
5. sin
1 1
2
6. sin
2
30

7. lnc
There is a dierence in the result of Evaluate and Eval-
uate Numerically in this one.
8. ln10
9. log c
10. log 10
11. log
10
10
12. 4!
13. 100!
Factor the result of applying Evaluate to 100!. To do
this, just put the insertion point in the result and from
the Maple menu choose Factor.
14. (5)
15. 5
16. (5.3)
17. (100)
18. [(101.0])
19. gcd(2, 4, 6, 8, 10)
20. gcd(r
2
+ 2r + 1, r
2
1)
21. gcd(123450, 67891050)
The last two examples illustrate Scientic Work-
Place's ability to distinguish between polynomials and in-
tegers when called upon to take gcd's.
There are many other commonplace functions cur-
rently implemented, and several will now be demonstrated.
They are all available directly from the Scientic Work-
Place keyboard or by clicking the appropriate icons in the
Scientic WorkPlace window. Clicking with the mouse is
easier until one learns the keyboard commands. Now try
the Maple menu commands Evaluate, Evaluate Numerically,
Simplify, Factor, and Expand on the following expressions.
1.
6
2
2. 6 3
3. 6,3
4.
20
3
Note the dierence in behavior between Evaluate and
Evaluate Numerically here.
5. 20 3
6. 20,3
7. 5(4)(3)
8. 5 4 3
9. 5 + 4 + 3
10. (5) + 4 3
11.
_
256
12.
6
2
_
12345 Note the various dierent results from the
various commands.
13.

5
I=1
i
14.

n
=1
,
3
Factor the result of this one.
6
15. [40[ The vertical bars here come from the keyboard,
or from the ()[] dialog box. They are equivalent. The
vertical bar on the |c panel may not be used to
denote absolute value.
16. abs(40) To enter abs, you may use the custom name
feature of the sin cos dialog box.
17. |69.0| You should get a syntax error here. Maple
expects a matrix or vector of length at least two inside
||. Try evaluating |(3, 4)|. The double bars on the
_ panel may not be used for this purpose.
18.
_
5
2
_
19.
_
100
25
_
20. Try Check Equality on a
2
/
2
= (a /) (a + /), on
256 = 256.0 and on a = /. The fact that 256 = 256.0
is a little surprising, but that is Maple's choice.
More Operations
This section illustrates the use of some of the other opera-
tions available through Scientic WorkPlace. First, simpli-
cations and expansions of various trigonometric expres-
sions are illustrated.
1. sin
2
r + cos
2
r
From the Maple menu choose Simplify. Also choose
Combine + Trig Functions.
2. sin20
Here, choose Expand, and apply Combine + Trig Func-
tions to the result. Do the same to the next two.
On some of these, execute the commands \in place".
That is, select the expression, and hold down the
ctrl/cmd key while choosing the menu com-
mand. Don't forget this facility.
3. sin(a +/)
4. tan(a + /)
5. sin(2a + 3a)
On this last one, most any command except
Expand will yield sin(5a). Try them all. Now
choose Expand, and to the result, apply ombine
+ Trig Functions.
6. sin(2a + 3/)
Apply Expand and on the result execute Com-
bine + Trig Functions. The result of Expand may
be too long to go on one line. You can
view the result by scrolling horizontally.
ctrl/cmd + space breaks but keeps the ex-
pression \as one" so that computations can
be made on it. Execute Expand on the fol-
lowing two and Combine + Trig Functions on the
results.
7. sinh(a + /)
8. tanh(2a + /)
Apply Evaluate and then Simplify to the follow-
ing:
9. (sina),(cos a)
10. (sinha),(cosha)
Expressions involving powers, exponentials,
and logarithms can be simplified and ex-
panded using the commands Powers, Exponentials,
and ogs under the Combine submenu item. Here
are some examples of these computations.
11. expa exp/
Try Simplify and Combine + Exponentials.
12. exp2a exp3/
13. exp(2a + 3/)
14. c
o
c
b
Apply Expand and then Combine + Exponentials
on the result. implify does the same thing as
Combine + Exponentials.
15. exp(2a)
16. ln 2a
Choose Expand and then Combine + Logs on the
result. Do the same to the next one.
17. ln(6a/
2
)
18. r
o+2
Choose Expand and then apply Combine + Powers.
Do the same for the next one. Simplify does
the same thing as Combine + Powers here.
19. a
r+
/
r+:
20. a
r
/
r
(Maple doesn't seem to let you get this
into the form a/)
r
.)
21. exp(a
2
) + lna/
Some Special Operations and Commands
We have been applying the various Maple command to
expressions, for example, Factor to r
2
j
2
. Many com-
mands will operate entrywise on vectors and matrices of
expressions. These commands include Evaluate, valuate
Numerically, Combine, Simplify, Factor, and Expand. Apply
these commands to the following matrices.
1. (1, 2, 3, 4, 5, 6)
2.
_
lnc
_
16 3
6
3
_
8 4
_
7
3.
_
6! 22 3r + 2r
lna + ln/ r
3
j
3
sin
2
r + cos
2
r
_
4.
_
22 44
81 65
_
mod3
The results of a computation may be too long to t
on a line on the screen. \Allow breaks" have been pro-
grammed in so that such results have line breaks in them
if needed. (Such breaks cannot occur in expressions such
as matrices, vectors, fractions, and so on.) Evaluate the
following to see examples of this.
1.

50
I=0
r
I
2. 50!
Also Shift + Space may be used to introduce possible
line breaks in mathematical expressions. Occasionally, an
expression such as a matrix is just too big to t on a line.
But you may use the horizontal scroll bar at the bottom
of the screen to see the entire result.
Constants
Scientic WorkPlace recognizes various constants. These
include c, , and i. Here are a few illustrations.
Put the insertion point after c and choose Evaluate
Numerically from the Maple menu. Alternatively, you could
select the c before applying the operation. Now do the
same for and i
2
. Note the behavior when choosing Eval-
uate and when choosing Evaluate Numerically on the fol-
lowing items.
1. c
2.
3. i
4. [1 + i[
5. abs(1 +i)
6. c
r
7. ciic
8.

3
n=1
i
3
9.

3
I=1
i
3
Look carefully at the last example. It shows that i
does not always mean :rt1, and illustrates how Scien-
tic WorkPlace must decide whether i is really
_
1 or
just another variable.
Polynomials
Here we want to illustrate the usual operations on poly-
nomials. The special commands for polynomials are in
the menu gotten by choosing Polynomials from the Maple
menu. The choices there are Divide, Partial Fractions,
Roots, Sort, and Companion Matrix. Divide applied to a
quotient of polynomials )(r),q(r) with integer coecients
gives (r)+r(r),q(r), where the deg r(r) < deg q(r). Par-
tial Fractions is also an item on the |sf Calculus menu
since a typical application is to integration. Roots nds
the roots of a polynomial with complex coecients, and
Sort puts the terms of a polynomial in decreasing order
of powers. Companion Matrix simply gives the companion
matrix of a polynomial.
There are many other commands available to apply to
polynomials, such as Simplify, Factor, Expand, and so on, as
well as the usual operations of addition and multiplication.
1. Apply Evaluate to gcd(5(r
2
1), 10r 10)
2. Apply Expand, and then Factor the result.
5 (r + 1)
3
(r 1)
2
3. Factor the following expression and then Expand the
result. 5 r
5
+ 5r
4
10r
3
10r
2
+ 5r + 5
4. Try applying Combine Powers, and Evaluate, and im-
plify to 5r
5
+5r
4
10r
3
10r
2
+5r+5+4r
6
3r
5
+
r
2
6
5. Apply Partial Fractions to
2r
2
+2r1
(r+1)(r1)
6. Apply Partial Fractions to
2r
2
+2r1
(r+1)
2
(r
2
r1)
2
7. Apply Simplify to
r+2
r+1
+
3r
r1
8. Apply Factor to
r+2
r+1
+
3r
r1
. Note that factor and
simplify are the same in this context.
9. Apply Expand to
r+2
r+1
+
3r
r1
10. Apply Partial Fractions to
r+2
r+1
+
3r
r1
The feature of computing in place is very handy in ma-
nipulating polynomials. For example, applying Sim-
plify to
r+2
r+1
+
3r
r1
gives 2
2r
2
+2r1
(r+1)(r1)
, and if you want
the denominator to be multiplied out, just select it
and choose Expand while holding down the ctrl/cmd
key.
11. Apply Polynomials + Divide to
6r
3
+5r
2
r+1
r+3
12. Apply Polynomials + Divide to (6r
3
+5r
2
r+1),(r+
3)
13. Apply Polynomials + Roots to r
3
+ 3r
2
+ 3r + 1
Note that multiplicities are given. Compare with the
following.
14. Apply Polynomials + Roots to r
5
+5r
4
10r
3
10r
2
+
5r + 5
8
15. Apply Polynomials + Roots to ar
2
+ /r + c
16. Apply Polynomials + Roots to r
3
+ 3r + 1
Maple uses the usual formulas for nding roots of
polynomials of degree 3 or less. If you want the roots
of this polynomial in simpler form, change one of the
coecients to a decimal and Maple will evaluate the
roots numerically. Compare with the following exam-
ple.
17. Apply Polynomials + Roots to r
3
+ 3.0r + 1
18. Apply Polynomials + Roots to r
4
2r 3
Maple uses the formula to nd the roots of this fourth
degree polynomial, and displays these roots in a col-
umn matrix. But Maple will not nd the roots sym-
bolically of just any old fourth degree polynomial. See
what happens in the next example.
19. Apply Polynomials + Roots to r
4
+ 2r
3
+ r
2
+ 3r
5 Here Maple in eect just returns the polynomial.
Change one of the coecients to decimal form. It
then will give the four roots as a column matrix.
20. Apply Polynomials + Roots to r
5
+ 7r
2
+ r + 1
21. Apply Polynomials + Roots to r
5
+(7+i)r
2
+r++i
22. Apply Polynomials + Roots to r
5
+ 7r
2
+ 3ir + c
23. Apply Polynomials + Companion Matrix to r
3
+ar
2
+
/r +c
Maple insists on a monic polynomial.
Limits
You can take limits. The function lim is one of the func-
tions that can be chosen when you click the sin cos icon.
You can also get it by typing \lim" while in mathematics
mode. To evaluate a limit, choose Evaluate from the Maple
menu or ctrl/cmd + E. Evaluate the following limits.
1. lim
r0
sin r
r
: 1
2. lim
ro
_
r
2
+3r+1
_
16r
2
+r+2
3. lim
r0
+
r
]r]
4. lim
r0
r, [r[
5. lim
0


]]
lim
r1
1
r
6. lim
r0

1
r
arccos r
7. (r + 1)
2
+ lim
r0
sin r
r
+ (a + /j)
2
Dierentiation
Scientic WorkPlace recognizes
various notations for dierentiation, including the forms
J
Jr
,
J
n
Jr
, 1
r
.1
r
, 1
r
s

,
J
Jr
, and
J
n
Jr
s

, where : + t = :.
Also note in the examples below that parentheses, brack-
ets, and braces are equally acceptable. Notice how Scien-
tic WorkPlace handles the ill-formed expressions in the
list below.
Place the insertion point anywhere in the expression
J
Jr
(r
2
). Choose Evaluate from the Maple menu (or choose
ctrl/cmd + E. Now do the same for the following ex-
pressions.
1.
Jr
2
Jr
: 2r
2.
J
Jr
r
2
: 2r
3. 1
r
r
2
= 2r
4. 1
r
[r
2
]
5. 1
r
(r
2
)
6.
J
Jr
r
2
7.
J
Jr
r
2

8.
J
2
Jr
2
r
2
+ 3r : 2 + 3r
9.
J
2
Jr
2
((r
2
+ 3r)
10.
J
2
Jr
2
(r
2
+ 3r
11.
J
2
Jr
2
r
2
+ 3r)
12.
J
2
Jr
2
(r
2
+ 3r]
13.
J
JrJ
r
2
j
3
: 6rj
2
Scientic WorkPlace will do implicit derivatives also.
mplicit Dierentiation is under the Calculus menu and will
be discussed in connection with that menu.
Indenite Integration
Next we illustrate computing indenite integrals. A basic
problem for Scientic WorkPlace here is to decide what to
integrate and to choose the variable of integration.
Place the insertion point anywhere in the expression
_
(ar
2
+/r+c)dr. From the maple menu, choose Evaluate,
or choose ctrl/cmd + E. In this case, the expression to
be integrated is syntactically correct. Scientic WorkPlace
not only allows any syntactically correct expression in the
integrand, but also is forgiving. For example, evaluate the
following expressions.
1.
_
1
r
dr
2.
_
Jr
r
3.
_
ar
2
+/r +cdr
9
4.
_
ar
2
5.
_
1
r
n
In these three examples, Scientic WorkPlace had to
choose a variable of integration, and r was chosen.
If a variable of integration is not specied, Scientic
WorkPlace will choose a variable of integration and
the choice generally is the last symbol appearing. The
following integrals illustrate this.
6.
_
ar
7.
_
r/
8.
_
ra dr
9.
_
1
r
2
+
2
10.
_
r
2
r
2
+
2
If the insertion point is placed within a mathemati-
cal expression, trl/cmd + ? gives Scientic Work-
Place's interpretation of that expression. Try this on
the expressions above.
In choosing a variable of integration for you when the
integrand contains no dened expressions, Scientic
WorkPlace generally picks the last variable found. In
quotients, it picks the last variable in the numerator.
If there is no variable in the numerator, as in the ex-
ample i:t
1
r
2
+
2
, it then looks at the denominator and
picks the last variable there. Thus the results above.
Of course, you can avoid having Scientic WorkPlace
pick a variable of integration by specifying it your-
self with the usual dr notation. Finally, notice what
happens on the next three.
11.
_
)
12.
_
)(r)
13.
_
)(r)dr
The last three integrals should really be no surprise.
In the rst, ) is treated just like r, and the complete ex-
pression is
_
)d). In the second, since ) is not dened
as a function, Scientic WorkPlace interprets )(r) as the
product ) r. It then chooses r as the variable of inte-
gration, and the complete expression is i:t) rdr. The
third expression is treated the same as the second. If )
has been dened as a function, as we will learn how to do
later, then
_
)(r)dr will be the integral of the expression
) (r) with respect to the variable r, as it should be.
Sequences of Operations
Here are some examples which shows how you might per-
form sequences of computations, exploring as you go.
Sequences of Computations Place the insertion point
within the expression
_
c
or
cos /rdr and choose Evalu-
ate from the aple menu. Without moving the insertion
point, choose Factor. The sequence of expressions is
_
c
or
cos /rdr =
o
o
2
+b
2
c
or
cos /r +
b
o
2
+b
2
c
or
sin/r =
(c
or
)
o cos br+b sin br
o
2
+b
2
.
Now place the insertion point in the expression
_
2
r
cos /rdr and perform the following sequence of
computations from the Maple menu: Evaluate, Sim-
plify, Combine Trig Functions, and implify. The com-
plete sequence of expressions you should see is as fol-
lows.
_
2
r
cos /rdr =
ln 2
ln
2
2+b
2
2
x

ln 2
ln
2
2+b
2
2
x
tan
2 1
2
br+2
1+x b
ln
2
2+b
2
tan
1
2
br
1+tan
2 1
2
br
=
2
1+x
ln 2 cos
2 1
2
br(ln 2)2
x
+2
1+x
b sin
1
2
br cos
1
2
br
ln
2
2+b
2
=
1
2(ln
2
2+b
2
)
2
1+r
ln2 cos /r +
1
2(ln
2
2+b
2
)
2
1+r
ln2
)racln2ln
2
2 + /
2
2
r
+
1
2(ln
2
2+b
2
)
2
1+r
/ sin/r =
2
r ln 2 cos br+b sin br
ln
2
2+b
2
Notice that the form of the nal result is the same as
in the rst example. Here, you are experiencing the
dierence between the way Maple handles exponen-
tials and powers, and possibly the limitations on mem-
ory when Maple and Scientic WorkPlace are running
together.
These examples illustrate how you can interact with
the system to explore for the result you want. The inter-
action is both smooth and natural. You might also exper-
iment with other sequences of operations|it is possible to
end up with ever larger expressions by choosing the wrong
operations.
Denite Integrals
To evaluate a denite integral, place the insertion point in
the expression to be evaluated and from the Maple menu,
choose Evaluate, or ctrl/cmd + E, or Evaluate Numeri-
cally. Try the three choices on i:t
1
0
rdr.
Evaluate the following denite integrals. Some of
them may take Maple a little time to compute.
1.
_
t
0
sinrdr
2.
_
1
0
lnrdr
3.
_
1
0
c
r
dr
4.
_
t
0
rlnsinrdr
5.
_
o
0
c
r
dr
6.
_
o
0
c
r
2
dr
7.
_
o
1
1
r
5
dr
8.
_
o
0
1
r
2
dr
9.
_
o
1
1
r
2
dr
10.
_
1
0
1
r
2
dr
10
11.
_
o
0
Jr
(1+r)
_
r
12.
_
o
0
cos r
_
r
dr
13.
_
1
0
ln rJr
1r
14.
_
1
0
ln rJr
1r
2
15.
_
o
0
r
3
t
x
1
dr
16.
_
o
0
r
13
t
x
1
dr
Numerical Integration
Numerical integration can be performed by selecting Eval-
uate Numerically on the Maple menu. Try this on the ex-
amples below. Some of them take a couple of minutes.
1.
_
1
0
c
r
2
dr
2.
_
1
0
sinr
3
dr
3.
_
1
0
sin
3
100r
5
dr
4.
_
4t
0
cos rlog rdr
5.
_
1
0
r
.8
_
1 r
4
dr
Innite Series
Many expressions can be expanded in innite series by
choosing Series on the Maple menu with the expression
selected. A dialog box comes up with two choices to be
made, the number of terms in the expansion, and what to
expand in powers of. The default for the number of terms
is 5. The Expand in Powers of box must be lled in.
1. c
r
Expand in powers of r.
2. c
2r+3
Expand in powers of r 1.
3. c
2r+3
Expand in powers of j 2.
4. rsinr Expand in powers of r.
5. rsinr Expand in powers of j.
6.
_
1r
4
r
2
Expand in powers of r + 1.
Substituting a Value into an Expression
We currently accept these forms:
expr[
super
sub
expr]
super
sub
[expr]
super
sub
expr[
super
sub
and
expr[
sub
expr]
sub
[expr]
sub
expr[
sub
Note that the rst three forms in each list have \expr"
surrounded by a \fence" from the Brackets dialog box, and
the left fence delimiter is the \null delimiter"; that is, an
empty bracket. The null delimiter does not print, although
it is visible on screen as a dotted vertical line.
The sub and superscripts contain the substitutions
that are to be made in the expression. If only a subscript
is present, the expression is evaluated at those substitu-
tions. If both are present, we get the expression with the
superscript substitutions minus the expression with the
subscript substitutions. Apply Evaluate to the following
examples:
rj]
r=5
r=2
rj]
r=2
(r + j)
4
_
r+=:
rj]
r=2,=3
rj]
r=4,=5
r=2,=3
[rj]
r=4,=5
r=2,=3
rj[
r=4,=5
r=2,=3
_
sinrdr

r=1
r=0
_
sinrdr

1
0
_
sinrdr[
r=1
r=0
_
sinrdr[
1
0
When the superscript and subscript are just numbers,
the expression must contain only one variable, otherwise
Scientic WorkPlace reports an error.
Matrices
Standard Operations
Maple has a large linear algebra package that contains
many operations on matrices. Choosing Matrices from the
Maple menu brings up a host of operations that can be per-
formed on a single matrix. Scientic WorkPlace performs
the usual matrix addition, multiplication, and operations
between scalars and matrices. These are illustrated in the
following list.
1. From the Maple menu, chooseEvaluate.
_
1 2
4 3
_
+
_
5 6
8 7
_
.
The result,
_
6 8
12 10
_
, appears with square brackets
around it. Scientic WorkPlace uses the same brack-
ets for the result as appeared in the expression. This
applies to parentheses and brackets.
2. Evaluate the expression a
_
1 2
4 3
_
+ /
_
5 6
8 7
_
.
Try various other Maple commands on this one, like
Simplify and xpand. Evaluate the following three ma-
trix expressions.
3.
_
1 2
4 3
__
5 6
8 7
_
4.
_
5 6
8 7
_
2
5.
_
5 6
8 7
_
1
Evaluate this one numerically also.
11
6. Apply Factor to this matrix.
_
5 6
8 7
_
Such operations as Factor operate on each entry of the
matrix.
7. Apply Evaluate to the expression 5+
_
1 2
4 3
_
Notice
how this is handled. The 5 is treated as 5 times the 2
2 identity matrix. This is convenient when evaluating
polynomials at matrices, as in the following example.
8.
_
1 2
4 3
_
2
5
_
1 2
4 3
_
2
9. The exponential function is dened for matrices. Eval-
uate
|
_
1 2
4 3
_
. Of course, it's for expressions such
as these that one needs to be able to denote a ma-
trix by a symbol, that is, to make such denitions as
=
_
1 2
4 3
_
and then write c
|.
. We will learn how
to do this in the section on denitions.
The Matrices Submenu
The following examples illustrate using the commands in
the Matrices submenu. Apply the command indicated.
1. Adjugate
_
a /
c d
_
2. Concatenate
_
a /
c d
__
1 2 3
4 5 6
_
3. Characteristic Polynomial
_
a /
c d
_
This operation chose the variable A for the polyno-
mial. Its ritual for choosing the variable should never
confuse that variable with a matrix entry. For exam-
ple, nd the characteristic polynomial of
_
` r
A j
_
.
Column Basis
_
1 2
3 4
_
4. Condition Number
_
1 2
3 4
_
5. Deniteness Tests
_
1 2
3 4
_
6. Determinant
_
a /
c d
_
There is a function det available directly, either by
typing it in while in mathematics mode or by clicking
on it in the list under sin cos. So one may also compute
a determinant by applying Evaluate to det
_
1 2
3 4
_
,
for example. Try it. Now evaluate det
_
_
1 a a
2
1 / /
2
1 c c
2
_
_
and factor the result.
7. Try the matrix commands Eigenvectors and Eigenval-
ues on the matrices
_
cos c sinc
sinc cos c
_
and
_
1 2
3 4
_
. Try both Exact
and Numeric when appropriate.
8. The command Fill Matrix... allows easy entry of ma-
trices of various special kinds. The menu that comes
up is self explanatory. For example, to enter a 3 3
identity matrix, choose Fill Matrix... , set Rows and
Columns to 3, and choose Identity in the window of
the menu. Experiment with this command. See what
happens when you choose a 5 6 matrix and Identity.
The Band option requires that you enter a list like
\a, /, c" with an odd number of entries. Entering the
lists \0", \1", and \0, `, 1" will generate respectively,
a zero matrix, an identity matrix, and a Jordan block.
The Dened by function option allows you to dene a
function like )(i, ,) =
1
I+1
, enter ) in the box as the
name of the function, and generate a Hilbert matrix.
Fill Matrix... has another important function. If you
have a matrix such as
_
_
1 2 3
5 5 4
7 8 9
_
_
and would like
the lower right 2 2 corner to be the zero matrix,
then select this corner of the matrix, and under Fill
Matrix... choose zero. Try it. The lower right corner
is replaced by the 2 zero matrix. No new matrix is
created|a replacement is made.
There seems to be no way to insert a new matrix with
Fill Matrix... with alignment other than center align-
ment for columns and center alignment for placement
in text. But you can always change the alignments of
a matrix using the Scientic WorkPlace revise button.
9. Fraction Free Gaussian Elimination
_
a /
c d
_
10. Gaussian Elimination
_
_
2 1 0
1 2 1
0 1 2
_
_
11. Choosing Hermitian Transpose on the Matrix menu has
the obvious result. One may also get the Hermitian
transpose of a matrix by using the superscript H. Try
it on
_
i 2 + i
4i 3 2i
_
1
12. Inverse
_
_
2 1 0
1 2 1
0 1 2
_
_
You can also take the in-
verse of a matrix by evaluating
1
. Try it.
13. Jordan Form
_
_
2 1 0
1 2 1
0 1 2
_
_
This produces a fac-
torization of the matrix as 1J1
1
where J is in Jor-
dan form. This holds for the rational canonical form
also, and is illustrated below.
12
14. Minimum Polynomial
_
a /
c d
_
As in the case of characteristic polynomials, the sys-
tem nds a variable for the minimum polynomial. You
do not have to specify it.
15. Norm
_
_
2 1 0
1 2 1
0 1 2
_
_
There are other norms This
one is the 2-norm.
_
_
_
_
_
_
_
_
2 1 0
1 2 1
0 1 2
_
_
_
_
_
_
_
_
2
gives the
same norm. In the section on denitions, other norms
of matrices are illustrated.
16. Null Space Basis
_
_
2 1 0
2 1 0
0 1 2
_
_
17. Orthogonality Test
_
cos c sinc
sinc cos c
_
18. Permanent
_
a /
c d
_
19. QR
_
_
2 1 0
2 1 0
0 1 2
_
_
20. Rank
_
_
2 1 0
2 1 0
0 1 2
_
_
21. Rational Canonical Form
_
a /
c d
_
22. Row Reduced Echelon Form
_
_
2 1 0
2 1 0
0 1 2
_
_
23. Reshape
_
_
2 1 0
2 1 0
0 1 2
_
_
Try this on matrices of var-
ious shapes.
24. Row Basis
_
_
2 1 0
2 1 0
0 1 2
_
_
25. Singular Values
_
1 2
3 4
_
26. SVD produces a factorization of the form l1\ where
1 is the diagonal matrix of singular values and l and
\ are orthogonal matrices. This operation works only
on matrices of numbers. Try it on the matrix above.
27. Smith Normal Form
_
1 2
3 4
_
28. Trace
_
a /
c d
_
29. Transpose
_
a /
c d
_
You can also get the transpose of
a matrix using a superscript T Evaluate
_
a /
c d
_
T
.
Solving Systems of Equations
Solve on the Maple menu gives solutions to equations and
systems of equations. There are four choices under the
Solve menu: Exact Numeric, Integer, and Recursion.
Solve Exact
To solve 2r = 4, choose Solve + Exact. The solution ap-
pears after the equation. Try it. Do the same for the
equation j
3
j 1 = 0.
A system of equations is written by entering the equa-
tions in an : 1 matrix, one equation to a row. Alterna-
tively, a system of equations can be typed into a display,
using the enter key to add additional equations. When
we have the same number of unknowns as equations, we
put the insertion point anywhere in the system and choose
Solve + Exact. The variables are found automatically. Try
the following examples.
1. This is a 2 1 matrix.
r
2
+ 3j
2
= 7
r
2
2j
2
= 2
2. This is a display.
r +j 2. = 1
2r 4j + . = 0
2j 3. = 1
3.
2r j = 1
r + 3. = 4
r j 3. = 3
A system of linear equations can also be dealt with by
solving its matrix version. The last two examples above
correspond to the two matrix equations below. Use Solve
+ Exact to solve these equations and compare the solutions
with those you obtained above.
1.
_
_
1 1 2
2 4 1
0 2 3
_
_
_
_
r
j
.
_
_
=
_
_
1
0
1
_
_
2.
_
_
2 1 0
1 0 3
1 1 3
_
_
_
_
r
j
.
_
_
=
_
_
1
4
3
_
_
There is no problem when the number of unknowns
matches the number of equations, but when there are more
unknowns than equations, Maple must be told which un-
knowns to solve for. To solve the following equation, you
must specify the unknown. Put the insertion point any-
where in the equation and choose Solve + Exact. A dialog
box comes up asking you to choose the variable(s) to solve
for. Solve rst for r and then for j.
13
c
r
=
+1
1
Here is a system with 2 equations and 3 unknowns.
Solve it for r and j, and then for r and .. To do it, just
click anywhere in the system, choose Solve + Exact and ll
out the dialog box with \r, j" or \, .".
2r j = 1
r + 3. = 4
Solve the following two systems for various combina-
tions of the unknowns.
2r j
2
= 1
r + 3. = 4
When solving for r and j, or for j and
., the solution to this system is given in terms of the roots
of a quadratic.
2r j = c
r
r + 3. = 4
The solution to the following system is given in terms
of the roots of a cubic.
2r j
2
= 1
r + 3. = 4
j + .
2
= 2
The next system is the same, but with a oating point
number in it. In this case, only real solutions are returned.
2r j
2
= 1.0
r + 3. = 4
j + .
2
= 2
Solve Numeric
Solve + Numeric is meant to be used only on special oc-
casions.footnotet is used mainly on birthdays, weddings,
Bar Mitzvahs, and occasions when equations involving ex-
ponentials must be solved. If answers are desired in dec-
imal form, put one of the coecients in the equations in
oating point form and use Solve + Exact.
Solve + Numeric is used primarily when solving (sys-
tems of) transcendental equations. Solve + Numeric at-
tempts to nd a single real solution, but may fail even
if solutions exit. The important feature is that you can
require that variables take values in specied search inter-
vals. Specifying appropriate search intervals may result in
a successful calculation. Try these examples:
1. 10r = c
r
Use Solve + Exact and note what happens.
Now do the next two using Solve + Numeric.
2. 10r = c
r
, r (1, ) Note the red comma and no
imbedded spaces.
3. Displays can also be used for equations with search
intervals.
10r = c
r
r (0, 1)
4.
_
_
r
2
+ j
2
= 5
r
2
j
2
= 1
r (0, 4)
_
_
Use Solve + Numeric. Note that if
(r, j) is a solution, then so is (r, j).
5.
_
_
_
_
r
2
+ j
2
= 5
r
2
j
2
= 1
r (0, 4)
j (0, )
_
_
_
_
Use Solve + Numeric.
Solve Integer
Solve + Integer nds integer solutions to equations and
systems of equations. Use Solve + Integer on the following
examples.
1. 3r + 4j = 10
2.
3r + 2j = 5
3r . = 1
Solve Recursion
Solve + Recursion nds solutions to a recursion or a system
of recursions. Try the following examples.
1. j(: + 2) + 3j(: + 1) + 2j(:) = 0
2.
j(: + 2) + 3j(: + 1) + 2j(:) = 0
j(0) = 2
j(1) = 1
3.
j(: + 1) + .(:) = : + 2
n+1
.(: + 1) j(:) = : + 3 2
n
j(1) = 1
.(1) = 2
Modular Arithmetic
The Integers modulo :
The basic computation Scientic WorkPlace does here is to
evaluate a|i:)n:c:od: where a is and integer and : is a
positive integer. Place the insertion point in the expression
and apply Evaluate. The answer is the least non-negative
residue. For example 34 mod4 = 2, and 69 mod13 = 9.
You can also evaluate a
1
mod: if a and : are
relatively prime. In particular, you can always evaluate
a
1
modj where
i:ajri:ca:d
ai::ota:n|tij|co)p.1orcra:j|c23
1
|i:)n:c:od3 = 2,
and hence 23 2 mod3 = 1. So you can solve congruences
ar = / mod: by calculating a
1
/ mod. Solving the con-
gruence 25r = 8 mod13, we get 25
1
8|i:)n:c:od13 =
5. (Note that applying Solve + Exact to 25r =
8 |i:)n:c:od13 leads to a parsing error. Scientic Work-
Place does not understand the = notation directly.) In-
deed, 25 (5) mod13 = 8. You can solve systems of con-
gruences (if the moduli are relatively prime in pairs) by
solving them two at a time and thus reducing to one con-
gruence. To solve the system
r = 45 mod 237
r = 19 mod 419
14
we have r = 45 + 237/, and substituting into the second
congruence gives 45 + 237/ = 19 mod419. Thus 237/ =
19 45 mod19, and / = 237
1
(19 45) mod419 = 60.
Hence r = 45 + 237 60 = 14265. The solution is unique
modulo (237 419) = 99303. Solve the following system
of congruences and check your answer.
r = 36 mod 111
r = 18 mod 237
r = 120 mod 419.
To calculate powers modulo :, write a
n
mod: and
evaluate. You can dene things rst if you wish. For
example, make the
denitions = 2789596378267275, : = 3848590389047349,
and : = 2838490563537459. Calculate
n
mod: and
2789596378267275
3848590389047349
mod2838490563537459.
These calculations are done rather quickly.
Matrices Modulo :
The mod function also works with matrices. Here are some
examples.
1.
_
5 8 12
9 4 34
_
mod3 =
_
2 2 0
0 1 1
_
2.
_
_
3 7 5
5 4 8
2 0 5
_
_
1
mod11 =
_
_
9 9 3
2 5 1
3 3 10
_
_
3.
_
_
3 7 5
5 4 8
2 0 5
_
_
_
_
9 9 3
2 5 1
3 3 10
_
_
mod11 =
_
_
1 0 0
0 1 0
0 0 1
_
_
Note that the rst operates entry-wise. In the sec-
ond, the matrix inverse is taken, operating mod11. In the
third the left side is multiplied out and the result is given
mod11.
Polynomials Modulo :
The mod function can also be combined with polyno-
mials. The expression j(r) mod5 returns the polyno-
mial j(r) with its coecients reduced mod5. For example
8r
2
+42r31 mod5 = 3r
2
+2r+4. Evaluate reduces each
of the coecients modulo 5. Notice that parentheses were
not required around the polynomial.
1.
_
8r
2
+ 42r 31
_
(13r 23) mod7. If you apply Ex-
pand to this expression, you get 6r
3
+ 5r
2
+ 3r +
6. If you apply Evaluate, you get
_
r
2
+ 4
_
(6r + 5)
To get the latter multiplied out mod7, expand
_
r
2
+ 4
_
(6r + 5), getting 6r
3
+ 5r
2
+ 24r + 20, and
reduce this mod7. Of course, you could have mul-
tiplied
_
8r
2
+ 42r 31
_
(13r 23) out rst by using
the Maple command Expand, and then reduced mod7.
But the simplest thing to do is to apply Expand.
2. Apply Factor to 6r
3
+ 5r
2
+ 3r + 6 mod7
3. Evaluate the following expression and apply Factor
to the result, operating mod7.
_
9r
2
+ 39r 29
_
+
_
23r
2
+ 13r 23
_
Polynomials Modulo Polynomials
Two polynomials )(r) and q(r) are congruent modulo a
polynomial (r) if and only if )(r) q(r) is a multiple of
(r), in which case we write
)(r) = q(r) (mod(r)) .
Evaluating q(r) mod(r) gives a polynomial of minimal
degree that is congruent to q(r) modulo (r). Evaluate
the next two expressions.and apply Polynomial + Divide to
the third one.
1. r
3
+ 3r
2
+ 3r + 1 modr + 1
2. r
5
4r
2
+ 3r 1 modr
3
r
2
+r 1
3.
r
5
4r
2
+3r1
r
3
r
2
+r1
Denitions
If you choose Dene from the Maple menu, the submenu
that comes up has seven items: New Denition, Undene,
Show Denitions, Clear Denitions, Save Denitions, Restore
Denitions, and Dene Maple Name. Here is how they
work.
New Denition, Undene, Show Denitions, and
Clear Denitions
There are two basic kinds of new denitions:
1. Dening a symbol a to be an expression, such as r
2
+2,
or a matrix such as
_
1 2
3 4
_
, or a vector, and so on;
2. Dening a function ) using an expression, for example
)(r) = r
2
+2. Now a and ) are mathematical objects
of dierent kinds, and as such have dierent behavior
and accept dierent operations on them.
To make a denition, such as j = ar
2
+ /r + c, put
the insertion point anywhere in the equation, or select the
expression, and choose New Denition from the Dene sub-
menu. This makes the assignment, and from then on, j
represents the expression ar
2
+ /r + c. It is not a func-
tion, and in particular j(2) is not 4a + 2/ + c, but 2j =
2ar
2
+2/r+2c . On the other hand,
_
jdr = a
r
3
3
+/
r
2
2
+cr,
and
J
Jr
= 2ar +/.
To use a symbol, say , for the matrix
_
a /
c d
_
,
click anywhere in the equation =
_
a /
c d
_
(or se-
lect the whole thing if you prefer), and choose Dene
15
+ New Denition. Then one can operate on as with
any matrix. For example, make the denition and then
compute
2
, 5, and
1
, using Evaluate or ctrl/cmd
+ e. The results will be
2
=
_
a
2
+/c a/ +/d
ca + dc /c + d
2
_
,
5 =
_
5a 5/
5c 5d
_
, and
1
=
_
J
oJbc

b
oJbc

c
oJbc
o
oJbc
_
.
The menu items Undene, Show Denitions, and Clear
Denitions are self explanatory. Show Denitions exhibits
all denitions in force. Clear Denitions clears all deni-
tions that have been made. To clear particular denition,
put the cursor anywhere in the dening expression and
choose Undene. Alternately, select the symbol dened
and choose Undene. The symbol does not have to be in
the dening expression. For example if a has been de-
ned by a = 2r + 4, then selecting any \a" anywhere, in
text or in mathematics, and choosing Undene clears the
denition of a.
Below are some more examples for you to try. Before
you start, Clear Denitions. It is easy to forget that some
symbol has been dened to be some expression, and if that
symbol is used later, you can get surprising results. For
example, if you made the denition a = r
2
, forgot about
it, and later computed
_
a:d:, expecting to get
os
2
2
, you
are in for a surprise. In some complicated computation,
the error may not be apparent. So choose Clear Denitions
now.
Make the denitions j = ar
2
+ /r + c, = 4j
2
+
3rj + 2, and =
_
1 r +j
4 3
_
. Evaluate the following
expressions.
1. j +
2. j
3. 3j + 4
4. j,(r +1) Apply Polynomials + Divide to this one and
the next.
5. ,(j
2
+ 1)
6.
2
7. j
8.
_
jdr
9.
J
Jr
10.
_
j
11. 1
r
(j)
12.
_
jdj
13.
_ _
jdjdrj
14. mod2
If the integrand contains dened expressions, and no
variable of integration is specied, the choice of that vari-
able is made by Maple, and in ambiguous situations the
results can be unpredictable. Rework the last two exam-
ples above after making the denitions a = r + j, and
/ = r +j.
If the insertion point is placed within a mathematical
expression, ctrl/cmd + ? gives Scientic WorkPlace's
interpretation of that expression. Try this on the expres-
sions above and on the following expressions. Note that
when the integrand contains dened expressions and no
variable of integration is specied, the variable of inte-
gration is shown as ?, indicating that Scientic WorkPlace
cannot determine it. \?" is also used in sums and products
when the index is not specied and dened expressions are
present. Compare

3
r=1
a with

3
1
a using ctrl/cmd +
?. Also, perform the integrations indicated, and note the
choice made by Maple in the ambiguous cases.
1.
_
ra
2.
_
ra dr
3.
_
1
r
2
+
2
4.
_
r
2
r
2
+
2
It is legitimate to dene expressions in terms of other
expressions. For example, one can dene r = 3j c and
: = :r +
J
Jr
.
Now make the denitions r = 3jc, : = :r+
J
Jr
, a =
2r+3j and = ar and perform the following calculations
on them. Remember that j and have previously been
dened as j = ar
2
+/r +c and = 4j
2
+ 3rj + 2.
1. r +c
2.
_
(: :r)dr
3. a
4.
Jo
Jr
To dene the function ) whose value at r is ar
2
+
/r +c, write ) (r) = ar
2
+/r +c, put the insertion point
anywhere in the equation and choose New Denitions from
the submenu Dene. Now the symbol
rcjrc:c:t:t/c)n:ctio::odc)i:cd, a:d/c/ac:|i/ca)n:ctio:.'a/i:qt/cdc)i:itio:
f(y)=ay
2
+/j+c denes the same function. The symbol
used for the function argument in making the denition
does not matter. You can even use a previously dened
symbol or the symbol ) itself. Here are two examples.
Dene the functions q and / and then evaluate them at t.
Clear Denitions before you start.
1. q(r) = rsinr
2. Evaluate q(t)
3. /(r) = r
2
16
4. Evaluate /(t)
The denition of a function ) may be undone by high-
lighting any `f" anywhere and choosing Undene. Alter-
nately, you can put the insertion point in the dening
equation and choose Undene. lear Denitions of course
undenes everything, functions and expressions.
If you choose Show Denitions from the Dene sub-
menu, a window comes up showing the denitions in force,
both of expressions, or assignments, and of functions. In
the case of assignments, we show the denition that Maple
actually made using full evaluation, rather than the de-
nition we sent to Maple. In the case of functions we show
the denition we sent to Maple, rather than the denition
Maple made.
If a dierential equation has been solved numerically,
the name of the function constructed appears in the Show
Denitions window, with the indication that it is the re-
sult of a numerical process. See the section on dierential
equations.
If q and / are previously dened functions, then the
following equations are examples of legitimate ones for
making denitions. Each time you redene ), the new
denition replaces the old one.
1. Dene + New Denition )(r) = 2q(r)
2. Evaluate )(t)
3. Dene + New Denition )(r) = q(r) + /(r)
4. Evaluate )(t)
5. Dene + New Denition )(r) = q(r) /(r)
6. Evaluate )(t)
7. Dene + New Denition )(r) = q(r)/(r)
8. Evaluate )(t)
9. Dene + New Denition )(r) = q(r),/(r)
10. Evaluate )(t)
11. Dene + New Denition )(r) = (q(r))
2
12. Evaluate )(t)
13. Dene + New Denition )(r) = c
(r)
14. Evaluate )(t)
15. Dene + New Denition )(r) = q(r)
|(r)
16. Evaluate )(t)
17. Dene + New Denition )(r) = q(/(r))
18. Evaluate )(t)
The standard operations, such as integration and dif-
ferentiation, are available for functions in the follow-
ing ways:
19.
_
)(r)dr
20.
J
Jr
)(r)
21. 1
r
)(r)
22.
J}(r)
Jr
23. )
t
(r)
What is really happening is that we are operating on
expressions, not functions. That is, we always use )(r),
or )(j), and so on, but never ) alone. We have not imple-
mented an algebra of functions.
Note also (as illustrated by the last example above)
that \prime" has been implemented as the dierential op-
erator on functions. While we are free to use .
t
= r + j
as the name of an expression, we are not allowed to use .
t
as the name of a function to be dened. When ) has been
dened as the name of a function, )
t
(r) is its derivative at
r and )
tt
(2) is its second derivative evaluated at 2.
Now make the denitions )(r) = r
2
+ 2r + c, and
q (r) = rj c, and do the following calculations.
1. )(0)
2. )
t
(1)
3. q
tt
(t)
4. )(j)
5. )(q(0))
6. )(2) q(c)
7. )(q(r))
8. 1
r
)(q(r))
9.
_
1
0
)(r)dr
10.
_
1
0
)(.)d.
11.
_
1
0
)(c)dc
12. 1
r
)(r)
13.
_
1
r
)(r)dr
14. 1
r
_
)(r)dr
15. )
t
(:)
16. )
t
(q(r))
Here are some additional features involving Dene.
17. Get series expansions for a and )(r) after making the
denitions a = c
2r+3
and )(r) = rsinr.
18. Polynomial functions can be evaluated at matrices.
Dene =
_
1 2
3 4
_
and j(r) = r
2
5r 2. Can
you explain the result when you evaluate ()? Be sure
that you press ctrl/cmd + e twice.
17
19. In dealing with matrix equations, the matrices may
contain parameters, have more than one column and
may be dened expressions. To illustrate this, dene
=
_
1 2
3 4
_
, / =
_
2 1 4
6 2 10
_
and from the Solve
submenu apply Exact to the following equations.
20. A = /
Now dene =
_
: 2
3 4
_
and / =
_
2
6
_
and apply
Solve + Exact to
21. A = /
For some reason Maple will allow a multicolumn /
or an with parameters, but not both in the same
equation.
22. Clear denitions and dene )(r, j) = 23r
2
j+456rj+
512 mod7. Evaluate
23. )(r, j)
24. )(12, 2c)
25. Dene + New Denition )(t) = 3t
2
+5t+6 modr
2
+1.
Evaluate
26. )(r
2
+r + 2)
27. )(r
2
+ 1). Warning: Do not dene )(r) = 3r
2
+
5r +6 modr
2
+1 and evaluate )(some polynomial in
r). This will change the modulus and give nonsense
answers.
Denitions with Deferred Evaluation
Several users have complained about Maple denitions,
which in SWP2.01 uses the Maple default of full evalu-
ation. The process of full evaluation applies the results
of previous denitions to candidates for new denitions.
Thus, if the denition a = 1 is followed by the denition
r = a , then r has a value of 1 under full evaluation .
Subsequent changes to the value of a do not aect r. Un-
der deferred evaluation, any changes to a will change the
value of r. The process of deferred evaluation is now used
in Scientic WorkPlace.
In particular, recursive denitions are no longer al-
lowed.
Remembering Solutions
Solving an equation or system of equations leads to solu-
tions, but the resulting equations are not denitions. In
order to use the solutions, select an equation and apply
Dene + New Denition.
For example, recall the system
r + j 2. = 1
2r 4j +. = 0
2j 3. = 1
whose exact solution is
_
. =
5
4
, j =
11
8
, r =
17
8
_
. To use
r, j, and ., select the equation r =
17
8
and apply Dene
+ New Denition; select the equation j =
11
8
and apply
Dene + New Denition; and select the equation . =
5
4
and apply Dene + New Denition. This process can be
done conveniently with a mouse by selecting an equation
and clicking the dene icon or from the Dene submenu
choosing New Denition.
Save Denitions & Restore Denitions
Choosing Save Denitions from the Maple menu has the
eect of storing all the currently active denitions in the
working copy of the current document, and when the doc-
ument is saved, the denitions are saved with it. Re-
store Denitions is just the reverse|it takes any deni-
tions stored with the current document and makes them
currently active. Note that each invocation of Save Den-
itions overwrites any denitions that may have been pre-
viously saved, so if you want to add some denitions to
those already saved, you must choose Restore Denitions
before Save Denitions. Denitions are saved and restored
in the order in which they were made.
The fact that active denitions are currently associ-
ated with the Maple session rather than a specic doc-
ument is sometimes a source of confusion. The Maple
session lasts as long as we are continuously in cientic
WorkPlace, even though we may edit a number of dif-
ferent documents during the session. To see this, make
several denitions, choose Show Denitions to verify that
they are in eect, and then open a new document. Choose
Show Denitions again and note that the same denitions
are still in eect. This can be a convenience if you are
working on related documents and want to use these def-
initions, but if not, Clear Denitions will get rid of them,
and Restore Denitions will activate any denitions stored
with the new document.
The Denition Options on the Settings Menu speci-
es the default behavior of saving and restoring denitions
when saving and opening documents.
Functions of Several Variables
Functions of several variables are dened by writing an
equation such as (r, j, .) = ar + j
2
+ 2., or q(r, j) =
2r + sin3rj for example, clicking in the equation and
choosing New Denition. Just as in the case of functions
of one variable, we always operate on expressions gotten
by evaluating the function at a point.
Row and Column Arguments
If we want a number of values of a function, it is conve-
nient to be able to pass all the data to Maple in an array
and have it return an array of the same dimensions con-
taining the function values. We have implemented this for
arrays which are row or column matrices. Thus if we de-
18
ne 1 =
_
a / c d

and C =
_

_
0
1
2
3
_

_
, then sin1 =
_
sina sin/ sinc sind

and sinC =
_

_
0
sin1
sin2
sin3
_

_
when
we apply Evaluate or ctrl/cmd + e. It works the same
way for user dened functions and their derivatives, and
for raising to powers. Thus 2
1
=
_
2
o
2
b
2
c
2
J

and
1
2
=
_
a
2
/
2
c
2
d
2

. When both the base and ex-
ponent are rows or columns, the result is always a matrix
whose rows correspond to the base and whose columns cor-
respond to the exponent, whether or not those arrays are
rows or columns. Explore this by working the following
examples. First dene 1 and C as above, and also de-
ne o =
_
0 1 2 3

and )(r) = rsinr. Remove the
denitions after you have nished the examples.
1. )(C)
2. )(o)
3. )
t
(o)
4. )
tt
(o)
5. 3
c
6. 3
S
7. log 1
8. 1
c
9. 1
S
Matrix Valued Functions
We can dene functions, such as this one, whose values are
matrices.
0(r) =
_
r sinr
c
r
r
3
_
At the moment all we can do with them is evaluate
and dierentiate. For example, 0() =
_
0
c
t

3
_
and
0(i) =
_
i i sinh
1 i
3
_
. Evaluate 0
t
(r) and 0
t
(), and
other forms for dierentiation.
Piecewise-Dened Functions
Another class of matrix-valued functions are the piecewise-
dened functions which are dened by dierent expressions
on dierent parts of their domain. Here are two examples.
Note that we have made some very strict conditions
concerning the structure of case functions. They must be
specied in a 3 column matrix with at least two rows, with
the functional values in the rst column, \if" or \i)" in
the second, and the range condition in the third column.
The range conditions should be entered in the order of
increasing values. We have also assumed that the matrix
is fenced with a left brace and the empty right delimiter.
The two following examples should clarify matters.
Dene + New Denition
)(r) =
_
_
_
r + 2 if r < 0
2 if 0 _ r _ 1
2,r if 1 < r
and evaluate )(0), )(1), and )(2).
Evaluate
)
t
(r) =
_

_
1 i) r < 0
undened i) r = 0
0 i) r < 1
undened i) r = 1

2
r
2
i) 1 < r
Plot 2D + Rectangular )(r)
Dene + New Denition
/(r) =
_
r + 2 if r < 1
3,r if 1 _ r
and evaluate the following.
1.
_
2
0
/(t)dt
2.
_
1
0
(r + 2) dr
3.
_
2
1
3
r
dr
4.
_
1
0
(r + 2) dr +
_
2
1
3
r
dr
Access to Other Maple Functions
You can access Maple functions that are not supported
directly in cientic WorkPlace. Here is how you do it.
Choose Dene Maple Name under the Dene submenu. Fill
out the dialog box that comes up. If nextprime is the
Maple functions you want, type in nextprime(x). In the
Scientic WorkPlace line, use a single character unless you
have a custom name prepared. In any case follow it by the
argument \(r) ". Leave the le name blank. Then check
the appropriate Maple package. Then choose OK. That's
it.
The items Undene, Show, Save, and Restore under the
Dene submenu work for these Maple function as for those
dened in Scientic WorkPlace. Clear Denitions does not
remove these. They must be removed one at a time using
Undene. The format in Show Denitions for the Maple
functions is a bit dierent, so you can tell which are ac-
cessed from Maple and which are Scientic WorkPlace -
dened.
User Dened Maple Functions
You can access user-dened functions written in Maple.
While in a Maple session, save the function to a le
19
lename.m. To access `yourfunction(x)' do the follow-
ing. While in Scientic WorkPlace , choose Dene Maple
Name. Fill out the dialog box with `yourfunction(x)' in the
rst line, and so on. The File line must give the complete
path. It should read `/dirname/subdirname/lename.m'
Note the forward slashes. Also you should check all appro-
priate Maple packages. The items in the Dene submenu
work the same way for these functions as for the Maple-
dened functions.
2D Plots
The plotting capabilities of Scientic WorkPlace are among
its most powerful and useful features. For example, being
able to plot functions and expressions quickly, revise the plots,
and examine the results adds an experimental dimension to
problem solving that was not easily accessible in the past.
We begin by discussing the various items under the Plot
2D menu. To plot an expression involving one variable, such
as rsinr, put the insertion point in rsinr and from the Plot
2D submenu, choose ectangular. A frame containing a plot
of the expression appears in-line after the expression, with
the lower edge resting on the text baseline and the insertion
point at the right of the plot The rst attempt at a plot
uses default parameters, with r ranging from 5 to 5, and
the range of j depending on the expression. In the Settings
menu you can change the default size of the plot box. Make
that plot now of rsinr.
A single click of the mouse with the pointer inside the
frame causes 8 black handles to appear. We say that the
frame has been selected. In this state, you resize the frame
by grabbing one of the handles and dragging. The corner
handles leave the opposite vertex xed while moving the two
sides adjacent to the handle. The edge handles move only the
corresponding edge in or out. Either type of change stretches
or shrinks a plot in the view, along with the frame. Resizing
the frame retains the same limits on the view. If the frame has
been selected, you can move it up and down by placing the
mouse pointer inside it, holding down the left mouse button
and dragging. Experiment with these things on the plot of
rsinr you have just made.
There are various ways in which you can instruct Scien-
tic WorkPlace to plot. If you want to plot j = rsinr, you
can do any one of the following things.
1. Click in rsinr or highlight it and choose Plot 2D +
Rectangular.
2. Dene j to be the expression rsinr, put the cursor just
to the right of j, or highlight j and choose Plot 2D +
Rectantular.
3. Dene the function )(r) = rsinr, put the cursor in
)(r), or highlight )(r), or highlight the function ), and
choose Plot 2D + Rectangular.
Now plot the function j = rsin
1
r
. Double click the
mouse with the pointer inside the frame. Eight gray handles
appear on the frame, and the mouse pointer takes the shape
of a hand when it is over the view. We say that the view has
been selected.
To translate a view, select the view by double-clicking,
move the mouse pointer over the view, so that it takes on the
shape of a hand, and click and drag the frame. An outline of
the frame moves as you drag, while the plot remains xed.
When you release the mouse button, the frame is redrawn at
its original position with a translated view. This feature is
used to \pan" across the Cartesian plane in any direction to
capture dierent portions of the plot. Experiment with this
using the plot of rsin
1
r
that was made above.
Frame Properties Dialog Box
You use the Frame Properties dialog box to specify frame
dimensions precisely and to determine how the frame is placed
in your document. This time we will work with the plot of
the piecewise dened function
/(r) =
_
_
_
r
2
1 i) r < 1
1 r
2
i) 1 _ r _ 1
r
2
1 i) 1 < r
First, dene / and plot it. Now select the frame, or select the
view, or put the cursor immediately to the right of the picture.
From the Edit menu, choose Properties + Frame. You use
the page that comes up to specify frame dimensions precisely
and to determine how the frame is placed in your document.
(You can get the same page to come up by selecting the frame
or the view and using the properties icon.) You determine
the placement of the frame by choosing In line, Displayed,
or loating. When a frame is In line, you can move it up or
down within the line as described before. An in-line frame
behaves like a word in the text, in the sense that when you
enter additional items to the left of it, the frame is pushed
along in the line.
Displayed and oating frames both appear on the screen
centered on a separate line. They behave dierently when
printed. A oating frame may be moved (\oated") from
its on-screen position to facilitate page-breaking. A displayed
frame is printed at the same place relative to the surrounding
text as it appears in the screen display. Floating frames tend
to work well if the document contains only a few plots or
pictures. However, if there are a signicant number of oat-
ing frames the printed pages may not be what you expect.
In such a case you may nd one graphic at the top of each
page, and these graphics may appear many pages after the
reference in the text. The remaining graphics may appear
clumped together at the very end of the manuscript.
Display a frame by choosing Displayed from the Frame
page. Do not select the plot and click the icon for displayed
mathematics. That icon is designed to create displays of
mathematics and is not suited for displaying plots or pic-
tures.
Plotting More than one Function at a Time
To plot several expressions of the same variable at once,
seperate them with red commas, put the cursor in the list
20
and choose the appropriate plot command. If you already
have a plot and want to add to it the plot of another expres-
sion, simply drag the expression into the plot. If ) (r) is a
dened function, you can add it to a plot by dragging ) or
)(r) into the plot. Remember, for a piecewise-dened func-
tion though, drag the name, not the expression ) (r). You
can also add plots using the dialog boxes described below.
Plot Components Page
Plot the polynomial r
3

8
3
r
2

5
3
r+2 and sin2r on the same
graph. To do it, click anywhere in r
3

8
3
r
2

5
3
r +2, sin2r
and choose Plot 2D + Rectangular. Do it. The plot does
not look too good since sin2r is hardly visible. Select the
view or the frame or put the cursor immediately to the right
of the picture. From the Edit menu choose Properties + Plot
Components. A page comes up that lets you do a number of
things. Read the discussion below and then make a decent
picture out of the plot you just created. (You can also get
this page to come up by selecting the view (or the frame) or
by putting the cursor immediately to the right of the picture
and choosing the properties icon.)
The item box in the upper left corner of the page shows
one of the expressions or functions you are plotting in the
view. These are referred to as \items" and listed by Item
Number. You can view all current functions or expressions
plotted by clicking the up-down arrows. You can change the
curves that are plotted by editing the displayed item, adding
a new item, or removing an item from the list. To change
an item, edit it in the box. To add an item, select Add Item,
and then type the item in the empty box that comes up. To
delete an item from the list, click the arrows until the item is
displayed in the box, and then select Delete Item.
You set the sampling interval by editing the numbers in
the Domain Intervals.
The plot is determined by the data points computed.
You can increase the accuracy of the graph by increasing the
Sample Size. Because increasing the Sample Size slows down
the plotting process, you may want a relatively small number
of data points for real-time demonstrations and a relatively
large number of data points for printed documents.
In a plot, the data points computed are connected either
by line segments or are displayed as points, depending on your
choice of Line or oint under Plot Style. The default is Line,
which connects the points with lines. You can change the
appearance of a Line Plot by changing Line Style, Line Color,
or Thickness. You can also choose Point, which displays only
the computed points. You can select the symbol used to plot
the points with Point Symbol.
Axes & View Page
You have a choice of Axes Scaling between Standard, Log, or
Log-Log. You can specify the Axes Type as Normal, Boxed,
Framed or None. The choices Normal and None are self-
explanatory. The Boxed appearance shows the plot inside a
rectangular frame, and Framed displays the left and lower
edges of the box. All of these choices (except None) display
numerical labels on the axes or box edges.
You specify the view by typing numbers into the View
Intervals boxes or by selecting Default. If you select Use
Default, the view is determined automatically to maximize
the information contained in the plot. The r- and j-axes
can have quite dierent scales, and the curve is normally not
truncated at the top or bottom. Select Equal Scaling on Each
Axis to force the j-axis to use the same scale as the r-axis.
Plotting Points
Instead of plotting an expression, you can specify directly
a set of points and make a plot which simply connects
these points with straight lines in the order in which the
points are listed. For example, put the insertion point in
[(1, 1), (1, 2), (2, 2), (2, 1), (1, 1)] and choose Plot 2D + Rec-
tangular. You need to revise the plot and set appropriate
ranges for r and j to make this look like the square that it
is.
Various formats for the points are acceptable. In the list
above, the parentheses around the points are not required.
But the outside square brackets must be square brackets.
The points may be entered as an : 2 matrix.
Conformal Plots
A complex function 1(.) (. and 1(.) are both complex) is
a challenge to graph, because the usual graph would require
four dimensions. A conformal plot of a complex function
1(.) is the image of a two-dimensional rectangular grid of
horizontal and vertical line segments. The default is an 11 by
11 grid, with intervals 0 _ r _ 1 and 0 _ j _ 1 subdivided
into 10 equal subintervals. If 1(.) is analytic, then it pre-
serves angles at every point at which 1
t
(.) ,= 0, and hence
the image is a grid composed of two families of curves that
intersect at right angles.
To create a conformal plot of an expression such as .
2
+
2. 1, put the insertion point in the expression and choose
Conformal from the lot 2D submenu. The number of grid
lines and the view can be changed in the dialog box. Do
conformal plots of the following.
1. z
2
2. .
2
+ 2. 1
3.
. 1
. + 1
Plots of Vector and Gradient Fields
A function that assigns a vector to each point of a region in
two- or three-dimensional space is called a vector eld. The
operation Plot Vector Field requires a pair of expressions in
two variables representing the horizontal and vertical com-
ponents of the vector eld. To plot a vector eld, type a
pair of two-variable expressions representing the horizontal
and vertical components of a vector eld into a column vec-
tor. With the insertion point in the vector, choose Vector
21
Field from the Plot 2D submenu. Try it with the vector eld
(r, j) = [r + j, r j].
The vector eld that assigns to each point (r, j) the
gradient of ) at (r, j) is called the gradient eld associated
with the function ). To plot a gradient eld, leave the inser-
tion point in the expression for )(r, j) and from the Plot 2D
submenu, choose Gradient. Try it on )(r, j) = r
2
+ 2j
2
.
Parametric Equations
So far we have dealt only with the menu item Plot 2D +
Rectangular.
If you bring up the Plot Properties for a parametric plot,
one choice you have is between Cartesian and Polar coordi-
nates. The default range for
i:t/ci:tcra|
[-
5,5].1)t/cra:qco)ti:/iq, t/cj|ot:aj/cdran:ocrit:c|):ccra|ti:c:.1ort/i:jarticn|arj|ot, rc:tricti:qt/cra:qcto[0,2]
gives a much sharper image.
Implicit Equations
The equation of a circle cannot be rewritten as a function of
one variable. You can plot the set of points satisfying such an
equation using the 2D implicit plot feature. Put the insertion
point in the equation and select Plot 2D + Implicit. Do it
with the equation of the circle (r 1)
2
+(j + 1)
2
= 1. Now
this picture is pretty bad. Bring up the plot dialog box and
x it. First, unequal scales on the r- and jaxes can cause
distortion of geometric gures. Click the Equal scaling on
each axis box to make this gure look like a circle. The r
range should be set to [0, 2] and the j range [2, 0]. And
you can increase the grid settings. Experiment with this plot
and with other implicit ones.
Polar Coordinates
In polar coordinates a point 1 is specied by giving the angle
0 that the ray from the origin to the point 1 makes with the
polar axis and the directed distance r from the origin. If the
polar axis is taken to be the x-axis then the equations that
relate rectangular coordinates to polar coordinates are given
by
r = r cos 0, j = r sin0
or equivalently,
r
2
+j
2
= r
2
, tan0 =
j
r
To make a polar plot, write an expression for the distance r
in terms of the angle 0, click in that expression and choose
Plot 2D + Polar. Try it on r = sin20. Change the settings
in the dialog plot box to make it into a good picture.
Parametric Polar Plots
The polar plot of 0 = r
2
is obtained as the 2D polar plot of
the vector
_
r, r
2
_
. Plot this via Plot 2D + Parametric, revise
the rst plot that appears, choose Polar and set the parameter
range to 0 to 10. This is a special case of dening both the
radius r and the angle 0 in terms of a third variable t. For
example, you can get the polar plot of the parametric curve
dened by the equations = 1 sint, 0 = cos t as the polar
plot of the vector (1 sint, cos t) using Parametric from the
Plot 2D submenu. Revise the rst plot, choosing Polar and
parameter range 0 _ t _ 2. Try it out.
3D Plots
The environment for plotting curves and surfaces in space is
very similar to the environment for plotting in the plane. The
view is a box, a rectangular solid determined by inequalities
of the form r
0
_ r _ r
1
, j
0
_ j _ j
1
, and .
0
_ . _ .
1.
The frame is a rectangular region of the computer screen,
just as before. Scientic WorkPlace chooses a default view
with 5 _ r _ 5, 5 _ j _ 5, and with the .-coordinates
determined automatically. If you use other variable names,
the order is determined alphabetically. To plot an expression
in two variables, such as r
2
j
2
, put the insertion point in it
and choose lot 3D + Rectangular. If you want to plot several
expressions at once, enter them separated by (red) commas.
To add an expression to a 3D plot select it and drag it onto
the plot.
You can plot a dened function of two variables in two
dierent ways. Select the function name ) or select the ex-
pression )(r) and from the Plot 3D menu, choose Rectangu-
lar. To add a function to a 3D plot, drag it onto the plot
Do a 3D rectangular plot of )(r, j) =
r
(r
2
+
2
)
2
with
view 1 _ r _ 1, 1 _ j _ 1, and 5 _ . _ 5. (The
default . range produces a plot that contains only a single
vertical line.)
Try out the various plotting tools described below on the
plot of )(r, j) and on other plots of your choice.
Plotting Tools for 3D Plots
Selecting the frame or the view, and bringing up the Frame
Properties and the Picture Properties dialog boxes are done
exactly the same as for 2D plots.
Most of the choices in the dialog box are analogous to
the ones for 2D plots, but there are some dierences. (The
ability to \pan" by dragging the frame when view has been
selected is not fully implemented for 3D plots.) The plot is de-
termined by the data points computed. You can increase the
quality of the graph by increasing the Sample Size. Increas-
ing the Sample Size also slows down the plotting process,
of course. So you may want to specify a relatively small
number of grid points for real-time demonstrations and a rel-
atively large number of grid points for printed documents.
The grid points computed are connected by polynomial sur-
faces or curves, or are simply displayed as points, depending
on your choice of Style.
Patch connects the points by small patches of polyno-
mial surfaces and a wire frame grid.
22
Patch [No Grid] is the same as Patch but without the
grid.
Patch & Contour adds level curves to the patches.
Contours is a set of level curves on a transparent sur-
face.
Wire Frame is the default for Style. It has been chosen
for the default because 3D plots are redrawn quickly
in that style. It connects the points by straight line
segments on a transparent surface.
Hidden Line is the same as Wire Frame except that the
surface is opaque.
Points displays only the computed points.
You can change the Lighting from the default 0 to 1{4.
Color choices include XYZ, XY, Z, Z Hue, Z Grayscale, or
No Coloring. The color choice Z means that the color choice
depends only on the .-coordinate, whereas XYZ means that
color is a function of all three coordinates.
Finally, you can specify the appearance of the axes as
Normal, None, Boxed, or Frame.
Normal gives the usual r-, j-, and .-axes if the origin is
contained inside the view box and otherwise draws three
axes as close as possible to the origin.
Boxed shows the plot inside a box frame.
Frame displays the left edge and two lower edges of the
box.
Implicit Functions
To obtain an implicit plot of an equation involving two vari-
ables, enter the equation in your document, and from the Plot
3D submenu, choose mplicit. Do it with r
2
+j
2
+.
2
+1 =
(r + j +. + 1)
2
with Boxed axes, range 5 _ r _ 5,
5 _ j _ 5, and 5 _ . _ 5, Turn set at 111, and Tilt set
at 60.
Parameterized Surfaces
Parameterized surfaces are given by equations of the form
= )(:, t), j = q(:, t) and . = /(:, t). These are very general
and allow you to generate a wide variety of interesting plots.
To make these plots, enter the expressions in a vector, making
each expression a separate component. With the insertion
point in the vector, choose Rectangular from the Plot 3D
submenu.
The parameterized surface dened by the equations
r = : sin: cos t
j = : cos : cos t
. = : sint
can be created as the 3D rectangular plot of the vector
[: sin: cos t, : cos : cos t, : sint] Do this plot with 0 _ : _ 2
and _ t _ .
Curves in Space
A space curve is dened by three functions r = )(t), j =
q(t), . = /(t) of a single variable. To plot such a curve,
enter the three dening expressions as the components of a
three-element vector. With the insertion point in the vector,
from the Plot 3D menu choose Tube. To change the radius
or the view, double-click the plot, click revise, and change the
settings. The \fat curve" is designed to show which parts of
the curve are close to the observer and which are far away.
Otherwise, a curve in space is dicult to visualize. Now do
a tube plot of the space curve
r = 10 cos t 2 cos 5t + 15 sin2t
j = 15 cos 2t + 10 sint 2 sin5t
. = 10 cos 3t
In the dialog plot box set the radius to 1 and 0 _ t _ 2. A
\thin curve" can be drawn by setting the radius to 0 in the
dialog box.
By typing an expression in t for the radius and choosing
the curve to be a straight line, you can get surfaces of revolu-
tion. Try this for the line given by r = t, j = . = 0, the ra-
dius set to 1sint, and the range for t set to 2 _ t _ 2.
The spine of the surface of revolution can be any line.
Try a plot with the line dened by r = 2t, j = 3t, . = t,
radius 4 + sin 3t + 2 cos 5t, framed axes, and 5 _ t _ 5.
Cylindrical Coordinates
In the cylindrical coordinate system, a point 1 is represented
by a triple (r, 0, .), where (r, 0) represents a point in polar
coordinates and . is the usual rectangular third coordinate.
Thus, to convert from cylindrical to rectangular coordinates,
we use the equations
r = r cos 0 j = r sin0 . = .
and to go from rectangular to cylindrical coordinates, we use
the equations
r
2
= r
2
+ j
2
tan0 =
j
r
. = .
The default assumption is that r is a function of 0 and
.. So you only have to write down this expression. You
can plot more than one expression at once by separating the
expressions with (red) commas. Also, you can plot several
surfaces on the same axes by dragging expressions onto a
plot.
Now plot the cylinder r = 1 obtained as the 3D cylindri-
cal plot of the expression 1, with 0 _ 0 _ 2, and 0 _ . _ 1.
With the same ranges for 0 and r, do a 3D cylindrical plot
of r = 1 ..
Dene r(0, .) = . +sin0 and do a cylindrical 3D plot by
highlighting r. Set the limits 0 _ 0 _ 4 and 1 _ . _ 1.
23
Parameterized Surfaces in Cylindrical Coordinates
You plot the parameterized surface r = )(:, t), 0 = q(:, t),
. = /(:, t) in cylindrical coordinates by entering the expres-
sions for r, 0, and . into a vector ()(:, t), q(:, t), /(:, t)) and
choosing Cylindrical from the Plot 3D submenu.
To plot the \spiral staircase" . = 0, do a 3D cylindrical
plot of the vector [r, 0, 0], with 0 _ r _ 1 and _ 0 _ 4.
Spherical Coordinates
The spherical coordinates (j, 0, c) locate a point 1 in space
by giving the distance j from the origin, the angle 0 projected
onto the rj-plane, and the angle c with the positive .-axis.
The conversion into rectangular coordinates is given by
r = j sinccos 0 j = j sincsin0 . = j cos c
and the distance formula implies
j
2
= r
2
+ j
2
+ .
2
The default assumption is that j is a function of c and
0 . You can plot more than one surface on the same axes in
the usual way. To make a spherical plot, enter an expression
involving 0 and c in your document, and with the insertion
point in the expression, select Plot 3D + Spherical. Try it on
the expression 2, with limits 0 _ 0 _ 2 and 0 _ c _ 2.
You can create a spherical plot of a dened function
of 0 and c, such as j(0, c) = (1.2)

sin(0). Select either


the function name j or the expression j(0, c) and from the
Plot 3D submenu, choose spherical. Try it on j(0, c) =
(1.2)

sin(0), and set the limits to 1 _ c _ 2, and 0 _


0 _ .
Parameterized Surfaces in Spherical Coordinates
Parameterized surfaces are given by equations of the form
j = )(:, t), 0 = q(:, t), and , = /(:, t). These are very
general and allow you to generate a wide variety of interesting
plots. Enter the dening expressions as the three components
of a vector, and with the insertion point in the vector, from
the Plot 3D submenu choose Spherical.
The 3D spherical plot of the vector [j, 0, 1] gives the cone
, = 1. Do this plot, setting 0 _ j _ 1 and 0 _ 0 _ 2.
Plot the surface dened by j = :, 0 = :
2
+ t
2
, , = t
by entering the three expressions as coordinates of a vector.
Take 0 _ : _ 1 and 0 _ t _ 1.
Exercises
Here are some exercises for you to try. They involve plotting
in various ways. Solutions follow.
1. Use Implicit under the Plot 2D submenu to plot the conic
sections r
2
+ j
2
= 1, r
2
j
2
= 1, and r + j
2
= 0 all
on the same coordinate axes.
2. Use Implicit under the Plot 2D submenu to plot the conic
sections (r1)
2
+(j +2)
2
= 1, (r1)
2
(j +2)
2
= 1,
and (r1)+(j+2)
2
= 0 on one pair of coordinate axes.
With the hand symbol visible over the view, translate the
view so that the curves match the curves in Exercise 1.
3. Plot r
2
+j
2
= 4 and r
2
j
2
= 1 together. How many
intersection points are there? Verify your estimate by
typing the formulas into a matrix and choosing Numeric
from the Solve submenu.
4. Plot the astroid r
2/3
+j
2/3
= 1.
5. Plot the folium of Descartes r
3
+ j
3
= 6rj.
6. Plot the surface . = sinrj, with 5 _ r _ 5 and
5 _ j _ 5. Compare the location of the ridges with
the implicit plot of the three curves rj =
t
2
, rj =
5t
2
,
and rj =
3t
2
.
7. A standard calculus problem involves nding the in-
tersection of two right circular cylinders of radius 1.
View this problem by choosing ectangular from the
Plot 3D submenu to plot the two parametric surfaces
[:, cos t, sint] and [cos t, :, sint].
8. Do the two space curves
[(2 + sint)10 cos t, (2 + cos t)10 sint, 3 sin3t]
and [
[10 cos t, 10 sint, 3 sin3t] 1i:tcr:cct?l:cTn/c)ro:t/c1|ot31:n/:c:na:drotatct/ccnrc:to)i:dont.
9. View the intersection of the sphere r
2
+j
2
+.
2
= 1 and
the plane r + j + . =
1
2
by choosing Implicit from the
Plot 3D submenu. Verify that the points of intersection
lie on an ellipse (it is actually a circle) by solving r +
j +. =
1
2
for ., substituting this value into the equation
r
2
+j
2
+.
2
= 1 and calculating the discriminant of the
resulting equation.
10. Explore the meaning of contours by plotting the surface
. = rj and selecting Patch & Contour as a Style in
the Rectangular dialog box. Rotate the surface until
only the top face of the cube is visible and interpret the
meaning of the curves you see. Rotate the cube until
the top face just disappears and interpret the meaning
of the contours.
Solutions to Exercises
1. Plot 2D + Implicit: r
2
+j
2
= 1, r
2
j
2
= 1, r+j
2
= 0
(Take 2 _ r _ 2 and 2 _ j _ 2.)
2. Plot 2D + Implicit: (r 1)
2
+(j + 2)
2
= 1, (r 1)
2

(j + 2)
2
= 1, (r 1) +(j + 2)
2
= 0 (Take 1 _ r _ 3
and 4 _ j _ 0.)
3. Plot 2D + Implicit: r
2
+ j
2
= 4, r
2
j
2
= 1 (Take
5 _ r _ 5 and 5 _ j _ 5.)
24
Solve + Numeric:
r
2
+ j
2
= 4
r
2
j
2
= 1
r (1, 2)
j (1, 2)
, Solution is :
r = 1.58113883, j = 1.224744871
4. Plot 2D + Implicit: [r[
2/3
+[j[
2/3
= 1 (Take 1 _ r _
1 and 1 _ j _ 1.)
Without the absolute values, Scientic WorkPlace re-
turns only the rst quadrant portion of the graph.
5. Plot 2D + Implicit: r
3
+ j
3
= 6rj (Take 5 _ r _ 5
and 5 _ j _ 5.)
6. Plot 3D + Rectangular: sinrj (Take 5 _ r _ 5 and
5 _ j _ 5.)
Plot 2D + Implicit: rj = ,2, rj = 5,2, rj = 3,2
(Take 5 _ r _ 5 and 5 _ j _ 5.)
7. Plot 3D + Rectangular: [:, cos t, sint], [cos t, :, sint]
(Take 2 _ : _ 2 and 0 _ t _ 2.)
8. Plot 3D + Tube:
[(2 + sint)10 cos t, (2 +
cos t)10 sint, 3 sin3t], [20 cos t, 20 sint, 3 sin3t] (Take
0 _ t _ 2.)
Solve + Exact:
(2 + sint)10 cos t = 20 cos :
(2 + cos t)10 sint = 20 sin:
3 sin3t = 3 sin3:
, Solution is :
t = 0, : = 0 , t = , : =
9. Plot 3D + Implicit: r
2
+j
2
+.
2
= 1, r +j +. = 1,2.
(Take 1 _ r _ 1, 1 _ j _ 1, and 1 _ . _ 1.)
10. Plot 3D + Rectangular: rj
(Take 1 _ r _ 1, 1 _ j _ 1, Turn 90, Tilt 0, and
choose the style Patch & Contour.)
(Take 1 _ r _ 1, 1 _ j _ 1, Turn 90, Tilt 90, and
choose the style Patch & Contour.)
Calculus
We have already discussed the basic operations of dierentia-
tion and integration. There are various items on the Calculus
menu relating to those operations. These items will be ex-
plained now.
Implicit Dierentiation
An equation such as j
2
= sinrj denes j as a dieren-
tiable function of r but we cannot solve for j in terms of
r. However, we can still nd
J
Jr
via implicit dierentiation.
It is one of the items on the menu. Suppose we want
J
Jr
and j
2
= sinrj Put the insertion point in the expression
and choose Implicit Dierentiation. Up comes a box asking
for the dierentiation variable. Choose r and OK and you
get 2jj
t
+ (cos (rj)) (j +rj
t
) = 0. Now you can solve for
j
t
or, if you wanted j
tt
, do Implicit Dierentiation again. In
the rst case you get
_
j
t
= (cos rj)

2+(cos r)r
_
and in
the second, 2j
t
j
t
+ 2jj
tt
(sin(rj)) (j +rj
t
) (j + rj
t
) +
(cos (rj)) (j
t
+ j
t
+rj
tt
) = 0. Solving this for j
tt
gives

2(
0
)
2
(sin r)
2
2(sin r)r
0
(sin r)r
2
(
0
)
2
+2(cos r)
0
2+(cos r)r
.
Things are not always so easy. For example, you may not
be able to solve for j
t
in terms of r and j. Here are some
examples to try.
1. j
2
= r
2. 2j = r
2
+ sinj
3. r
2
rj +j
2
= 5
4. If j
2
+ rj 1 = 0, nd
J
2

Jr
2
at (0, 1).
Iterate
You can solve many equations of the form )(r) = r numeri-
cally using terate from the Calculus submenu. You start with
an estimate r
0
for the root, and Iterate returns the list of val-
ues )(r
0
), ()(r
0
)), )()()(r
0
))), )()()()(r
0
)))), up to the
number of iterations you specify. In appropriate situations,
these values converge to a root of the equation )(r) = r.
Here is an example.
Choose Iterate from the Calculus submenu. In the dialog
box that comes up, enter cos as the iteration function, select
1.0 as initial value and 10 as the number of iterations. You
should get a vector of values ending with .74424 (if digits
displayed is set to 5).
The entry in the iteration function box must be the func-
tion name. And you can't use cos
2
, for example. To iterate
that function, dene )(r) = cos
2
(r) and enter ) in the box
for the iteration function.
Applying iteration to the function q(r) = r
}(r)
}
0
(r)
is
Newton's method for nding zeroes of the function ). Try it
on the following functions.
1. rcos r In this example, you should get .73909 starting
at .5 and doing 10 iterations. Compare with solving
numerically restricting the solution to the interval (0, 1).
That is, apply Solve + Numeric to
r = cos r
r (0, 1)
.
2. r(2 r
2
)
3. r
2
+ 1
Find Extrema
Find Extrema on the Calculus menu nds extrema of func-
tions subject to equality constraints using the method of La-
grange Multipliers. Maple nds two things|the set of ex-
treme values and a set o of candidates for points at which
the extreme values are assumed. o may contain extraneous
saddle points which correspond to no extreme value, and the
ordering of extrema and points in o need not be the same as
the extrema, so that one is obliged to evaluate the function at
25
each point of o to classify it. In some cases the information
returned by Maple in o may be only a set of equations that
still must be solved to nd the points at which the extreme
values are assumed. With that in mind, try these examples.
Note that the equations and constraints are collected in a
matrix, with the function in the rst row and the constraints
in subsequent rows.
1.
r
3
j
2
r +j = 0
2.
_
r
2
+j
2
.
r
2
+ j
2
= 16
r +j + . = 10
3.
r
2
+j
2
+ .
2
3r + 2j +. = 6
r +j + . = 1
You can also nd local maxima and minima of a function
without constraints. In this case, just put the insertion point
in the expression and choose Find Extrema. Try Find Extrema
on )(r) = cos r + sin3r. Of course, if there is an extreme
value at r, then there is one at r + 2. Now try it on
)(r) = cos r + sin3.0r. The latter yields only one critical
number, although there many more. Compare the value at
this critical number with the corresponding value given for
cos r + sin3r.
Methods of Integration
Even though Scientic WorkPlace can evaluate many inte-
grals directly, several standard techniques of integration such
as integration by parts, substitution, and partial fractions are
also available.
The integration by parts formula states that
_
nd = n
_
dn.
To evaluate
_
rlnrdr by parts, put the insertion point in
the expression and choose Integrate by Parts from the Cal-
culus submenu. Enter lnr as the part to be dierentiated,
that is, n in the formula above. Choose OK. You should get
1
2
(lnr) r
2

_
1
2
rdr. Here are some examples for you to
work on.
1.
_
lnrdr
2.
_
r
2
lnrdr
3.
_
rcos rd.
4.
_
r
2
c
r
dr
5.
_
c
r
cos rdr
The change of variables formula states that if n = q(r),
then dn = q
t
(r)dr and hence
_
)(q(r))q
t
(r) dr =
_
)(n) dn
To calculate the integral
_
rsinr
2
dr put the insertion point
in the expression and choose Change Variable from the Cal-
culus submenu, and in the substitution box enter n = r
2
and
choose OK. You should get
_
1
2
sinndn, which is integrable
on sight. Following are some examples for you.
1.
_
r
2
_
r
3
+ 1dr
2.
_
Jr
1+4r
2
3.
_
Jr
r
_
r
4.
_
sin
5
rcos
3
rdr
The Method of Partial Fractions is based on the fact
that a factorable rational function can be written as a sum of
simpler fractions. To evaluate using partial fractions, select
the integrand
3r
2
+2r+4
(r1)
2
(r
2
+1)
and holding down the ctrl/cmd
key, choose artial Fractions from the Calculus submenu. You
should get
_
_
9
2(r1)
2

1
2(r1)
+
1
2
)rac2 + rr
2
+ 1
_
dr
after adding
_
, parentheses, and dr. Now you can integrate
each piece. Of course Maple will evaluate
_
3r
2
+2r+4
(r1)
2
(r
2
+1)
dr
directly. Some examples for you to try follow.
1.
_
5r3
(r+1)(r2)
dr
2.
_
_
2r +
9r3
r
2
2r5
_
dr
3.
_
_
1 +
1
r
2

8
r
2
+7
_
dr
Pictures of Riemann Sums
Plot Approx. Integral on the Calculus menu illustrates graph-
ically the approximation of the area under a curve by Riemann
Sums. You can plot pictures of Riemann sums obtained by
using midpoints, left endpoints, or right endpoints of subin-
tervals. The Riemann sum determined by the midpoints is
the sum of the areas of rectangles whose heights are deter-
mined by midpoints of subintervals, and analogously for left
and for right endpoints. The default is to plot using mid-
points and the default number of boxes is 10. But you may
choose left, right, or both endpoints by revising the plot. To
make these plots for rsinr, leave the insertion point inside
the expression and choose Plot Approx. Integral. Try it out.
Reset the r range and number of boxes as desired.
Approximation Methods
Scientic WorkPlace supports the midpoint method, the
trapezoidal rule and Simpson's rule for approximating denite
integrals. With the insertion point in the expression rsinr,
from the Calculus submenu choose Approximate Integral and
select the appropriate method in the dialog box. You get an
expression for the approximate integral, which you can evalu-
ate numerically. Do it for the three methods, integrating over
the interval [0, ] using 10 subintervals, evaluate the integral
i:t
t
0
rsinrdr, and compare the four answers.
26
Dierential Equations
Under Solve + ODE from the Maple menu one may choose
four methods of solution: Exact, Laplace, Numeric, and eries.
To implement, put the insertion point in the equation, or
system of equations with its side conditions (if any), and
choose one of the methods. If there is any doubt about what
the independent variable is, a dialog box will appear asking
you to specify it.
Exact Methods
Apply Solve ODE + Exact, Solve ODE + Laplace, and Solve
ODE + Series to each of the following. We solve some nu-
merically shortly.
1. j
t
= sinr
2. j
t
= sinr + t
3. j
t
= j +r
4. j
t
= j +c
or
5. 1
r
j = sinr + cos r
6. 1
r
j = sinr + cos r +t
7. j
t
= j+sinr On the same axes, plot the three solutions
with 1, 2, and 3 for the constant C
1
.
8. j
tt
+ j = r
2
Following are some systems of equations. They are en-
tered in : 1 matrices or in a display. To solve, put the in-
sertion point in the matrix and choose one of Exact, Laplace,
or Series.
1. Here is a 2 1 matrix.
1
r
j . = 1
1
r
. +j = 1
2. Here is a display. Use the enter key to add additional
equations.
j
t
= r
r
t
= j
3.
j
t
= r
r
t
= j
4.
r
t
= r + j .
j
t
= r +j + .
.
t
= r j +.
Initial Value Problems
Here are some systems with initial conditions. Again, systems
of dierential equations, along with any boundary conditions
are entered via 1 matrices. Along with the other methods,
these can be solved numerically. The solution appears as in
the rst example below. It announces that a function has
been dened. This function will appear in the list of den-
itions made, saying \j, Maple numerical process Number :
", where n is the n-th function so dened. These functions
may be evaluated and plotted. To plot these numerical so-
lutions, use Plot 2D + ODE. You can plot them using Plot
2D + Rectangular, but it is much slower. However to com-
pare graphically a numerical solution to an exact one, plot
them both using Plot 2D + Rectangular. Solve the systems
below using the various methods, and compare them graphi-
cally to the numerical ones. Of course to do this for the series
solutions, you must rst chop o the big O term.
1.
j
t
= sinr
j(0) = 1
, Exact solution is : j (r) = cos r + 2
2.
j
t
= 2j
j(0) = 2
3.
j
tt
= 2j
j(0) = 2
j
t
(0) = 1
4.
1
r
j + 2j = c
2r
j (0) = 1
5.
J
Jr
+j = c
2r
j(0) = 0
6.
1
rr
j j = 0
j(0) = 1
j
t
(0) = 0
, Exact solution is : j (r) =
1
2
t
2x
+
1
2
t
x
7.
1
r
j . = 1
1
r
. + j = 1
j(0) = 0
.(0) = 0
For systems of two equations such as
this, you can also plot the phase plane.
8.
d
2
r
dt
2
+/
dr
dt
+ cr = 0
r
t
(0) =
0
r(0) = r
0
9.
d
2
r
dt
2
+ 0.2
dr
dt
+ r = 0
r
t
(0) = 0
r(0) = 1
27
, Exact solution is : r(t) = 1.0 exp(. 1t) cos . 99499t+
. 1005 exp(. 1t) sin. 99499t
10. whose plot is:
11.
Systems that are solved numerically generate dened
functions. The exact method produces equations, but no
function denitions. Select the equation and apply Dene +
New Denition to treat the solution as a function.
For example, Solve ODE + Exact applied to the system
1
rr
j j = 0
j(0) = 1
j
t
(0) = 0
generates the output
Exact solution is: j (r) =
1
2
c
r
+
1
2
c
r
Select the equation j (r) =
1
2
c
r
+
1
2
c
r
and apply Dene +
New Denition. Now j is dened as a function, which can
be evaluated and plotted.
The solution is two functions j, . and putting the inser-
tion point in j, . and choosing Plot 2D + Phase Plane does
it. Try it on the solution to this system.
1. An exact solution, which you can get using Solve ODE
+ Exact gives two expressions in r, and treating r as the
parameter, the 2D rectangular plot gives you the phase
plane. Try it.
2.
j
t
= r
r
t
= j
r(0) = 0
j(0) = 1
3.
j
t
= r
r
t
= j
r(0) = 0
j(0) = 1
4.
r
t
= r + j .
j
t
= r +j + .
.
t
= r j + .
r(0) = 1
j(0) = 1
.(0) = 1
Subscripted dependent variables are allowed. Here are
some examples.
5.
1
r
j
1
+j
1
= c
2r
j
1
(0) = 1
6.
1
rr
j
1
j
1
= 0
j
1
(0) = 1
j
t
1
(0) = 0
And here are a couple of non-linear equations. Laplace
does nothing, as Laplace Transforms are only appropriate for
linear equations. There is no series solution in the second
example, since lnr doesn't have a series expansion about
r = 0 in powers of x.
1.
j
t
= j
2
+ 4
j(0) = 2
2.
(r + 1)j
t
+ j = lnr
j(1) = 10
Vector Calculus
Vectors may be specied in several dierent ways: as 1 by :
matrices like
_
1 2 3

, as : by 1 matrices like
_
_
1
0
1
_
_
,
or as n-tuples within brackets or parentheses like [3, 2, 1] and
2, 1, 0).
Dot and Cross Products
Here are some examples using dot and cross products. Begin
by dening =
_
1 2 3

, / =
_
_
1
0
1
_
_
, c = [3, 2, 1], and
d = (2, 1, 0).
1. (1, 2, 3) (3, 2, 1)
2. a c
3. (1, 2, 3) (3, 2, 1)
4. a c
5. (1, 2, 3)
_
_
1
0
1
_
_
(3, 2, 1)
6. (1, 2, 3) / (3, 2, 1)
7. a / c
8. (1, 2, 3) (3, 2, 1) (1, 0, 1)
9. a c (1, 0, 1)
10. (1, 2, 3) (3, 2, 1) (1, 0, 1)
The last example is computed correctly even though the
triple product is not associative since these operations as-
sociate from left to right by default. If the dot had been
rst and the cross second we would have gotten the incorrect
result
(1, 0, 1) (1, 2, 3) (3, 2, 1) = 4
_
_
3
2
1
_
_
,
which of course could be done correctly using parentheses
(1, 0, 1) ((1, 2, 3) (3, 2, 1)) = 8.
28
Vector Norms
Vector norms have been implemented for every positive in-
teger : with the usual denition: |c|
n
= (

[c
I
[
n
)
1/n
. For
the vector c = [3, 2, 1], we have |c|
1
= 6, |c|
2
=
_
14 =
3.7417, |c|
6
=
6
_
794 = 3.043, and |c|
o
= 3. The default
|c| is the 2-norm. You might wish to verify the results above
by placing the insertion point to the left of the equal signs and
pressing ctrl/cmd + e. Norm may be applied directly to
:-tuples representing vectors: |(1, 2, 3, 4)| =
_
30. The two
pairs of vertical lines used in the norm symbol can be found
on the brackets menu (select the item and apply brackets).
`|' is on the menu under the 0 icon, or you can type \Vert"
while pressing the ctrl/cmd key.
Gradient, Divergence and Curl
Gradient, divergence, and curl are notable omissions from the
Vector Calculus submenu since they are implemented as \\",
\\", and \\" followed by Evaluate. Divergence and curl
operate on 3-dimensional vector elds whose components are
functions of an ordered list of \eld variables". Our default
is that the eld variables are r, j, and ., in that order, but
this can be changed with Set Basis Variables on the Vector
Calculus submenu. Here are some examples using the default
variables, but rst make the following denitions.
1. 1 = [j., 2r., rj]
2. G = (r., 2j., .
2
)
3. H =
_
j. 2r. rj

4. ) = rj.
Now evaluate the following.
1. \1
2. \G
3. \H
4. \ 1
5. \ G
6. \ H
7. \)
8. \(j., 2r., rj)
9. \ (r., 2j., .
2
)
10. \(rj.)
Since gradients are often calculated for scalar functions
of n arbitrary variables we have implemented gradient cur-
rently by using all the variables that appear in the function,
and assuming that the variables are ordered lexicographically.
At the moment this seems better to us than the alternatives
of resetting a standard list of basis variables or popping a di-
alog box to ask for a variable list. The downside is illustrated
in these examples:
1. \
_
cn +
2
n
_
=
_
n, c, cn + 2n,
2
_
2. \rj = (j, r)
In the rst case, the user is apt to be thinking
of c as a constant parameter, and expecting the answer
_
c, cn + 2n,
2
_
and in the second he might be thinking
3-dimensionally and expecting (j, r, 0).
Scalar Potential on the Vector Calculus submenu is the
\inverse" of the gradient in the sense that it nds a scalar
function whose gradient is the given vector eld, or tells you
that such a function does not exist. Here are some examples
of scalar potential with the standard basis variables:
1. (r, j, .), Scalar potential is
1
2
.
2
+
1
2
j
2
+ )rac12r
2
2. (r, ., j), Scalar potential is j. +
1
2
r
2
3. (j, ., r), Scalar potential does not exist
In the next example evaluate and then choose Scalar
Potential on the menu (since the vector eld is a gradient, it
has the original function as a scalar potential):
\
_
rj
2
+ j.
3
_
We noted earlier that a user would expect nc +
2
n to
be the potential of the vector eld
_
c, cn + 2n,
2
_
. We
do get this answer because when we nd a dierent number of
variables than the number of components in the eld vector,
a dialog box asks for the eld variables, which we enter as
\n, , n". The dialog box will also appear when we ask for
the scalar potential of (j, r, 0).
Hessian
The Hessian is the matrix of second partial derivatives of a
scalar expression of n variables. The order of the variables af-
fects the ordering of the rows and columns of the Hessian, and
we take partials in lexicographical order. A possible source
of irritation is the inclusion of something in the variable list
which you intend to be a constant parameter, like c in crj..
In this case, you will have to delete the rst row and column
of the resulting matrix to get what you want. Choose Hessian
on the vector calculus menu in these examples:
1. rj.
2. r
2
+ j
3
3. nn
4. nrj.
Also dene )(r, j, .) = 3rj
2
. and choose Hessian with
the selection (r, j, .)
Jacobian
A Jacobian is the matrix of partial derivatives of the entries
in a vector eld. Jacobians are like Hessians, in that the order
of the variables in the variable list determines the order of the
columns of the matrix, and lexicographic order is apt to be
correct. The number of variables should be the same as the
29
dimension of the vector, and if it isn't, either a parameter
has been included in the variable list or the vector eld is
independent of one of the variables. In this case a dialog box
asks the user for the list of variables. Here are some examples
to try (in each case the variable list is \r, j, ."):
1. (j., r., rj)
2. y is missing (r
2
., r +., r.
2
)
3. c is extra (r
2
., j + c, j.
2
)
Curl and Vector Potential
The current approach is to assume that these operations ap-
ply to scalar or vector functions of a set of exactly 3 standard
basis variables. The default is \r, j, .", but as noted above
you can specify your own set of basis variables using Vector
Calculus + Set Basis Variables. This seems better than pop-
ping a dialog box whenever one of these operations is used.
Example:
\ (rj, j., .r) = (j, ., r). Vector potential is
|c)t(
1
2
.
2
+ rj, j., 0
Notice that we didn't get the eld we started with when
we asked for a vector potential of its curl. That is because
the vector potential is determined only up to a eld whose
curl is zero. We check that this is the case:
\(
1
2
.
2
, 0, .r) = (0, 0, 0)
Try the same experiment after changing the basis vari-
ables to n, , n.
\ (n, n, nn) = (, n, n). Vector potential is
|c)t(
1
2
n
2
+ n, n, 0
The vector eld can be written as the triple (, n, n) as
well as a column matrix. Try choosing Vector Potential for
(, n, n).
Divergence
The divergence is the sum of the derivatives of the i
||
com-
ponent of the vector eld with respect to the i
||
variable. At
the moment divergence applies only to 3-dimensional elds
with whatever set of basis variables is in eect.
\ (rj, j., .r) = j +. + r
Statistics
Scientic WorkPlace supports a number of the standard sta-
tistical distribution functions and densities, including a facility
for getting random samples from dierent families of distrib-
utions. It also will do statistical operations on data.
The items Mean, Median, Mode, Moment, Quantile
Standard Deviation, and Variance on the Statistics submenu
take a single argument that can be presented as a list of data
or as a matrix. The result of an operation is a number, or,
in the case of a matrix, a number for each column.
The items Correlation, Covariance, and Fit Curve to
Data on the Statistics submenu take a single argument that
must be a matrix. For the curve tting commands, the
columns must be labeled with variable names. The menu
item Random Numbers on the Statistics submenu allows you
to get random samples from families of distributions listed in
the dialog box that appears when you choose Random Num-
bers.
Lists and Matrices
Scientic WorkPlace stores data in lists or in matrices. Num-
bers in a list should be separated by commas, with the num-
bers and commas both in mathematics mode. A list can be
reshaped into a matrix using Matrices + Reshape.
An ASCII le containing a list of numbers separated by
commas or appearing as a column can be imported into a Sci-
entic WorkPlace document. The le should have a name
of type lename.txt. From the File menu, choose Import
Contents, the ASCII lter, and enter the name of the le
containing the list. Add commas between the numbers if
needed, and then select the entire list and change to mathe-
matics. You can then work with the data as a list or reshape
it into a matrix by choosing Reshape from the Matrices sub-
menu. Of course a matrix itself can be reshaped using the
same procedure.
Mean, Median, Mode, Moment, Quantile, Mean Deviation,
Standard Deviation, and Variance
These items from the Statistics submenu take a single argu-
ment which must be a list, a matrix, or a labeled matrix. A
labeled matrix is one whose entry in the rst row and rst
column is not numeric. In this case the rst row is meant to
be variable names. The only computations that require such
matrices are the regression ones. Other computations may
be applied to labeled matrices, but the operations ignore the
rst row. Examples follow.
1. Find the mean, median, etc. of the data
23, 5, 6, 18, 23, 22, 5. To do it, put the insertion point
in this list and choose the appropriate item from the Sta-
tistics submenu.
Notice the dierence between the second moment about
the mean and the variance. Variances are computed as
sample variances. That is, : 1 is used as the divisor
rather than :, where : is the number of data points.
A median of a data set is a number such that at least
half the numbers in the set are equal to or less than it,
and at least half the numbers in the set are equal to
or greater than it. If two dierent numbers satisfy this
criteria, their midpoint is taken as the median.
The jth quantile of a set, where j is a number between
zero and one, is a number

satisfying the condition


that the fraction j of the numbers fall below

and
the fraction 1 j lie above

. The .5th quantile is a


median or 50th percentile, while the 0.25th quantile is
the rst quartile or the 25th percentile, and so forth.
The jth quantile is not unique, and the particular one
Maple chooses to return is a bit mysterious.
Reshape the list above into a 7 by 1 matrix and do the
same computations.
30
2. Apply the operations above to the data given by the
matrix
_
_
23 5 6
18 23 22
5 0 0
_
_
.
3. Apply the operations above to the data given by the
matrix
_
_
_
_
_
_
r j .
1 1 4
3 2 5
5 3 6
7 4 7
_
_
_
_
_
_
.
4. Apply the operations above to the data given by the
matrix
_
_
a /
c d
) q
_
_
. Of course Median and Quantile make
no sense on this one.
Correlation and Covariance
These two operate on :: matrices and return : : ma-
trices. Apply them to the following sets of data.
1.
_

_
1 1 4
3 2 5
5 3 6
7 4 7
_

_
2.
_
_
_
_
43 62
77 66
54 5
99 61
_
_
_
_
3.
_
_
50 12
31 26
1 47
_
_
4.
_

_
a / c
50 12 18
31 26 62
1 47 91
_

_
Random Numbers
The random number generators in Scientic WorkPlace give
you random samples from one of several families of distrib-
ution functions: Beta, Binomial, Cauchy, Chi-Square, Expo-
nential, F, Gamma, Hypergeometric, Normal, Poisson, Stu-
dent's T, Uniform, and Weibull. From the Statistics sub-
menu, choose Random Numbers and from the dialog box
that comes up, choose the distribution (with appropriate pa-
rameters) and how large a sample you want. Random samples
come back as lists. Try it out.
Distributions and Densities
Scientic WorkPlace includes several families of distribu-
tions: Normal, Student's T, Chi-square, F, Exponential,
Weibull, Gamma, Beta, Uniform, Binomial, Poisson, and Hy-
pergeometric. We give a table here listing the name of the
distribution, the name used by Scientic WorkPlace for the
cumulative distribution function, and the parameters each
takes (df = degrees of freedom). If the cumulative distribu-
tion functions is named FunctionDist, then the density func-
tion is named FunctionDen, and the inverse of the cumulative
function is named FunctionInv.
Normal NormalDist(x; mean, std dev)
Student's T TDist(x; df)
Chi-Square ChiSquareDist(x; df)
Exponential ExponentialDist(x; mean)
F FDist(x; num df, den df )
Weibull WeibullDist(x; shape, scale)
Gamma GammaDist(x; shape, scale)
Cauchy CauchyDist(x; median, something)
Beta BetaDist(x; rst shape, second shape)
Uniform UniformDist(x; left end, right end )
Binomial BinonialDist(x; tries, prob of success)
Hypergeometric HypergeomDist(x; pop, successes, tries)
Poisson PoissonDist(x; mean)
When typed in mathematics mode, Scientic Work-
Place will recognize these function names and they will
appear in gray when you type their last letter. Some of
these names are quite long, so you may want to use Auto-
matic Substitution under the Tools menu so you can use
fewer keystrokes. Or, you may want to give them other
names. For example, if you would rather use : for the
normal density with mean 2 and variance 4, make the de-
nition :(r) = NormalDen(r; 2, 4). Actually, you can use
a comma instead of the semicolon to separate the argu-
ment from the parameters. So you can dene, for example,
)(r, j, r) = UniformDenr, j, .).
Following are some examples for you to try out.
1. If the parameters are left o the Normal, then it assumes
a standard normal, that is that the mean is 0 and the
standard deviation is 1. valuate the standard normal
distribution function at 2.44. You should get .99266.
Plot the standard normal distribution function. Does
..99266 look about right from the plot?
2. Evaluate
_
0
o
NormalDen(r)dr and
|i:)n:cor:a|1i:t(0).
3. Evaluate
_
o
o
rNormalDenr; 4, 1)dr.
4. Evaluate
_
o
o
(r 4)
2
NormalDenr; 4, 1)dr.
5. Plot on the same axis the three normal den-
sity functions with mean and variances given by
(0, 1), (0, 5), (0, .5), and (1, 1). Do the same thing
for the normal distributions functions with those para-
meters.
6. Calculate Student's t distribution function with one de-
gree of freedom at 63.66. Calculate the inverse of Stu-
dent's t distribution with one degree of freedom at the
answer you just got. Do the same thing for three degrees
of freedom at .97847.
31
7. Calculate TDist(6; 5) + TDist(6; 5). Explain.
8. Evaluate
_
0
o
TDen(r; 5)dr and |i:)n:cT1i:t(0; 5).
9. Evaluate
_
o
o
rTDen(r; 5)dr.
10. Plot on the same axis the density functions for Student's
t with 1 degree of freedom and with 15 degrees of free-
dom. Do the same thing for the distribution functions.
32

You might also like