{VERSION 2 3 "HP RISC UNIX" "2.3" }
{USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0
1 0 0 0 0 }{CSTYLE "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 0
0 }{CSTYLE "Hyperlink" -1 17 "" 0 1 0 128 128 1 0 0 1 0 0 0 0 0 0 }
{CSTYLE "2D Comment" 2 18 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }{CSTYLE "
" -1 256 "" 1 14 0 0 2 0 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 257 "" 1 14
0 0 2 0 0 0 1 0 0 0 0 0 0 }{CSTYLE "" -1 258 "" 0 1 26 0 248 0 0 0 1
0 0 0 0 0 0 }{CSTYLE "" -1 259 "" 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 }
{CSTYLE "" -1 260 "" 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 }{CSTYLE "" -1 261
"" 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 }{CSTYLE "" -1 262 "" 0 1 248 0 0 0
1 2 0 0 0 0 0 0 0 }{CSTYLE "" -1 263 "" 0 1 4 1 0 0 0 0 1 0 0 0 0 0 0
}{CSTYLE "" -1 264 "" 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 }{CSTYLE "" -1
265 "" 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 }{CSTYLE "" -1 266 "" 0 1 0 0 7
0 0 0 1 0 0 0 0 0 0 }{CSTYLE "" -1 267 "" 1 14 0 0 0 0 0 0 0 0 0 0 0
0 0 }{CSTYLE "" -1 268 "" 1 14 124 1 100 0 0 0 0 0 0 0 0 0 0 }{CSTYLE
"" -1 269 "" 0 1 0 0 31 0 0 0 1 0 0 0 0 0 0 }{CSTYLE "" -1 270 "" 0 1
0 0 152 0 0 0 1 0 0 0 0 0 0 }{CSTYLE "" -1 271 "" 0 1 110 116 32 0 0
0 1 0 0 0 0 0 0 }{CSTYLE "" -1 272 "" 0 1 0 0 248 0 0 0 1 0 0 0 0 0 0
}{CSTYLE "" -1 273 "" 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 }{CSTYLE "" -1
274 "" 0 1 0 0 28 0 0 0 1 0 0 0 0 0 0 }{CSTYLE "" -1 275 "" 0 1 0 0
26 0 0 0 1 0 0 0 0 0 0 }{CSTYLE "" -1 276 "" 0 1 0 0 1 0 1 0 0 0 0 0
0 0 0 }{CSTYLE "" -1 277 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE ""
-1 278 "" 0 1 0 0 16 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 279 "" 0 1 0
0 240 0 0 0 1 0 0 0 0 0 0 }{CSTYLE "" -1 280 "" 0 1 0 0 0 0 0 0 1 0 0
0 0 0 0 }{CSTYLE "" -1 281 "" 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 }{CSTYLE "
" -1 282 "" 0 1 0 0 48 0 0 0 1 0 0 0 0 0 0 }{CSTYLE "" -1 284 "" 0 1
0 0 0 0 2 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 285 "" 0 1 0 0 28 0 2 0 0 0
0 0 0 0 0 }{CSTYLE "" -1 286 "" 0 1 183 0 0 0 2 0 0 0 0 0 0 0 0 }
{CSTYLE "" -1 287 "" 0 1 171 115 165 0 2 0 0 0 0 0 0 0 0 }{CSTYLE ""
-1 288 "" 0 1 0 0 0 0 2 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 289 "" 0 1 183
0 0 0 2 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 290 "" 0 1 0 0 0 0 2 0 0 0 0 0
0 0 0 }{CSTYLE "" -1 291 "" 0 1 0 0 0 0 0 2 0 0 0 0 0 0 0 }{CSTYLE ""
-1 292 "" 0 1 0 0 0 0 0 2 0 0 0 0 0 0 0 }{PSTYLE "Normal" -1 0 1
{CSTYLE "" -1 -1 "Helvetica" 0 10 243 63 203 0 2 1 2 0 0 0 0 0 0 }0 0
0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Heading 1" 0 3 1 {CSTYLE "" -1
-1 "" 1 18 255 255 0 0 0 1 0 0 0 0 0 0 0 }1 0 0 0 6 6 0 0 0 0 0 0 -1
0 }{PSTYLE "Heading 2" 3 4 1 {CSTYLE "" -1 -1 "" 1 14 0 0 0 0 0 0 0 0
0 0 0 0 0 }0 0 0 -1 4 4 0 0 0 0 0 0 -1 0 }{PSTYLE "Heading 3" 4 5 1
{CSTYLE "" -1 -1 "" 1 12 171 191 99 0 1 0 0 0 0 0 0 0 0 }0 0 0 -1 0 0
0 0 0 0 0 0 -1 0 }{PSTYLE "Bullet Item" 0 15 1 {CSTYLE "" -1 -1 "" 0
1 201 232 0 0 0 0 0 0 0 0 0 0 0 }0 0 0 -1 3 3 0 0 0 0 0 0 15 2 }
{PSTYLE "R3 Font 0" -1 256 1 {CSTYLE "" -1 -1 "Helvetica" 0 12 107 1
11 0 2 1 2 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "R3 F
ont 2" -1 257 1 {CSTYLE "" -1 -1 "Courier" 0 12 0 0 17 0 2 1 2 0 0 0
0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "R3 Font 3" -1 258 1
{CSTYLE "" -1 -1 "Lucida" 0 14 0 0 20 0 1 1 2 0 0 0 0 0 0 }0 0 0 -1
-1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "R3 Font 4" -1 259 1 {CSTYLE "" -1 -1
"Lucida" 0 14 0 0 0 0 1 1 2 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0
-1 0 }{PSTYLE "R3 Font 5" -1 260 1 {CSTYLE "" -1 -1 "Lucida" 0 14 248
164 246 0 1 1 2 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE
"R3 Font 6" -1 261 1 {CSTYLE "" -1 -1 "Lucida" 0 14 232 191 237 0 1 1
2 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "R3 Font 7"
-1 262 1 {CSTYLE "" -1 -1 "Charter" 0 18 232 191 237 0 1 2 2 0 0 0 0
0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "R3 Font 8" -1 263 1
{CSTYLE "" -1 -1 "Charter" 0 18 0 0 27 0 1 2 2 0 0 0 0 0 0 }0 0 0 -1
-1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "R3 Font 9" -1 264 1 {CSTYLE "" -1 -1
"Charter" 0 18 29 200 132 0 1 2 2 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0
0 0 -1 0 }{PSTYLE "R3 Font 10" -1 265 1 {CSTYLE "" -1 -1 "Charter" 0
18 0 0 0 0 1 2 2 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }
{PSTYLE "R3 Font 11" -1 266 1 {CSTYLE "" -1 -1 "Charter" 0 18 16 1
116 0 1 2 2 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "R3 \+
Font 12" -1 267 1 {CSTYLE "" -1 -1 "Lucida" 0 14 0 0 240 0 1 1 2 0 0
0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "R3 Font 13" -1 268
1 {CSTYLE "" -1 -1 "Lucida" 0 14 3 1 20 0 1 1 2 0 0 0 0 0 0 }0 0 0 -1
-1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "R3 Font 14" -1 269 1 {CSTYLE "" -1
-1 "Lucida" 0 14 0 0 101 0 1 1 2 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0
0 0 -1 0 }{PSTYLE "R3 Font 15" -1 270 1 {CSTYLE "" -1 -1 "Lucida" 0
14 0 0 20 0 1 1 2 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }
{PSTYLE "R3 Font 16" -1 271 1 {CSTYLE "" -1 -1 "Courier" 0 14 0 0 0 0
1 1 2 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "R3 Font 1
7" -1 272 1 {CSTYLE "" -1 -1 "Courier" 0 14 16 1 120 0 1 1 2 0 0 0 0
0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "R3 Font 18" -1 273 1
{CSTYLE "" -1 -1 "Courier" 0 14 0 0 254 0 1 1 2 0 0 0 0 0 0 }0 0 0 -1
-1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "R3 Font 19" -1 274 1 {CSTYLE "" -1
-1 "Courier" 0 14 0 0 25 0 1 1 2 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0
0 0 -1 0 }{PSTYLE "R3 Font 20" -1 275 1 {CSTYLE "" -1 -1 "Courier" 0
14 0 0 1 0 1 1 2 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }
{PSTYLE "R3 Font 21" -1 276 1 {CSTYLE "" -1 -1 "Lucidatypewriter" 0
14 16 1 56 0 2 1 2 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }
{PSTYLE "R3 Font 22" -1 277 1 {CSTYLE "" -1 -1 "Lucidatypewriter" 0
14 0 0 0 0 2 1 2 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }
{PSTYLE "R3 Font 23" -1 278 1 {CSTYLE "" -1 -1 "Lucidatypewriter" 0
14 0 0 0 0 2 1 2 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }
{PSTYLE "R3 Font 24" -1 279 1 {CSTYLE "" -1 -1 "Lucidatypewriter" 0
14 16 1 132 0 2 1 2 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }
{PSTYLE "R3 Font 25" -1 280 1 {CSTYLE "" -1 -1 "Lucidatypewriter" 0
14 0 0 47 0 2 1 2 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }
{PSTYLE "R3 Font 26" -1 281 1 {CSTYLE "" -1 -1 "Lucidatypewriter" 0
14 16 1 176 0 2 1 2 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }
{PSTYLE "R3 Font 27" -1 282 1 {CSTYLE "" -1 -1 "Lucidatypewriter" 0
14 0 0 0 0 2 1 2 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }
{PSTYLE "R3 Font 28" -1 283 1 {CSTYLE "" -1 -1 "Lucidatypewriter" 0
14 236 191 196 0 2 1 2 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }
{PSTYLE "" 0 284 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }
3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }}
{SECT 0 {SECT 0 {PARA 284 "" 0 "top" {TEXT 256 1 " " }{TEXT 257 43 " A
Short Introduction to the Maple Language" }}{PARA 0 "" 0 "" {TEXT -1
0 "" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 299 "This section contains an i
ntroduction to the Maple vocabulary used for solving problems. It is
not meant to cover everything, just some of the basics. In most inst
ances, only the Maple input is described; I am assuming that you are '
typing along', so that you can see the Maple output as we go. " }}}
{SECT 1 {PARA 4 "" 0 "" {TEXT -1 12 " Arithmetic" }}{PARA 0 "" 0 ""
{TEXT -1 0 "" }}{EXCHG {PARA 0 "" 0 "arithmetic" {TEXT -1 292 "First, \+
there is arithmetic: addition, subtraction, multiplication, division a
nd exponentiation. These can be combined, just as on a calculator. Th
e order of precedence is the the usual one: exponentiation first, the
n multiplication and division, then addition and subtraction. So ente
ring " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1
0 13 " 2-3+4/5*6^7;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA
0 "" 0 "" {TEXT -1 25 " is the same as entering " }}{PARA 0 "" 0 ""
{TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "(2-3)+(4/5)*(6^7);
" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1
101 "Maple works with fractions whenever possible, changing to decimal
numbers only on demand. So typing " }}{PARA 0 "" 0 "" {TEXT -1 0 ""
}}{PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "1/3 + 1/2;" }}}{EXCHG {PARA 0 ""
0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 194 "will get a return o
f 5/6. Putting a decimal point in one of the numbers forces Maple to
return a decimal answer. Also, you can use the maple word evalf t
o convert a result to decimal form." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }
}{PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "evalf(1/2+1/3);" }}}{EXCHG {PARA
0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 ""
0 "" {TEXT -1 112 "Maple does arithmetic with complex numbers too. I
is a Maple constant standing for sqrt(-1) . So entering " }}
{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "(3+
2*I)*(2-I);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG
{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 35 "will prod
uce an output of 8+I . " }}{PARA 0 "" 0 "" {TEXT -1 1 " " }}{PARA
0 "" 0 "" {TEXT -1 147 "The name for pi, the area of the circle of rad
ius 1, in [ Maplese ] is Pi . So to calculate the area of a circ
le of radius 3, you would enter" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}
{PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "Pi*3^2;" }}}{EXCHG {PARA 0 "> " 0 "
" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 4 "" 0 "" {TEXT -1 50 " Express
ions, Names, Statements, and Assignments" }}{EXCHG {PARA 5 "" 0 "expr
essions" {TEXT 287 54 " Quantities to be computed like 1/2+1/3 are ca
lled " }{TEXT 258 11 "expressions" }{TEXT -1 10 " . A " }{TEXT
259 4 "name" }{TEXT 285 88 " is a string of characters which can be u
sed to store the result of a computation. A " }{TEXT 260 9 "statemen
t" }{TEXT 284 5 " in " }}}{EXCHG {PARA 5 "" 0 "names" {TEXT 290 174 "
Maple is a string of names and expressions terminated with a semicolon
, or a colon if you don't want to see the output, which when entered
will produce some action. The " }}}{EXCHG {PARA 5 "" 0 "assignment
" {TEXT 261 10 "assignment" }{TEXT 286 69 " statement is one of the \+
most common statements. It is of the form" }}{PARA 5 "" 0 "" {TEXT
289 1 " " }{XPPEDIT 18 0 "name := value" ">%%nameG%&valueG" }{TEXT
288 32 "; For example, the assignment " }{MPLTEXT 1 0 0 "" }}}{PARA
4 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "ar
ea := Pi*3^2;" }}}{PARA 5 "" 0 "" {TEXT -1 63 "stores the value 9*Pi
in a location marked by the name area." }}{PARA 0 "" 0 "" {TEXT -1
53 "A more useful assignment for the area of a circle is " }}{PARA 0 "
" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "area \+
:= Pi*r^2;" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT
-1 215 "In this case, the expression Pi*r^2 is stored in area and w
ith this assignment, the area of a circle of any given radius can be c
omputed using the Maple word subs. So to calculate the area when r is
3, we enter " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> "
0 "" {MPLTEXT 1 0 15 "subs(r=3,area);" }}}{PARA 0 "" 0 "" {TEXT -1 0 "
" }}{PARA 0 "" 0 "function" {TEXT -1 80 "Here, it is convenient to thi
nk of the assignment as defining area as a function" }}{PARA 0 "" 0 "
" {TEXT 291 1 " " }{TEXT -1 17 " of the radius r." }{TEXT 292 2 " \n"
}}}{SECT 1 {PARA 4 "" 0 "" {TEXT 262 2 " " }{TEXT -1 10 "Functions "
}}{PARA 5 "" 0 "" {TEXT -1 204 "We are thinking here of the notion of \+
[ function ] as a rule f (possibly very complicated) for assigning t
o each argument x in a given set of numbers a unique number f(x) calle
d the value of f at x. " }}{PARA 0 "" 0 "" {TEXT -1 1 " " }}{PARA
0 "" 0 "" {TEXT -1 58 " Functions can be defined in several useful way
s in Maple." }}{PARA 0 "" 0 "" {TEXT -1 1 " " }}{PARA 0 "" 0 "expressi
on" {TEXT -1 1 " " }{TEXT 263 16 "As an expression" }{TEXT -1 18 ": Th
e assignment " }}{PARA 5 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> "
0 "" {MPLTEXT 1 0 15 "area := Pi*r^2;" }}}{PARA 0 "" 0 "" {TEXT -1 0 "
" }}{PARA 0 "" 0 "" {TEXT -1 265 "defines the area of a circle as a fu
nction of it's radius. The area function defined as an expression is e
valuated with subs. Since this function assigns real numbers to real \+
numbers, its values can be plotted on a graph with the Maple word plot
. So the statement" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0
"> " 0 "" {MPLTEXT 1 0 18 "plot(area,r=0..4);" }}}{PARA 0 "" 0 ""
{TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 70 "will produce in a separat
e plot window, the graph of the area function" }}{PARA 0 "" 0 ""
{TEXT -1 34 "over the interval from r=0 ..4 ." }}{PARA 0 "" 0 ""
{TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 1 " " }{TEXT 264 38 "With the
arrow operator the assignment" }{TEXT -1 1 ":" }}{PARA 0 "" 0 ""
{TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "area := r ->
Pi*r^2;" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1
108 "defines the area function also. Now to find the area of a circle
of radius 3, we simply enter the statement" }}{PARA 0 "" 0 "" {TEXT
-1 0 "" }}{EXCHG {PARA 4 "> " 0 "" {MPLTEXT 1 0 9 " area(3);" }}}
{PARA 0 "" 0 "" {TEXT -1 1 " " }}{PARA 0 "" 0 "" {TEXT -1 55 "To plot \+
this function over the domain r=0..4 , type " }}{PARA 5 "" 0 ""
{TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "plot(area,0.
.4);" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 43 "
Note that the variable r is omitted here. " }}{PARA 0 "" 0 "" {TEXT
-1 0 "" }}{PARA 0 "" 0 "unapply" {TEXT 265 11 "Use unapply" }{TEXT -1
181 " . This ugly little word transforms expressions of one or more \+
variables into fuctions defined by an arrow operator. For example, if
we had a polynomial defined by the assignment" }}{PARA 0 "" 0 ""
{TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "pol := x^2 +
4*x -1;" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1
19 "then the assignment" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG
{PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "pol := unapply(pol,x);" }}}{PARA 0
"" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 60 "turns po l into
a function defined by an arrow operator. " }}{PARA 0 "" 0 "" {TEXT
-1 0 "" }}{PARA 0 "" 0 "procedure" {TEXT 266 14 "As a procedure" }
{TEXT -1 18 ": the assignment " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 28 " area := proc(r) Pi*r^2 end;
" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 446 "def
ines the area function too. It is evaluated and plotted as in the [ \+
arrow operator ] definition. One advantage of this way of defining \+
a function is that the domain can be specified. For example, the doma
in of the area function for a circle is all positive real numbers. Th
is can be inserted into the procedure, with the Maple word ERROR . \+
The message must be\nenclosed in backquotes ` , which is on the key
with the tilde . " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG
{PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "area := proc(r) " }}{PARA
0 "> " 0 "" {MPLTEXT 1 0 55 " if r <= 0 then ERROR(`radius must be pos
itive`) else " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "Pi*r^2 fi end;" }
}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "area(3);" }}}{EXCHG {PARA
0 "> " 0 "" {MPLTEXT 1 0 9 "area(-3);" }}}{PARA 0 "" 0 "" {TEXT -1 0 "
" }}{PARA 0 "" 0 "" {TEXT -1 292 "Note the if ... then ... fi; control
statement here. Use ?if to learn more about this command. Funct
ions of two variables can be defined and plotted just as easily in Ma
ple as functions of one variable. \n \nFor example, the volume V of a
cylinder of height h and radius r is defined by" }}{PARA 0 "" 0 ""
{TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "V := (r,h) -
> Pi*r^2*h;" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT
-1 53 "To see what the graph of V looks like, use plot3d :" }}{PARA
0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "pl
ot3d(V,0..4,0..4);" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "
" {TEXT -1 75 "Which way of defining a function is the preferred way? \+
That really depends" }}{PARA 0 "" 0 "" {TEXT -1 71 "on the situation.
The expression method works well for functions which" }}{PARA 0 ""
0 "" {TEXT -1 71 "have only one rule of evaluation, but eventually you
cannot avoid using" }}{PARA 0 "" 0 "" {TEXT -1 80 "an -> or pro
c definitiion. You will find yourself using arrow or proc" }}
{PARA 0 "" 0 "" {TEXT -1 42 "definitions more and more as time goes by
." }}}{SECT 1 {PARA 4 "" 0 "" {TEXT 267 56 " Built in Maple functions
and Operations with Functions" }}{PARA 0 "" 0 "" {TEXT -1 346 " All o
f the standard scientific functions are built into Maple. For example
, sqrt is the square root function, abs is the absolute value fu
nction, the trig and inverse trig functions are sin , arcsin , c
os , etc., the natural logarithm and exponential functions are ln a
nd exp . For a complete list of built in functions, type " }}{PARA
0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "?i
nifcns; " }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "composition
" {TEXT -1 256 " New functions can be obtained from old functions by u
se of the arithmetic operations of addition, subtraction, multiplicati
on, and division together with the operation of composition, which is \+
denoted by @ . Thus the function defined by the assignment " }}
{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0
21 "y := sin(cos(x^2+3));" }}}{PARA 0 "" 0 "" {TEXT -1 28 " and evalua
ted at x=3 by " }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "subs(x=
3.,y);" }}}{PARA 0 "" 0 "" {TEXT -1 39 "could also be defined by the a
ssignment" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "y := sin@cos@(x
->x^2+3);" }}}{PARA 0 "" 0 "" {TEXT -1 28 " and evaluated at x=3 b
y" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "y(3.);" }}}}{SECT 1
{PARA 4 "" 0 "" {TEXT -1 45 " Using Maple as a fancy graphing calcula
tor." }}{PARA 0 "" 0 "" {TEXT -1 1 " " }}{PARA 0 "" 0 "" {TEXT -1 69 "
It is convenient to think of Maple as a fancy graphing calculator for
" }}{PARA 0 "" 0 "" {TEXT -1 72 "many purposes. For example, suppose \+
you want to find the real solutions" }}{PARA 0 "" 0 "" {TEXT -1 18 "of
the equation " }{XPPEDIT 18 0 "x^5 - 30*x - 2 = 0" "/,(*$%\"xG\"\"&
\"\"\"*&\"#IF'F%F'!\"\"\"\"#F*\"\"!" }{TEXT -1 20 " in the interval \+
" }{XPPEDIT 18 0 "-3..3" ";,$\"\"$!\"\"\"\"$" }{TEXT -1 15 " . Then \+
we can" }}{PARA 0 "" 0 "" {TEXT -1 49 "just plot the right hand sid
e of the equation." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "
> " 0 "" {MPLTEXT 1 0 30 " f := x -> 10*x^5 - 30*x +10 ;" }}}{PARA 0 "
" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 " plot
(f,-3..3);" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT
-1 61 "By inspection, the graph crosses near 0. We can look closer."
}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1
0 21 " plot(f,-1.5..1.5); " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0
0 "" }}}{PARA 0 "" 0 "" {TEXT -1 74 " We see that the graph crosses 3 \+
times, the largest solution being between" }}{PARA 0 "" 0 "fsolve"
{TEXT -1 88 "1 and 1.5. If we wanted the largest solution more accur
ately, we could use fsolve . " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 25 " fsolve(f(x)=0,x,1..1.5);" }
}}{PARA 3 "" 0 "" {TEXT -1 0 "" }}}{SECT 1 {PARA 4 "" 0 "" {TEXT -1
66 " Data types, Expression Sequences, Lists, Sets, Arrays, Tables: \+
" }}{EXCHG {PARA 0 "" 0 "data types" {TEXT -1 263 "Maple expressions a
re classified into various [ data types ] . For example, arithmetic \+
expressions are classified by whether they are sums [ type '+' ] , p
roducts [ type '*' ] , etc. The Maple word whattype will tell wha
t type a particular expression is." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}
{PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "whattype(1/2);" }}}{EXCHG {PARA 0 "
> " 0 "" {MPLTEXT 1 0 16 "whattype(a + b);" }}}{EXCHG {PARA 0 "> " 0 "
" {MPLTEXT 1 0 28 "whattype(x^2 + x = 2*x - 1);" }}}{EXCHG {PARA 0 "> \+
" 0 "" {MPLTEXT 1 0 16 "whattype(a,b,3);" }}{PARA 0 "" 0 "" {TEXT -1
1 " " }}}{EXCHG {PARA 0 "" 0 "expression sequence" {TEXT -1 4 " " }
{TEXT 281 20 "Expression Sequence." }{TEXT -1 114 " \n \n An exprse
q , [ expression sequence ] , is any sequence of expressions separate
d by commas. For example, " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA
0 "> " 0 "" {MPLTEXT 1 0 50 "expseq := 1,2, w*r+m, a=b+c, 1/2, (x+y)/z
,`hello`;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 ""
{TEXT -1 92 "is an assignment to expseq of an expression sequence \+
of 7 expressions. To refer to the " }}{PARA 0 "" 0 "" {TEXT -1 68 "si
xth expression in this sequence, use the expression exseq[6]; " }}
{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "exp
seq[6]; " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 ""
{TEXT -1 1 " " }}{PARA 0 "" 0 "list" {TEXT -1 3 " " }{TEXT 282 4 "Li
st" }{TEXT -1 76 ". A [ list ] is an expression sequence enclosed \+
by square brackets. So " }}{PARA 0 "" 0 "" {TEXT -1 1 " " }}{PARA 0 "
> " 0 "" {MPLTEXT 1 0 19 "explist:= [expseq];" }}}{EXCHG {PARA 0 "" 0
"" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 87 "makes a list whose ter
ms are those in expseq . As with expression sequences, we can" }}
{PARA 0 "" 0 "" {TEXT -1 84 "refer to particular terms of a list by ap
pending to its name the number of the term " }}{PARA 0 "" 0 "" {TEXT
-1 92 "enclosed in square brackets. Thus to get the fifth term of e
xplist , type the expression" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}
{PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "explist[3];" }}}{EXCHG {PARA 0 ""
0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 60 "You can also referen
ce the fifth term in this list by typing" }}{PARA 0 "" 0 "" {TEXT -1
1 " " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "op(3,explist);" }}}{EXCHG
{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 75 " In gener
al, op(n,explist); returns the nth term in the list explist ." }}
{PARA 0 "" 0 "" {TEXT -1 77 "To count how many terms are in a list, us
e the word nops . So for example," }}{PARA 0 "" 0 "" {TEXT -1 0 ""
}}{PARA 0 "> " 0 "" {MPLTEXT 1 0 15 " nops(explist);" }}{PARA 0 "" 0 "
" {TEXT -1 1 " " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 88 "tells us that \+
there are 7 terms in the list explist . nops comes in handy when
you" }}{PARA 0 "" 0 "" {TEXT -1 84 "don't want to (or can't) count th
e terms in a list by hand (this is almost always). " }}{PARA 0 "" 0 "
" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 242 "You can't directly use
the word nops to count the number of terms in an expression sequen
ce. But you can put square brackets around the expression sequence a
nd count the terms in the resulting list. This device is used again \+
and again." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 13 " nops(3,4,a);" }}}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "nops([3,4,a]);" }}}{EXCHG
{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 180 "One impo
rtant use of lists is to make lists of points to plot. For example, t
o draw a picture of the square with vertices (1,1), (3,1), (3,3), (1,3
), make a list and then plot it." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}
{PARA 0 "> " 0 "" {MPLTEXT 1 0 38 "ab := [[1,1],[3,1],[3,3],[1,3],[1,1
]];" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "plot(ab);" }}}{EXCHG
{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 73 "Notice in
the graph that the origin is not included in the field of view." }}
{PARA 0 "" 0 "" {TEXT -1 107 "We can specify that by restricting the x
and y coordinates. We can also\nchoose to have no axes displayed."
}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "plot(ab,x=0..4,y=0..4);" }}
{PARA 0 "" 0 "" {TEXT -1 1 " " }}}{EXCHG {PARA 0 "" 0 "parametric plot
s" {TEXT -1 84 "Another use of lists is with [ parametric plots ]
. If you have a curve in the" }}{PARA 0 "" 0 "" {TEXT -1 40 "plane \+
described parametrically with " }{XPPEDIT 18 0 "x = f(t) " "/%\"xG-
%\"fG6#%\"tG" }{TEXT -1 4 ", " }{XPPEDIT 18 0 "y = g(t)" "/%\"yG-%\"
gG6#%\"tG" }{TEXT -1 322 " , as the parameter t runs from a to b, the
n you can draw it by making up a 3 term list to give to plot. Say yo
u wanted to draw the upper half of the circle of radius 4 centered at
(1,5). Then the list consists of the expressions for the x and y co
ordinates followed by an equation giving the range of the parameter."
}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT
1 0 60 " plot( [1+4*cos(t),5+4*sin(t),t=0..Pi],scaling=constrained);"
}}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1
102 " If you had to draw several pieces of circles, you might define a
function circ to simplify things." }}{PARA 0 "> " 0 "" {MPLTEXT 1
0 55 " circ := (h,k,r,f,l) -> [h+r*cos(t),k+r*sin(t),t=f..l];" }}}
{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 121 " \+
So if we wanted circles of radius 1/2 centered at the corners of the s
quare ab we can construct the sequence of lists" }}{PARA 0 "> " 0 "
" {MPLTEXT 1 0 50 " circs := seq(circ(op(ab[i]), 1/2,0,2*Pi),i=1..4);
" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1
0 "" }}{PARA 0 "" 0 "" {TEXT -1 174 "In order to plot these circles, y
ou need to enclose them in curly brackets to make a set of the sequenc
e before you give them to plot . See below for a discussion of sets
." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0
37 "plot(\{circs,ab\},scaling=constrained);" }}}{EXCHG {PARA 0 "" 0 "
" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 242 "Sometime you might wan
t to split a list of points to plot into a list of x-coordinates and a
nother list of ycoordinates. The Maple word seq is very handy for \+
thisand many other operations. So to split off from ab the odd and ev
en terms--" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "
" {MPLTEXT 1 0 40 "xdat := [ seq(ab[i][1],i=1..nops(ab) )];" }}}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 39 "ydat := [seq(ab[i][2],i=1..n
ops(ab) )];" }}{PARA 0 "" 0 "" {TEXT -1 1 " " }}}{EXCHG {PARA 0 "" 0 "
" {TEXT -1 163 "What about the converse problem? Building up a list o
f points to plot from two lists can also be done. The first thing yo
u might think of doesn't work, however." }}{PARA 0 "> " 0 "" {MPLTEXT
1 0 40 " seq([xdat[i],ydat[i]],i=1..nops(xdat));" }}{PARA 0 "" 0 ""
{TEXT -1 1 " " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 130 " Seq doesn't w
ork well with a pure expression sequence as input. However, with som
e coaxing we can get it to do what we want. " }}{PARA 0 "> " 0 ""
{MPLTEXT 1 0 50 " newab :=[seq([xdat[i],ydat[i]],i=1..nops(xdat))];" }
}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 231 "What did we do to change the in
put to seq ? We enclosed it in square brackets. If you feed such a \+
list of points to plot, it knows what to do. If you wanted to strip o
ut the inside brackets, that can be done too, but in release" }}{PARA
0 "" 0 "" {TEXT -1 68 "4 of Maple, plot would treat it as a sequence o
f constant functions." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 54 "newab := [
seq(op([xdat[i],ydat[i]]),i=1..nops(xdat))];" }}{PARA 0 "" 0 "" {TEXT
-1 1 " " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "plot(newab,color
=black);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG
{PARA 0 "" 0 "" {TEXT -1 5 "\n " }{TEXT 279 4 "Sets" }{TEXT -1 3 ".
\n " }}{PARA 0 "" 0 "sets" {TEXT -1 197 " A [ set ] is an expression
sequence enclosed by curly brackets. Order of appearance is not impo
rtant in sets. Sets are important when plotting more than one functi
on at at time. For example," }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA
0 "> " 0 "" {MPLTEXT 1 0 28 "plot(\{x^2-2,2*x+5\},x=-5..5);" }}}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 ""
{TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 20 "plots the parabola " }
{XPPEDIT 18 0 " y=x^2-2" "/%\"yG,&*$%\"xG\"\"#\"\"\"\"\"#!\"\"" }
{TEXT -1 15 " and the line " }{XPPEDIT 18 0 " y=2x+5 " "/%\"yG,&*&\"
\"#\"\"\"%\"xGF'F'\"\"&F'" }{TEXT -1 18 " over the domain " }}{PARA
0 "" 0 "" {TEXT -1 1 " " }{XPPEDIT 18 0 "x=-5..5 " "/%\"xG;,$\"\"&!\"
\"\"\"&" }{TEXT -1 20 " on the same graph. " }}{PARA 0 "" 0 "" {TEXT
-1 1 " " }}{PARA 0 "" 0 "" {TEXT -1 100 "If you have a very complicate
d drawing to make, you can use plots[display] fromthe plots package
." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 1 " " }}
{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 3 " " }
{TEXT 280 17 "Tables and Arrays" }}{PARA 0 "" 0 "" {TEXT -1 1 " " }}
{PARA 0 "" 0 "table" {TEXT -1 243 "A [ table ] is a special kind of
data structure which is very flexible. The packages of special vocab
ularies are really tables whose indices of the package are the names o
f the procedures and whose entries are the bodies of the procedures."
}}{PARA 0 "" 0 "" {TEXT -1 1 " " }}{PARA 0 "" 0 "array" {TEXT -1 286 "
An [ array ] is a special kind of table whose indices are numerical
. The most useful arrays are matrices (2 dimensional arrays) and vect
ors (1 dimesional arrays). Matrix operations are made using Maple word
evalm together with the symbol for [ matrix multiplication ] \+
&* . " }}{PARA 0 "" 0 "" {TEXT -1 2 " " }}{PARA 0 "> " 0 ""
{MPLTEXT 1 0 22 "a := array(1..2,1..2);" }}{PARA 0 "" 0 "" {TEXT -1 1
" " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "
" 0 "" {TEXT -1 73 " creates a 2 by 2 matrix, whose entries are access
ed as a[1,1] etc. " }}{PARA 0 "" 0 "" {TEXT -1 1 " " }}{PARA 0 "
" 0 "" {TEXT -1 28 " So to rotate the square " }{XPPEDIT 18 0 "ab :
= [[1,1],[3,1],[3,3],[1,3],[1,1]];" ">%#abG7'7$\"\"\"\"\"\"7$\"\"$\"\"
\"7$\"\"$\"\"$7$\"\"\"\"\"$7$\"\"\"\"\"\"" }{TEXT -1 88 " through an
angle of 31 degrees counter clockwise about the origin and display i
t, we" }}{PARA 0 "" 0 "" {TEXT -1 26 " could proceed as follows." }}
{PARA 0 "" 0 "" {TEXT -1 1 " " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1
0 40 "rot := array([[cos,-sin],[sin,cos]]); " }}}{EXCHG {PARA 0 "> \+
" 0 "" {MPLTEXT 1 0 24 "ang := evalf(Pi/180*31);" }}}{EXCHG {PARA 0 ">
" 0 "" {MPLTEXT 1 0 38 "ab := [[1,1],[3,1],[3,3],[1,3],[1,1]];" }}}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 70 "rotab := [seq(convert( evalm
(rot(ang)&*ab[i]),list) ,i=1..nops(ab) )];" }}}{EXCHG {PARA 0 "> " 0 "
" {MPLTEXT 1 0 30 "plot(\{ [[0,0]],ab,rotab\} );" }}}}{SECT 1
{PARA 4 "" 0 "" {TEXT 268 27 " Maple control statements " }}{EXCHG
{PARA 0 "" 0 "do .. od loops" {TEXT -1 171 "There are two especially i
mportant control statements . One is the repetition loop, and the o
ther is the conditional execution statement. The repetition loop is \+
\n \n " }{TEXT 269 46 " for .. from .. by .. to .. while .. do .. od;
" }{TEXT -1 126 " \n \nThis statement can be used interactively or in
a procedure to perform repetitive tasks or to do an iterative algorit
hm. " }}{PARA 0 "" 0 "" {TEXT -1 1 " " }}{PARA 0 "" 0 "" {TEXT -1 40
"Example: Add up the first 100 numbers." }}{PARA 0 "" 0 "" {TEXT -1
0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 46 " s := 0: for i from
1 to 100 do s := s+i od:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0
3 " s;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 ""
{TEXT -1 135 "Example: Compute the cubes of the first five positive i
ntegers and store them in a list. Then do it again, storing them in a
n array. " }}{PARA 0 "" 0 "" {TEXT -1 1 " " }}{PARA 0 "" 0 "" {TEXT
-1 20 "Solution with lists:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0
42 "locube := []: # start with the empty list" }}{PARA 0 "> " 0 ""
{MPLTEXT 1 0 23 " for i from 1 to 5 do " }}{PARA 0 "> " 0 ""
{MPLTEXT 1 0 38 " locube := [op(locube),i^3] od: " }}{PARA 0 "> \+
" 0 "" {MPLTEXT 1 0 29 "locube ; # look at the list;" }}}{EXCHG
{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT
-1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 163 "Note the way the list is built
up from nothing. Each time through the loop, one more term is added \+
onto the end of the list. With arrays, one can be more direct." }}
{PARA 0 "" 0 "" {TEXT -1 1 " " }}{PARA 0 "" 0 "" {TEXT -1 21 "Solution
with arrays:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 47 "aocube := array(1.
.5): # initialize the array." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1
0 43 "for i from 1 to 5 do aocube[i]:= i^3 od; " }}}{EXCHG {PARA 0 "
> " 0 "" {MPLTEXT 1 0 33 " op(aocube); # to see the array " }}}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 ""
{TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 16 "Now the array " }{TEXT
271 6 "aocube" }{TEXT -1 322 " has the numbers stored in it. To refe
r to the third element of aocube , we would enter aocube[3] just \+
as if it were a list, rather than an array. Why have arrays at all? \+
Well, for one thing, the terms in an array can be more easily modified
. For example, to change the third term in aocube to 0 just enter \+
" }{TEXT 270 15 "aocube[3] := 0;" }{TEXT -1 34 " . To change the t
hird term in " }{TEXT 272 6 "locube" }{TEXT -1 113 " to 0, you have \+
to make an entirely new list whose terms are all the same as locube \+
except for the third one." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0
"> " 0 "" {MPLTEXT 1 0 13 "aocube[3]:=0;" }}}{EXCHG {PARA 0 "> " 0 ""
{MPLTEXT 1 0 14 "print(aocube);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT
1 0 54 "locube := [locube[1],locube[2],0,locube[4],locube[5]];" }}}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 ""
{TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT
276 8 "Problem." }{TEXT -1 70 " \n \nThere is a much less cumbersome \+
way of doing the list solution. " }}{PARA 0 "" 0 "" {TEXT -1 42 "Star
t with the empty expression sequence " }{TEXT 273 15 "locube := NULL:
" }}{PARA 0 "" 0 "" {TEXT -1 75 "and just tack the cubes onto the end \+
of the sequence as they are generated." }}{PARA 0 "" 0 "" {TEXT -1 2 "
" }{TEXT 274 46 "for i from 1 to 5 do locube := locube,i^3 od: " }
{TEXT -1 124 " Now you have the first 5 cubes in a sequence. How do \+
we turn that into a list? By putting square brackets around it! "
}{TEXT 275 20 "locube := [locube]; " }{TEXT -1 18 " Test this out.
" }}{PARA 0 "" 0 "" {TEXT -1 1 " " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}
{PARA 0 "" 0 "" {TEXT -1 2 " " }}}{EXCHG {PARA 0 "" 0 "conditionals"
{TEXT -1 61 " Conditional execution if .. then .. elif .. else .. \+
fi; " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 256 "
There are lots of times when you need to consider cases, and they can \+
all be handled with the [ if .. then .. elif .. else .. fi; ] statem
ent. For example, many functions are defined piecewise. The absolute
value function abs is such a function. \n " }}{PARA 0 "" 0 ""
{TEXT 277 8 "Problem:" }{TEXT -1 57 " Define your own version of the \+
absolute value function." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "
" 0 "" {TEXT 278 10 "A solution" }{TEXT -1 1 ":" }}{PARA 0 "" 0 ""
{TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 48 "myabs := proc(x) if
x > 0 then x else -x fi end;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1
0 11 "myabs(-23);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 94 "plot(m
yabs,-2..2,scaling=constrained,title=`my absolute value`); # to see w
hat it looks like." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0
"" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}}{SECT 1
{PARA 4 "" 0 "" {TEXT -1 36 " A Brief Vocabulary of Maple Words " }}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }{TEXT -1 207 "We have gath
ered here are some Maple words useful in problem solving, together wi
th examples of their usage. For more information on these words and o
thers, look at the helpsheets and use the help browser." }}}{EXCHG
{PARA 0 "> " 0 "" {MPLTEXT 1 0 67 "y := (x+3)/tan(x^2-1); # use 'colo
n-equal' to make assignments. " }}}{EXCHG {PARA 0 "> " 0 ""
{MPLTEXT 1 0 51 "collect(x*2 + 4*x,x); # collects like powers of x."
}}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 45 "diff(cos(x),x); # calcul
ates the derivative " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 36 "D(c
os); # the differential operator" }}}{EXCHG {PARA 0 "> " 0 ""
{MPLTEXT 1 0 47 " y := denom((a+b)/(e+f)); # assigns e+f to y. " }}}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 40 "y := 'y'; # makes y a vari
able again. " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 49 "evalc((2+3*
I)^3); # performs complex arithmetic " }}}{EXCHG {PARA 0 "> " 0 ""
{MPLTEXT 1 0 52 "evalf(1/2^9); #evaluates 1/2^9 to a decimal number \+
" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 40 "expand((x+b)^7); # exp
ands the product " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 47 "p := x
^2+5*x+6; # assigns the quadratic to p. " }}}{EXCHG {PARA 0 "> " 0 "
" {MPLTEXT 1 0 37 "factor(p); # factors the polynomial " }}}{EXCHG
{PARA 0 "> " 0 "" {MPLTEXT 1 0 52 "fsolve(x^5-3*x=1,x,0..2); # solve \+
eqn for x in 0..2" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 47 "int(x*
exp(x),x); # returns an antiderivative." }}}{EXCHG {PARA 0 "> " 0 "
" {MPLTEXT 1 0 44 "Int(x*exp(x),x=0..1); # A passive integral." }}}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 51 "map(x->x^2,[1,3,2,5]); # ret
urns a list of squares." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 62 "
nops([3,4,x,1]); # returns the number of terms in the list. " }}}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 45 "numer((a+b)/c); # gives num
erator, here a+b " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 51 "op([3,
4,1,x]); # strips the brackets off the list " }}}{EXCHG {PARA 0 "> "
0 "" {MPLTEXT 1 0 62 "plot(x^2+x, x=-3..3); # plots x^2+x as x goes \+
from -3 to 3. " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 49 "plot3d(x^
2+y,x=-2..2,y=0..2); # plots a surface " }}}{EXCHG {PARA 0 "> " 0 ""
{MPLTEXT 1 0 49 "f := x -> x^2; # defines the squaring function. " }}
}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "f(3); # then returns 9. "
}}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 47 "quo((x^4-4),(x^2-2),x); \+
# divides polynomials " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 36 "i
quo(23,2) ; # divides the integers" }}}{EXCHG {PARA 0 "> " 0 ""
{MPLTEXT 1 0 50 "rem((x^4-4*x+3),(x^2-2),x); # gives the remainder" }
}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 43 "irem(23,2) ; # gives the i
nteger remainder " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 57 "restar
t; # very handy. This word resets all assignments." }}}{EXCHG {PARA
0 "> " 0 "" {MPLTEXT 1 0 48 "eq1 := x^2 + 3*x -1 = a; # assigns the e
quation" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 70 "rhs(eq1); # yie
lds the righthand side of eq1. There is also an lhs. " }}}{EXCHG
{PARA 0 "> " 0 "" {MPLTEXT 1 0 49 "simplify(a/x+b/y); # sometimes sim
plifies expr. " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 50 "solve(a*x
+4*y=0,x); # solve the equation for x. " }}}{EXCHG {PARA 0 "> " 0 "
" {MPLTEXT 1 0 66 "subs(x=5,x^2+x); # substitute 5 for x where it oc
curs in x^2+x. " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 38 "i := 'i'
; # makes i a variable again" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT
1 0 77 "sum((i^2,i=2..9)); # add up the 2nd thru 9th squares \+
" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}
{SECT 1 {PARA 4 "" 0 "" {TEXT -1 24 " Trouble Shooting Notes" }}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "tro
uble shooting" {TEXT -1 72 "Learning to use Maple can be an extremely \+
frustrating experience, if you" }}{PARA 0 "" 0 "" {TEXT -1 72 "let it.
There are some types of errors which occur from the beginning" }}
{PARA 0 "" 0 "" {TEXT -1 69 "that can be spotted and corrected easily \+
by a person fluent in Maple," }}{PARA 0 "" 0 "" {TEXT -1 65 "so if you
have access to such a person, use them. Here are a few" }}{PARA 0 "
" 0 "" {TEXT -1 65 "suggestions that may be of use when you're stuck w
ith a worksheet" }}{PARA 0 "" 0 "" {TEXT -1 19 "that's not working." }
}{PARA 0 "" 0 "" {TEXT -1 2 " " }}}{EXCHG {PARA 15 "" 0 "" {TEXT -1
257 " Use the help facility: There is a help sheet with examples for
every Maple word. \nA quick read thru will often clear up syntax pr
oblems. One very common early mistake is to leave out the parentheses
around the inputs of a word. For example, typing " }{MPLTEXT 1 0
10 "plot x^2; " }{TEXT -1 66 "will get you a syntax error, because you
left out the parentheses." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 1 " " }
}{PARA 15 "" 0 "" {TEXT -1 71 " The maple prompt is > . You can \+
begin entering input after it. " }}{PARA 0 "" 0 "" {TEXT -1 77 " M
ake sure you are typing into an input cell, if you are expecting outpu
t." }}{PARA 0 "" 0 "" {TEXT -1 1 " " }}}{EXCHG {PARA 15 "" 0 "" {TEXT
-1 210 " End maple statements with a semicolon ; . Maple does not
hing until it finds a semicolon. If you are getting no output wh
en you should be, tryfeeding in a semicolon. This often works. For e
xample, " }}{PARA 0 "" 0 "" {TEXT -1 1 " " }}{PARA 15 "" 0 "" {TEXT
-1 62 " When in doubt, put in parentheses. For example, (x+3)/(x
" }}}}}{EXCHG {PARA 0 "" 0 "" {HYPERLNK 17 "Table of contents" 1 "ma41
6s97.mws" "top" }{TEXT -1 0 "" }}}}{MARK "0 11" 0 }{VIEWOPTS 1 1 0 1
1 1803 }