{VERSION 4 0 "IBM INTEL NT" "4.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 1 }{CSTYLE "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 1 }{CSTYLE "2D Input" 2 19 "" 0 1 255 0 0 1 0 0 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 256 "" 1 16 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 257 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 258 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 259 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 260 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 261 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 262 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 263 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 264 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 265 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 266 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 267 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 268 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 269 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 270 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 271 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 272 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 273 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 274 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 275 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 276 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 277 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 278 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 279 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 280 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 281 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 282 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 283 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 284 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 285 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 286 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 287 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 288 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 289 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 290 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 291 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 292 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 293 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 294 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 295 "" 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 } {CSTYLE "" -1 296 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 297 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 298 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 299 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 300 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 301 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 302 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 303 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 304 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 305 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 306 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 307 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 308 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 309 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 310 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 311 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 312 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 313 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 314 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 315 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 316 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 317 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 318 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 319 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 320 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 321 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 322 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 323 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 324 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 325 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 326 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 327 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 328 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 329 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 330 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 331 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 332 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 333 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 334 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 335 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 336 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 337 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 338 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 339 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 340 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 341 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 342 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 343 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 344 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 }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 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }1 0 0 0 8 4 0 0 0 0 0 0 -1 0 }} {SECT 0 {EXCHG {PARA 0 "" 0 "" {TEXT 256 21 "Introduction to Maple" }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 37 "We introd uce Maple in three sections:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 21 "1) Basic calculations" }}{PARA 0 "" 0 "" {TEXT -1 11 "2) Calculus" }}{PARA 0 "" 0 "" {TEXT -1 18 "3) Linear algebra. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 159 "It i s meant as a crash course, and not to replace the usual texts. There i s also an intro.mws file in the tutorial section to Maple which one ca lls by issuing " }{TEXT 19 6 "?intro" }{TEXT -1 105 " at the command l ine. We expect the reader to have taken introductory courses in mathem atics and physics." }}{PARA 0 "" 0 "" {TEXT -1 89 "Standard references are the two books by Michael B. Monagan et al. published by Springer: " }}{PARA 0 "" 0 "" {TEXT -1 3 "1) " }{TEXT 257 22 "Maple V Learning G uide" }}{PARA 0 "" 0 "" {TEXT -1 3 "2) " }{TEXT 258 25 "Maple V Progra mming Guide" }}{PARA 0 "" 0 "" {TEXT -1 151 "Of course, some of the to pics covered in those texts are dealt with in our worksheets in the ph ysics context, which makes for more interesting reading." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{SECT 1 {PARA 3 "" 0 "" {TEXT 259 29 "Basic calculations and graphs" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 22 "Maple as a Calculator:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT -1 114 "Maple is case sensitive, distinguish car efully upper-case from lower-case typing.We begin by manipulating numb ers:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "1+17;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "answer:=%;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "answer;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 10 "N ote that " }{TEXT 19 2 ":=" }{TEXT -1 192 " acts as an assignment oper ator. The equal sign has a different meaning. A common beginner's mist ake is to use the equal sign instead of the assignment operator and to get thoroughly confused." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "answ=10;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "answ;" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 14 "The statement " }{TEXT 19 7 "answ= 10" }{TEXT -1 74 " is an equation, which was entered above, but is not usable. The variable " }{TEXT 19 4 "answ" }{TEXT -1 20 " remains unas signed." }}{PARA 0 "" 0 "" {TEXT -1 15 "We could assign" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "ans:=3/4;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "evalf(ans);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 129 "The Digits variable controls how many digits are carried in float ing-point calculations. It can be changed to any integer number." }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "Digits;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "Digits:=20;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 36 "We can evaluate Pi now to 20 digits:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "evalf(Pi);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 73 "The symbols for Greek letters are obtained by typing their English na mes." }}{PARA 0 "" 0 "" {TEXT -1 143 "An awkward matter is that lower- case pi is just a symbol, and not the mathematical pi (that is given a s Pi). But as symbols they look the same:" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 6 "Pi,pi;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 " evalf(%);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 15 "Exponentiation:" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "ans:=3^4;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 52 "What happens when we combine symbols into a formu la?" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "a:=Pi;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "b:=r^2;" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 7 "A:=a*b;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "evalf(A,5);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 51 "What if we nee d the answer for a specific value of " }{TEXT 260 1 "r" }{TEXT -1 34 " ? Several approaches are possible:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "eval(A,r=5);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "evalf(eval(A,r=5),4);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "evalf(subs(r=5,A));" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 112 "But t he following cannot work, as the second argument in evalf is reserved \+ for the precision (number of digits):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "evalf(A,r=5);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 90 "If we don't match brackets, we get some help, but it takes some pract ice to understand it." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "ev alf(subs(r=5,A,4);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 218 "We are phy sicists, and often we wish to use units. One way to use them in Maple \+ explicitly is to enter them as variables, and to set them apart from t he actual variables by a distinctive naming convention. For example:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "area:=evalf(subs(r=5*_cm, A),4);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 35 "It is possible to assig n variables:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "r:=5*_cm;" } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "evalf(A,3);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "A;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 26 "and then to unassign them:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "r:='r':" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "A ;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 103 "The best practice for work \+ is to keep variables unassigned (or general) until required, and to us e the " }{TEXT 19 4 "subs" }{TEXT -1 4 " or " }{TEXT 19 4 "eval" } {TEXT -1 78 " command to evaluate for specific numbers (which is neede d for plotting). The " }{TEXT 19 4 "subs" }{TEXT -1 212 " command is u sed more often when several variables are to be substituted; note that they will be substituted in a certain order. This ordering becomes im portant when one substituted variable depends on the other." }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 30 "subs(_cm=1,Pi=3.14,r=4*_cm,A );" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 30 "subs(Pi=3.14,r=4*_cm, _cm=1,A);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 148 "As a final step in \+ this initial session we point out the dangers in assigning/unassigning variables before the final steps of forming an expression:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 71 "We look at the \+ volume of a cone, and begin with the area of the circle." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "A;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 48 "Suppose we played around with particular values:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "r:=sqrt(7);" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 2 "A;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 25 "Now \+ we define the volume:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "V: =1/3*A*h;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 16 "Now we unassign " } {TEXT 261 1 "r" }{TEXT -1 1 ":" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "r:='r':" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "A;" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 30 "This looks as before. However:" }} }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "V;" }}}{EXCHG {PARA 0 "" 0 " " {TEXT -1 19 "The expression for " }{TEXT 265 1 "V" }{TEXT -1 17 " wa s formed when " }{TEXT 272 1 "r" }{TEXT -1 73 " was assigned a specifi c value. This value was used in the definition of " }{TEXT 267 1 "V" } {TEXT -1 47 ", or more precisely, the actual expression for " }{TEXT 266 1 "A" }{TEXT -1 22 " was substituted when " }{TEXT 264 1 "V" } {TEXT -1 24 " was defined, and thus, " }{TEXT 263 1 "V" }{TEXT -1 24 " has no connection with " }{TEXT 271 1 "r" }{TEXT -1 22 " anymore. Una ssigning " }{TEXT 269 1 "r" }{TEXT -1 8 " return " }{TEXT 268 1 "A" } {TEXT -1 48 " to the general expression (it was defined when " }{TEXT 270 1 "r" }{TEXT -1 52 " was unassigned, but cannot turn back the whee l for " }{TEXT 262 1 "V" }{TEXT -1 1 "!" }}{PARA 0 "" 0 "" {TEXT -1 46 "We need to assign the volume again, and since " }{TEXT 273 1 "A" } {TEXT -1 71 " has been turned back to the original general expression, it works now:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "V:=1/3*A* h;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 140 "Now we know how to use Map le as a smart calculator. We can perform graphs of expressions, i.e., \+ we have a graphing calculator at this point:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "plot(A,r=0..4);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 153 "Combining several plots into one graph is easy, and we u se a so-called list construct to pass two elements into the first argu ment of the plot procedure:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 53 "plot([sin(x),cos(2*x)],x=0..2*Pi,color=[blue,green]);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 62 "If you leave a variable unassigned beyond the one used on the " }{TEXT 274 1 "x" }{TEXT -1 70 "-axis, be ready \+ for an empty plot (or the 'empty plot' error message):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "plot(V,h=0..1);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 33 "For a 3-dimensional graph we use " }{TEXT 19 6 "p lot3d" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 67 "plot3d(V,r=0..4,h= 0..1,axes=boxed,style=patchcontour,shading=zhue);" }}}{EXCHG {PARA 0 " > " 0 "" {MPLTEXT 1 0 0 "" }}}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{SECT 1 {PARA 3 "" 0 "" {TEXT 275 20 "Maple knows Calculus" }} {EXCHG {PARA 0 "" 0 "" {TEXT -1 158 "We begin by resetting Maple. This comes close to quitting the program and restarting it (we lose all va riables, but we do not recover all the memory used up)." }}{PARA 0 "" 0 "" {TEXT -1 189 "Many worksheets have this command at their beginnin g, as you may either want to clear memory from a previous calculation \+ within a different worksheet, or re-run the worksheet independently." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "y:=exp(3*x);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 10 "Note that " }{TEXT 276 1 "y" }{TEXT -1 85 " is an express ion in Maple. We will learn how to use mappings in Maple further below ." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "yp:=diff(y,x);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 58 "The anti-derivative (indefinite in tegral) is calculated by" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "Y:=int(y,x);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 68 "A definite integ ral between constant boundaries results in a number:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "int(y,x=0..2);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "evalf(%,4);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 55 "Euler's number is printed as a non-italicized letter e." }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "exp(1);" }}}{EXCHG {PARA 0 " " 0 "" {TEXT -1 31 "This is not to be confused with" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "e;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 33 "which is the unassigned variable " }{TEXT 277 1 "e" }{TEXT -1 85 ". T his sounds a bit like Pi and pi, except that one enters Euler's number via exp(1)." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "E;" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 14 "Note that the " }{TEXT 19 4 "subs " }{TEXT -1 54 " command introduced earlier does not force evaluation: " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "subs(x=0,y);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "simplify(%);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 35 "Maple knows something about limits." }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "limit(y,x=infinity);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "limit(y,x=-infinity);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 23 "Let us see why we need " }{TEXT 19 8 "simplify" }{TEXT -1 13 " quite often." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "s1:=sin(x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "s2:=cos(x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "s3:= s1^2+s2^2;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 3 "s3;" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "simplify(s3);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 127 "Keep in mind that the latter command did not change the content of the variable s3. For that purpose an assign ment is required." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 3 "s3;" }} }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "s3:=simplify(s3);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 65 "The above simplification can actua lly be obtained in another way." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "s3:=s1^2+s2^2;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "c ombine(s3);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 20 "or more specifical ly" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "combine(s3,trig);" }} }{EXCHG {PARA 0 "" 0 "" {TEXT -1 4 "The " }{TEXT 19 7 "combine" } {TEXT -1 89 " command is useful in other contexts where we wish to con trol the display of expressions." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "y:=exp(s)*exp(t);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "simplify(y);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "combine(y);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "expand (%);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 4 "The " }{TEXT 19 8 "combine " }{TEXT 2 3 "and" }{TEXT 19 7 " expand" }{TEXT 2 45 " commands allow us to switch hence and forth." }}{PARA 0 "" 0 "" {TEXT -1 133 "Often \+ it is necessary to pull out parts of expressions. While this is tediou s at times, and one tries to avoid it, here is the trick." }}{PARA 0 " " 0 "" {TEXT -1 47 "An expression has a certain number of operands:" } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "nops(y);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 41 "One can pull out the operands one-by-one:" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "op(1,y);" }}}{EXCHG {PARA 0 " > " 0 "" {MPLTEXT 1 0 8 "op(2,y);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 71 "Suppose we want the argument of the exp function in the second ope rand:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "nops(op(2,y));" }} }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "op(1,op(2,y));" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 147 "There is no harm in practicing this a bi t on complicated expressions. It shows how Maple assembles expressions in a tree-like hierarchical fashion." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 285 "Now we introduce mappings. They are not strictly require d for simple function assignments, as we could do everything using exp ressions. Nevertheless they allow more flexibility in substituting arg uments, and provide an easy first step towards subroutines (called pro cedures in Maple). " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "g:=t ->exp(-t);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "g;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "g(x);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 39 "In the latter step we used the mapping " }{TEXT 279 1 "g " }{TEXT -1 30 " to produce the expression in " }{TEXT 278 1 "x" } {TEXT -1 151 ". We can plot expressions (as before), and mappings as w ell, but the latter work differently. Be careful to observe what works , and what doesn't below:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "plot(g(x),x=-1..5);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 " plot(g,-2..3);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 50 "plot(g,x= -1..5); # this used to give an empty plot" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 17 "plot(g(x),-1..5);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 133 "Many beginners get very confused by the above. There is always a logical reason when an empty plot is produced, or when a plot fails !" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 176 "It \+ is safer to work with expressions in Maple. Often we manipulate them, \+ and then want to use them as mappings in the end. There is a command t o turn expressions into mappings:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 34 "y:=exp(-2*x)*sin(x)+exp(x)*cos(x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "ym:=unapply(y,x);" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 19 "evalf(subs(x=3,y));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "evalf(ym(3));" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 161 "Mappings can be differentiated directly using the D differential \+ operator. We do not need to specify the independent variable, as it is just a dummy placeholder." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "ypm:=D(ym);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 55 "plot([ym ,ypm],-0.5..1.5,color=[blue,green],axes=boxed);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 22 "Note how the function " }{TEXT 280 1 "y" }{TEXT -1 47 " (blue) has an extremum point (maximum) around " }{TEXT 281 1 "x" }{TEXT -1 112 "=0.75, and the derivative (green) vanishes there. Make \+ other observations about the function and its derivative." }}{PARA 0 " " 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 124 "Note that the dis play of differentiated mapping may appear confusing, as mappings are r eferred to by just the function name:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "D(sin);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 34 "Mappin gs can be combined in Maple." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "g1:=t->exp(-t);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "g2 :=s->sin(2*s);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "g3:=g1@g2 ;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "g3(x);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 206 "Of course, the order is important as we \+ are nesting functions (mappings) here. Also note that we need brackets if we want to evaluate directly the combined mapping at some value of the independent variable." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "(g2@g1)(x);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 62 "We can test ou t our knowledge of functions and their inverses:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "(ln@exp)(x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "simplify(%);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "combine(%);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "expand (%);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 212 "Now, Maple can be very f ussy, which can drive physicists up some trees... In those cases use c arefully the following (which simply assumes nice things about the var iables, which might be true - or sometimes not!)" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "simplify(%,symbolic);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 32 "We will have to learn about the " }{TEXT 19 6 "assum e" }{TEXT -1 77 " system, which allows to make assumptions about varia ble in a controlled way." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "assume(x,real);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "ln(exp( x));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "ln(exp(s));" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 37 "If we wish to drop the assumption \+ on " }{TEXT 282 1 "x" }{TEXT -1 17 ", we unassign it." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "x:='x':" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 11 "exp(ln(x));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "ln(exp(x));" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 30 "Mappings c an also be iterated." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "y:= sin@@3;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "y(x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "y(1);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "evalf(%);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "evalf(sin(sin(sin(1))));" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 42 "N ote that Maple reserves the notation sin^" }{TEXT 283 1 "n" }{TEXT -1 105 " for the case of the repeated application of the sine function. I t will never display sine raised to the " }{TEXT 284 1 "n" }{TEXT -1 84 "th power as is usually done in Math texts, as this leaves room for ambiguity. sin^2(" }{TEXT 287 1 "x" }{TEXT -1 25 ") in Maple means si n(sin(" }{TEXT 286 1 "x" }{TEXT -1 13 ")), not (sin(" }{TEXT 285 1 "x " }{TEXT -1 5 "))^2." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 90 "The syste m of assumptions is important in integral evaluations. Suppose we wish to obtain:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 33 "int(exp(-alp ha*r),r=0..infinity);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "as sume(alpha>0);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 33 "int(exp(- alpha*r),r=0..infinity);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 279 "Mapl e has smartened up compared to previous versions, and tells us that as sumptions are needed to obtain the result. It normally displays variab les with assumptions on them by a tilde attached to the variable, but \+ this feature can be turned off [easiest through the menu, or via " } {TEXT 19 24 "interface(showassumed)=0" }{TEXT -1 53 "]. However, we ca n always find out about assumptions:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "about(alpha);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 149 "We finish this section by a real-life physics example. We solve t he Newton equation for free fall at the surface of a planet (constant \+ acceleration)." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "NE:=m*diff(v(t),t)=m*g;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT 2 77 "We begin by writing the integral s in unevaluated form (upper-case version of " }{TEXT 19 3 "int" } {TEXT 2 156 "). We have to introduce a new dummy variable s for time, \+ in order not to confuse the integration boundary with the integration \+ variable. We make use of the " }{TEXT 19 3 "lhs" }{TEXT 2 5 " and " } {TEXT 19 3 "rhs" }{TEXT 2 48 " functions to pull out the sides of the \+ equation" }{TEXT -1 11 ". The mass " }{TEXT 288 1 "m" }{TEXT -1 32 " i s divided out of the equation." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 49 "NE1:=Int(lhs(NE/m),t=0..s)=Int(rhs(NE/m),t=0..s);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 43 "We can carry out the integration using th e " }{TEXT 19 5 "value" }{TEXT -1 9 " command." }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 16 "NE1:=value(NE1);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 73 "Now we introduce the relationship between velocity and po sition (keeping " }{TEXT 289 1 "s" }{TEXT -1 22 " as the time variable )" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 34 "NE2:=diff(x(s),s)=solv e(NE1,v(s));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 47 "NE2:=Int(lh s(NE2),s=0..t)=Int(rhs(NE2),s=0..t);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "sol:=value(NE2);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "solve(sol,x(t));" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 12 "We used the " }{TEXT 19 5 "solve" }{TEXT -1 20 " command to isolat e " }{TEXT 291 1 "x" }{TEXT -1 1 "(" }{TEXT 290 1 "t" }{TEXT -1 2 "). " }}{PARA 0 "" 0 "" {TEXT -1 128 "Maple has a built-in differential eq uation solver, which can crack a large percentage of solvable linear d ifferential equations." }}{PARA 0 "" 0 "" {TEXT -1 86 "First we re-def ine NE as the differential equation for position as a function of time :" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "NE:=m*diff(x(t),t$2)=m *g;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "sol:=dsolve(NE,x(t)) ;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 123 "No boundary (initial) condi tions were specified, and therefore we have the general solution with \+ two integration constants." }}{PARA 0 "" 0 "" {TEXT 293 1 "x" }{TEXT -1 1 "(" }{TEXT 292 1 "t" }{TEXT -1 149 ") has not been assigned. Ther e are two options. The more convenient one is actually to not assign x (t), but to extract the solution as an expression:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "rhs(sol);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "x(t);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "as sign(sol);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "x(t);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 160 "If one wants to use x(t) again (e ven for re-defining a differential equation), one has to unassign (thi s is why never making the assignment is more convenient):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "x(t):='x(t)':" }}}{EXCHG {PARA 0 " " 0 "" {TEXT -1 189 "One can also find the special solution by specify ing initial conditions (either as numbers or as symbols). One needs th e D differential operator to specify the condition for the derivative. " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "IC:=x(0)=x0,D(x)(0)=v0; " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 70 "One solves the set of differe ntial equation(s) and initial conditions:" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 26 "sol:=dsolve(\{NE,IC\},x(t));" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 109 "This used to work in previous versions, and does ag ain in Maple 6. In Maple 5 one needs to give Maple a hint:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 41 "sol:=dsolve(\{NE,IC\},x(t),method=l aplace);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 230 "It is useful to assi gn dsolve to a variable. In that case when the empty set is returned ( which means: \"I couldn't come up with a solution\", not \"There is no solution\") one sees it right away (otherwise an empty line is produc ed)." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{SECT 1 {PARA 3 "" 0 "" {TEXT 294 28 "and some linear algebra too!" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 179 " In this part we deal with Maple's handling of linear algebra problems. Vectors play an important role in physics. We learn that Maple has (a t least) two ways of dealing with them." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 174 "The first way is through objects ca lled lists. Lists can be ordered (tables) or unordered. They allow to \+ append objects, similarly as sets represent accumulations of objects. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 224 "Vect ors are something more, there are mathematical operations defined on t hem which are performed by arithmetic on the components. Maple has an \+ array construct to deal with vectors and matrices, and a special packa ge called " }{TEXT 19 6 "linalg" }{TEXT -1 184 " that contains many us eful procedures to compute operations such as determinant, matrix inve rse, eigenvalues, etc. In Maple 6 a new linear algebra package has bee n added; it is called " }{TEXT 19 13 "LinearAlgebra" }{TEXT -1 162 ", \+ and allows superior handling of numerical linear algebra problems. For compatibility with Maple 5 we will refrain from using the new package for the time being." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 " " {TEXT -1 49 "We first show the pitfalls of using simple lists:" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 " > " 0 "" {MPLTEXT 1 0 12 "xv:=[1,4,9];" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "xv[1]; xv[2]; xv[3];" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "print(xv);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "eval(xv);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 3 "xv;" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 39 "This looks easy: we defined a quan tity " }{TEXT 19 2 "xv" }{TEXT -1 105 ", and were able to access its c omponents using square brackets. Maple refers to this construct as a l ist." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "whattype(xv);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 282 "There was no need to declare the object. However, it is clear from the first line that Maple had enough inform ation to deal with the construct, namely an ordered list of 3 objects. We cannot trivially add another, e.g., xv[4]:an error message is prod uced by referring to the object:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 6 " xv[4];" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 115 "The reference to an el ement of the list using the subscript in square brackets is equivalent to the op() construct:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "nops(xv); " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "op(2,xv);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 123 "Suppose we wish to expand the list by ad ding another element. The following doesn't work, as it generates a li st in a list." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "xv1:=[xv,16];" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 140 "We need to first extract the elem ents from the previous list. This can be performed the long way or wit h a shortcut (see ?list for details):" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "op(1..nops(xv),xv);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "op(xv);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 92 "We are ready to expan d our list and re-use its name (be careful with recursive definitions) ." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "xv:=[op(xv),16];" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "xv[4];" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 195 "For many purposes the work with lists in Maple is the mo st efficient way to deal with multi-component objects. It is possible \+ for Maple to run out of steam when lists contain 100 entries or more. " }}{PARA 0 "" 0 "" {TEXT -1 61 "We note that the following practice d oes something different:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "yv[1]:=1 ;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "yv[2]:=8;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "yv[3]:=27;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "print(yv);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "whattype(yv);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "yv[2];" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 108 "Tables indexed \+ by integers are ordered, but the way they are stored and displayed is \+ not always predictable." }}{PARA 0 "" 0 "" {TEXT -1 147 "There are fun ctions to convert between tables and lists; in older Maple versions on e had to watch what happened when the entries were out of order." }} {PARA 0 "" 0 "" {TEXT -1 208 "Tables are extremely flexible: they prov ide a very general pointer structure, whereby the indexing does not ha ve to be continuous. In fact the index can almost be anything. The tab le simply provides the link." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "yv[5]:=101;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "yv[4]: =87;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "yv[i]:=2*i;" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "yv[j]:=2*j-1;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "print(yv);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "convert(yv,list);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 153 "It appears that the numerically indexed entries are comi ng out in proper order, and that the order of generally defined entrie s is not quite predictable." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 295 16 "Arrays in Maple." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 122 "To deal with vectors and matrices where the indexing is in terms of integer numbers Maple has the array construct. In the " }{TEXT 19 6 "linalg" }{TEXT -1 141 " package ther e are special procedures called vector and matrix which define the req uired arrays. It is possible to define arrays outside the " }{TEXT 19 6 "linalg" }{TEXT -1 153 " package. Since we are interested in the fun ctions contained in the linalg package, we use the vector and matrix c onstructs from it to define the arrays." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "with(linalg);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 66 "We displ ayed the commands that become available with this package." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "xv:=vector([1,4,9]);" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 21 "yv:=vector([1,8,27]);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 58 "These are column vectors displayed as rows to save spa ce. " }}{PARA 0 "" 0 "" {TEXT -1 144 "One can refer to vector elements using an index in square brackets, which is analogous to list element s, but the op construct works differently:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "xv[2];" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "no ps(xv);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 87 "Note that this is not \+ the dimension of the vector! There is a special command for that:" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "vectdim(xv);" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 7 "op(xv);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "op(op(xv));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "what type(xv);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 107 "If one had to acces s the elements via the op construct, it would be a real nuisance (as c ompared to lists)." }}{PARA 0 "" 0 "" {TEXT -1 47 "The inner product c an be calculated as follows:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "dot prod(xv,xv);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 44 "We can write a sm all loop to calculate this:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "dp:=0 :" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "for i from 1 to 3 do:" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "dp:=dp+xv[i]*xv[i]; od:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 3 "dp;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "dotprod(xv,yv);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 47 "Edit the above loop and verify the calculation." }}{PARA 0 "" 0 " " {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 228 "Note that we have refe rred to the elements of the vector in the same way as list elements we re addressed. In fact, we could write our own set of procedures, and a lways work with lists. We turn the do-loop above into a procedure." }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 111 "We pass \+ two arguments (the vectors to be multiplied) and check with an if-then -fi construct whether they match." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }{TEXT -1 0 "" }{MPLTEXT 1 0 40 "dprod:=proc(arg1,ar g2) local i,n1,n2,dp;" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "n1:=vectdi m(arg1):" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "n2:=vectdim(arg2):" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 68 "if n1 <> n2 then RETURN(`Mismatch o f sizes in dprod procedure`); fi;" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "dp:=0:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "for i from 1 to n1 do:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "dp:=dp+arg1[i]*arg2[i]: od:" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 3 "dp;" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 4 "end:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "dprod(xv,xv); " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 57 "Note how a procedure returns \+ the last executed statement." }}{PARA 0 "" 0 "" {TEXT -1 114 "It also \+ has its error checking (which could be improved to check the type of a rguments passed into the procedure)." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "dprod(xv,[1,1,1]);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "evalm(xv);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 102 "This worked even \+ though [1,1,1] is a list and not a vector. vectdim must be working pro perly on lists:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "vectdim([1,2,3,4 ]);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "dprod(xv,[1,2,3,4]); " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "dotprod(xv,[1,2,3,4]); " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 48 "Maple's dotprod procedure wor ks also with lists:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "dotprod([1,2 ,3],[1,2,3]);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 23 "We now define a \+ matrix:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 37 "A:=matrix([[1,2,3],[4,5, 6],[7,8,9]]);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 29 "We can check som e properties:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "trace(A);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 80 "We obtained the sum of the diagona l elements. Next we calculate the determinant:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "det(A);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 86 "Obviou sly the rows/columns are not independent of each other. Thus, no inver se exists." }}{PARA 0 "" 0 "" {TEXT -1 28 "We try a small modification ." }}{PARA 0 "" 0 "" {TEXT -1 135 "Observe how elements of a matrix ar e addressed, and how vectors and matrices are not displayed by default , but evalm has to be invoked." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "B: =A;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "B[3,3]:=10;" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "B;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "A;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "eva lm(B);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "det(B);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "A; evalm(A);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "evalm(A-B);" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 2 "B;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "A;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 37 "Something apparently absur d happened:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 12 "We assigned " }{TEXT 326 1 "B" }{TEXT -1 27 " to pick up the co ntent of " }{TEXT 327 1 "A" }{TEXT -1 33 ". Then we changed one elemen t in " }{TEXT 328 1 "B" }{TEXT -1 32 ". That should not have affected \+ " }{TEXT 329 1 "A" }{TEXT -1 23 ", but obviously it did." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "Binv:=inverse(B);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 59 "Note that since the inverse exists, the system of equatio ns" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 325 1 "B" }{TEXT -1 1 " " }{TEXT 324 1 "x" }{TEXT -1 3 " = " }{TEXT 323 1 "b" }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 83 "has a uni que solution. It can be obtained as follows: we pick some right-hand-s ide " }{TEXT 322 1 "b" }{TEXT -1 1 ":" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "bv:=vector([1,3,5]);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "xsol:=evalm(Binv &* bv);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 17 "O bserve that the " }{TEXT 19 2 "&*" }{TEXT -1 27 " operator works insid e the " }{TEXT 19 5 "evalm" }{TEXT -1 6 " call." }}{PARA 0 "" 0 "" {TEXT -1 84 "We verify the solution (a mathematician accepts a solutio n only after verification):" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "eval m(B &* xsol - bv);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 28 "Thus we hav e found a vector " }{TEXT 19 4 "xsol" }{TEXT -1 11 " such that " } {TEXT 19 12 "B&*xsol = bv" }{TEXT -1 1 "." }}{PARA 0 "" 0 "" {TEXT -1 116 "Of course, in practice one would not perform a matrix inverse to \+ solve a single system of equations, as it requires " }{TEXT 298 1 "n" }{TEXT -1 48 " times more operations to find an inverse of an " } {TEXT 297 1 "n" }{TEXT -1 4 "-by-" }{TEXT 296 1 "n" }{TEXT -1 40 " mat rix than to solve the linear system." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 194 "We demonstrate now that a homogeneous \+ system of linear equations has interesting solutions if the coefficien t matrix is singular (otherwise the solution is unique, and only the t rivial solution " }{TEXT 321 1 "x" }{TEXT -1 23 " = [0,0,0] is allowed )." }}{PARA 0 "" 0 "" {TEXT -1 23 "We redefine our matrix " }{TEXT 320 1 "A" }{TEXT -1 1 ":" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 37 "A:=matr ix([[1,2,3],[4,5,6],[7,8,9]]);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "zerov:=vector([0,0,0]);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "xsol:=vector([x1,x2,x3]);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "evalm(A&*xsol-zerov);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "solve(%,xsol);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 87 "This error message means that the solve procedure does not accept \+ vectors as arguments." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "eqs:=evalm (A&*xsol-zerov);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "whattyp e(eqs);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "eqs[1];" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "sol:=solve(eqs,xsol);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 18 "This didn't work. " }{TEXT 19 5 "s olve" }{TEXT -1 104 " does not work on lists. We need to convert them \+ to sets (it escapes me why one should need to do this):" }}{PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 17 "convert(eqs,set);" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 47 "sol:=solve(convert(eqs,set),convert(xsol,set));" }} }{EXCHG {PARA 0 "" 0 "" {TEXT -1 113 "Note that x3 is a parameter (pic king a number makes the solution unique), while x1 and x2 are determin ed from it." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 203 "We now proceed with the linear algebra eigenvalue problem. In \+ classical mechanics it is needed in the calculation of the principal a xes of a rigid body (diagonalization of the moments-of-inertia tensor) ." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 16 "Give n a square (" }{TEXT 300 1 "n" }{TEXT -1 4 "-by-" }{TEXT 299 1 "n" } {TEXT -1 9 ") matrix " }{TEXT 305 1 "A" }{TEXT -1 41 " we are seeking \+ a solution of the problem" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 " " 0 "" {TEXT 308 1 "A" }{TEXT -1 1 " " }{TEXT 307 1 "x" }{TEXT -1 10 " = lambda " }{TEXT 306 1 "x" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 6 "where " }{TEXT 309 1 "x" }{TEXT -1 5 " are " } {TEXT 301 1 "n" }{TEXT -1 72 "-by-1 column vectors, and lambda is a sc alar that can be complex-valued." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT -1 33 "One can prove that if the matrix " } {TEXT 310 1 "A" }{TEXT -1 81 " is real and symmetric, the eigenvalues \+ lambda are real-valued. There are always " }{TEXT 302 1 "n" }{TEXT -1 80 " of them, although the same answer can appear with a multiplicity \+ higher than 1." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 93 "The proof that a solution to the problem can be found is \+ by construction. Consider the matrix" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 313 1 "B" }{TEXT -1 3 " = " }{TEXT 312 1 "A" } {TEXT -1 10 " - lambda " }{TEXT 311 1 "I" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 39 "where lambda is an unknown scalar, and " }{TEXT 314 1 "I" }{TEXT -1 25 " the unit matrix of size " } {TEXT 304 1 "n" }{TEXT -1 4 "-by-" }{TEXT 303 1 "n" }{TEXT -1 1 "." }} {PARA 0 "" 0 "" {TEXT -1 84 "The above problem then is a homogeneous s ystem of equations with coefficient matrix " }{TEXT 315 1 "B" }{TEXT -1 1 "." }}{PARA 0 "" 0 "" {TEXT -1 90 "A homogeneous system has non-t rivial solutions only if its coefficient matrix is singular." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 63 "Thus, we can fi nd solutions to the eigenvalue problem when det(" }{TEXT 316 1 "B" } {TEXT -1 105 ")=0. This becomes a condition on lambda, which can then \+ be found in a straightforward way as shown below." }}{PARA 0 "" 0 "" {TEXT -1 21 "The solution vectors " }{TEXT 317 1 "x" }{TEXT -1 126 " t o be found separately for each eigenvalue lambda(i) are determined fro m the solution of the homogeneous system of equations " }{TEXT 319 1 " B" }{TEXT -1 1 " " }{TEXT 318 1 "x" }{TEXT -1 86 " = 0. They will not \+ be unique in the sense that the length of the vector is arbitrary." }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 58 "The geome tric interpretation of the problem is as follows:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 24 "For an arbitrary vector \+ " }{TEXT 333 1 "x" }{TEXT -1 28 " we have the property that " }{TEXT 334 1 "y" }{TEXT -1 3 " = " }{TEXT 335 1 "A" }{TEXT -1 1 " " }{TEXT 336 1 "x" }{TEXT -1 38 " points in a direction different from " } {TEXT 337 1 "x" }{TEXT -1 1 "." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT -1 19 "For a given matrix " }{TEXT 339 1 "A" } {TEXT -1 47 " we are looking for solution vectors such that " }{TEXT 340 1 "A" }{TEXT -1 42 " does not rotate them. The only effect of " } {TEXT 338 1 "A" }{TEXT -1 86 " on these vectors is a stretch operation . The amount of stretching is given by lambda." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 117 "We first define a matrix that is real and symmetric. We can simply add the transpose of a non- symmetric matrix to it:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "Am:=eval m(transpose(A)+A);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 30 "I3:=a rray(identity,1..3,1..3);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "evalm(I3);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "Bm:=evalm (Am-lambda*I3);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "cpoly:=d et(Bm);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 42 "The characteristic pol ynomial is of order " }{TEXT 332 1 "n" }{TEXT -1 80 ", i.e., in our ca se of order 3. The fundamental theorem of algebra asserts that " } {TEXT 330 1 "n" }{TEXT -1 79 " roots can be found over the field of co mplex numbers to a polynomial of order " }{TEXT 331 1 "n" }{TEXT -1 1 "." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "solve(cpoly,lambda);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "evalf(%);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 44 "The eigenvalues are real, as we constructed " } {TEXT 19 2 "Am" }{TEXT -1 84 " to be symmetric. The fact that 0 is an \+ eigenvalue implies that the original matrix " }{TEXT 19 2 "Am" }{TEXT -1 13 " is singular:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "det(Am);" }} }{EXCHG {PARA 0 "" 0 "" {TEXT -1 49 "The solution of roots of polynomi als with higher " }{TEXT 342 1 "n" }{TEXT -1 56 " is difficult (imposs ible in closed form in general for " }{TEXT 341 1 "n" }{TEXT -1 50 ">5 ) and one has to resort to numerical techniques." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 8 "For low " }{TEXT 343 1 "n " }{TEXT -1 70 " they can be found as explained above by using the fol lowing routines:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "charpoly(Am,mu) ;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "eigenvals(Am);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 59 "To find the eigenvectors requires \+ more work, but for small " }{TEXT 344 1 "n" }{TEXT -1 47 " the followi ng works (if the roots are simple):" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "eigenvects(Am);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 110 "The struc ture of the answer is: eigenvalue, multiplicity, set of eigenvectors ( even if the multiplicity is 1);" }}{PARA 0 "" 0 "" {TEXT -1 40 "The an swer for lambda=0 is easy to read." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT -1 96 "To obtain numerically calculated eigenval ues (and eigenvectors) consult the following help page:" }}{PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 10 "?Eigenvals" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}} {MARK "8" 0 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }