{VERSION 5 0 "IBM INTEL NT" "5.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 Comment" 2 18 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 35 "" 0 1 104 64 92 1 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 256 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 257 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 258 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 259 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 260 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 261 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 262 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 263 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 264 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 265 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 266 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 267 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 268 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 269 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 270 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 271 "" 0 1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 0 0 0 0 0 0 }{CSTYLE "" -1 456 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 457 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 458 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 459 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 } {CSTYLE "" -1 460 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 461 "" 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 462 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 463 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }1 1 0 0 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "Heading 1 " -1 3 1 {CSTYLE "" -1 -1 "Times" 1 18 0 0 0 1 2 1 2 2 2 2 1 1 1 1 }1 1 0 0 8 4 1 0 1 0 2 2 0 1 }{PSTYLE "Bullet Item" -1 15 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }1 1 0 0 3 3 1 0 1 0 2 2 15 2 }{PSTYLE "Heading 1" -1 256 1 {CSTYLE "" -1 -1 "Times" 1 18 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }1 1 0 0 8 4 1 0 1 0 2 2 0 1 }{PSTYLE "Norma l" -1 257 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 1 2 2 2 2 1 1 1 1 }1 1 0 0 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "Author" -1 258 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 1 2 2 2 1 1 1 1 }3 1 0 0 8 8 1 0 1 0 2 2 0 1 }{PSTYLE "Title" -1 259 1 {CSTYLE "" -1 -1 "Times" 1 18 0 0 0 1 2 1 2 2 2 2 1 1 1 1 }3 1 0 0 12 12 1 0 1 0 2 2 19 1 }{PSTYLE "Normal" -1 260 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 1 2 2 2 1 1 1 1 }1 1 0 0 0 0 1 0 1 0 2 2 0 1 }} {SECT 0 {EXCHG {PARA 259 "" 0 "" {TEXT -1 9 "Lecture 3" }}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 50 "if ... then ... elif ... then ... else .. . end if;" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 257 "" 0 "" {TEXT 280 49 "Such statements take one of the following forms:" } {TEXT -1 2 "\n\n" }{TEXT 260 2 "if" }{TEXT -1 1 " " }{TEXT 272 18 "Boo lean expression" }{TEXT -1 1 " " }{TEXT 261 4 "then" }{TEXT -1 7 " \n \+ " }{TEXT 273 22 "sequence of statements" }}{PARA 257 "" 0 "" {TEXT 276 7 "end if;" }{TEXT 277 1 "\n" }}{PARA 257 "" 0 "" {TEXT -1 38 "--------------------------------------" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 262 2 "if" }{TEXT -1 21 " Boolean expr ession " }{TEXT 263 4 "then" }{TEXT -1 27 " \n sequence of statement s\n" }{TEXT 264 4 "else" }}{PARA 0 "" 0 "" {TEXT -1 24 " sequence of s tatements\n" }{TEXT 278 7 "end if;" }{TEXT -1 1 "\n" }}{PARA 0 "" 0 " " {TEXT -1 38 "--------------------------------------" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 265 2 "if" }{TEXT -1 24 " B oolean expression1 " }{TEXT 266 4 "then" }{TEXT -1 27 " \n sequence \+ of statements\n" }{TEXT 267 4 "elif" }{TEXT -1 21 " Boolean expression 2 " }{TEXT 268 4 "then" }}{PARA 0 "" 0 "" {TEXT -1 23 " sequence of st atements" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 4 " " }{TEXT 281 6 ". . . " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT 269 4 "elif" }{TEXT -1 21 " Boolean expression3 \+ " }{TEXT 270 4 "then" }{TEXT -1 25 "\n sequence of statements\n" } {TEXT 271 4 "else" }{TEXT -1 26 "\n sequence of statements\n" }{TEXT 279 7 "end if;" }}{PARA 0 "" 0 "" {TEXT -1 38 "----------------------- ---------------" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 22 "[In Maple V one used " }{TEXT 396 2 "fi" }{TEXT -1 14 " \+ in place of " }{TEXT 395 8 "end if ." }{TEXT -1 35 " In Maple 6 , 7, \+ and 8 one may use " }{TEXT 397 7 "fi, end" }{TEXT -1 4 " or " }{TEXT 398 6 "end if" }{TEXT -1 42 " interchangeably. So if I slip up and use " }{TEXT 399 2 "fi" }{TEXT -1 48 " from time to time you will know wh at it means.]" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 3 "By " }{TEXT 259 18 "Boolean expression" }{TEXT -1 36 " we \+ mean a statement that is either " }{TEXT 374 4 "true" }{TEXT -1 4 " or " }{TEXT 375 5 "false" }{TEXT -1 52 ". (Note: Maple's Boolean express ions have the value " }{TEXT 376 4 "true" }{TEXT -1 4 " or " }{TEXT 377 5 "false" }{TEXT -1 8 " and not" }{TEXT 379 5 " True" }{TEXT -1 4 " or " }{TEXT 378 5 "False" }{TEXT -1 49 ".) Such statements are usual ly constructed using " }{TEXT 400 18 "<, <=, >, >=, <>. " }{TEXT -1 3 "or " }{TEXT 401 1 "=" }{TEXT -1 46 " together possibly with the logic al operators " }{TEXT 258 12 "and, or, not" }{TEXT -1 2 ". " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 6 "Note " } {XPPEDIT 18 0 "x <> y;" "6#0%\"xG%\"yG" }{TEXT -1 32 " is denoted by x <> y in Maple. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 73 "Other types of Boolean expressions are formed by procedur es which return " }{TEXT 389 4 "true" }{TEXT -1 4 " or " }{TEXT 390 5 "false" }{TEXT -1 17 ". And example is " }{TEXT 391 10 "isprime(n)" } {TEXT -1 43 ". For specific values of n, this is either " }{TEXT 392 4 "true" }{TEXT -1 4 " or " }{TEXT 393 5 "false" }{TEXT -1 3 ". \n" }} {PARA 0 "" 0 "" {TEXT -1 55 "One can test a Boolean expression by usin g the command " }{TEXT 394 5 "evalb" }{TEXT -1 30 " as in the followin g examples:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 4 "1<2;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 " evalb(1<2);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "evalb(2<1); " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "evalb(z " 0 "" {MPLTEXT 1 0 8 "restart:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "if t > 1 then \n x:=3; \nend if;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 34 "The expre ssion t > 1 is called a " }{TEXT 257 18 "Boolean expression" }{TEXT -1 221 ". The problem here is that Maple does not know the value of t so it cannot tell if t > 1 is true or false. This can be fixed by p utting in a value of t as we now do. Note that a print statement is no t needed if we use " }{TEXT 402 7 "end if;" }{TEXT -1 16 " as opposed to " }{TEXT 403 6 "end if" }{TEXT -1 1 ":" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 30 " Try to anticipate the \+ output." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 48 "t:=3:\nif t > 1 \+ then \n x:=2;\n print(x);\nend if:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 36 "t:=3:\nif t > 1 then \n x:=2;\nend if;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 39 "t:=0:\nif t > 1 then \n x:=2; \ne nd if; " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 44 "t:=0:\nif t > 1 then \n x:=2; \nend if;\nx:=3 ; " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 50 "The above can be accomplis hed with the following:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 50 " t:=0:\nif t > 1 then \n x:=2; \nelse\n x:=3;\nend if;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 23 "Here we illustrate the " }{TEXT 256 52 "i f .. then .. elif .. then else... fi construction." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 183 "f:=proc(y)\n if y <= 1 then \n return \+ 1;\n elif y <= 2 then \n return 2;\n elif y <= 3 then \n return 3; \n elif y <= 4 then \n return 4;\n else \n return infinity;\n end \+ if;\nend proc:\n" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 176 "Note that a \+ procedure returns only one value. When a value is returned the rest of the procedure is skipped.\nThe same result can be accomplished with t he following procedure.:\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 167 "g:=proc(y)\nif y <= 1 then return 1; end if;\nif y <= 2 then retu rn 2; end if;\nif y <= 3 then return 3; end if;\nif y <= 4 then return 4; end if; \nreturn infinity; \nend:\n" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 56 "We check a few values of x to see that f(x) = g(x): The \+ " }{TEXT 353 5 "by .5" }{TEXT -1 36 " in the do loop causes increments of" }{TEXT 434 3 " .5" }{TEXT -1 26 " instead of the default by" } {TEXT 404 2 " 1" }{TEXT -1 1 "." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 108 "for x from 0 to 5 by .5 do \nprint(`If x= ` , x , ` then, f(x) = ` , f(x) , ` g(x) = `, g(x)); \nod;" }}}{EXCHG {PARA 0 " " 0 "" {TEXT -1 154 "Let's try to plot the function f (t) for t from 0 to 5. The first plot fails, however, the second method works. You ca n see that we have a step function." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "plot(f(t),t=0..5, 0..5);" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 18 "plot(f,0..5,0..5);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 65 "More examples: We create a Boolean valued function which \+ we call " }{TEXT 405 13 "is_increasing" }{TEXT -1 1 "." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 115 "is_increasing:=proc(a,b,c)\n if (a < b) and (b < c) then \n return true; \n else\n return false;\n e nd if;\nend proc:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 65 "is_inc reasing(1,2,3);\nis_increasing(1,2,1);\nis_increasing(1,1,1);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 55 "Note that we can get these on the \+ same line as follows:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 63 "is _increasing(1,2,3),is_increasing(1,2,1),is_increasing(1,1,1);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 45 "Here's another example of a Boolea n function." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 156 "is_composit e:=proc(n)\n if n < 2 then return false; end if;\n if isprime(n) = f alse then \n return true; \n else\n return false; \n end if; \n end proc:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 50 "is_composi te(1),is_composite(11),is_composite(10);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 24 "Note that the statement " }{MPLTEXT 1 0 19 "isprime(n) = \+ false " }{TEXT -1 34 "may be replaced by the statement " }{MPLTEXT 1 0 16 "not(isprime(n)) " }{TEXT -1 48 "in fact the procedure may be wri tten as follows:" }{MPLTEXT 1 0 1 " " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 92 "is_composite2:=proc(n)\nif n < 2 then return false; e nd if;\nreturn not(isprime(n));\nend proc:" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 55 "is_composite2(1), is_composite2(11), is_composite2( 10);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 53 "for .. . while .. do ... by .. end do, next and break" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 26 "We look at some exampl es: " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 56 "for i to 3 do \n y:=i^2;\n sin(y*z);\n evalf(%);\n end do;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 29 "Note that this is the \+ same as" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 63 "for i from 1 to \+ 3 do \n y:=i^2;\n sin(y*z);\n evalf(%);\nend do;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 355 "Note that the value of the index i is 4 after \+ the above loop for i from 1 to 3 is executed. Each time one goes throu gh the loop the value of the index is incremented by 1 and then if the value is less that the upper limit 3 the loop is executed and control is passed to the next statement (if there is one). We now see what th e value of the variable i is:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "i;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 83 "If we use by 5.5 then \+ the index is increased by 5.5 each time, as in the following:" }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 49 "for q from -10 to 10 by 5.5 do\n print(q);\nend do:" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 67 "Of course, 5.5 may be replace by any numb er even a negative number." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 44 "for j from 3 to 0 by -1 do\nprint(j);\nend do;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 29 "We now illustrate the use of " }{TEXT 435 5 "brea k" }{TEXT -1 91 " in a loop. This program will find the smallest integ er w between 1 and 100 that satisfies " }{XPPEDIT 18 0 "2^w > 10^6" "6 #2*$\"#5\"\"')\"\"#%\"wG" }{TEXT -1 1 ":" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 133 "for w from 1 to 100 do\n if 2^w > 10^6 then\n pr int(w, 2^w);\n break;\n end if;\nend do;\nprint(`We are finished! \+ and `,`w =`,w );\n" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 10 "Note that \+ " }{TEXT 283 5 "break" }{TEXT -1 64 " means to get out of the loop and go to the statement following " }{TEXT 301 6 "end do" }{TEXT -1 2 ". \+ " }{TEXT 386 5 "When " }{TEXT 385 5 "break" }{TEXT 387 82 " is execute d the value of the index w is the value at the time the loop is exited " }{TEXT -1 58 "Note that the same result is obtained if we leave out the " }{TEXT 325 6 "to 100" }{TEXT -1 101 " on the first line. This m ay be useful if we don't know how far to search for the desired value \+ of w." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 126 "for w from 1 do\n if 2^w > 10^6 then\n print(w, 2^w);\n break;\n end if;\nend d o;\nprint(`We are finished! and `,`w =`,w );\n" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 95 "Let's write a program to find the product of all pri mes less than 100: Try this program with a " }{TEXT 326 9 "semicolon" }{TEXT -1 7 " after " }{TEXT 327 6 "end do" }{TEXT -1 15 " rather than a " }{TEXT 328 5 "colon" }{TEXT -1 44 ". Now see if you can guess wha t the command " }{TEXT 388 4 "next" }{TEXT -1 6 " does." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 104 "P:=1:\nfor m from 1 to 100 do\n i f isprime(m) = false then \n next; \n end if;\n P:= P * m;\nend d o:\nP; " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 10 "Note that " }{TEXT 284 5 "next " }{TEXT -1 38 " means to go to the next value of the " } {TEXT 354 5 "index" }{TEXT -1 25 " - in the above case the " }{TEXT 355 5 "index" }{TEXT -1 4 " is " }{TEXT 329 1 "m" }{TEXT -1 25 " - if \+ m is not prime. If " }{TEXT 436 4 "next" }{TEXT -1 53 " is executed th en the commands in the loop following " }{TEXT 437 3 "nex" }{TEXT -1 103 "t will be skipped over. In this program, if m is prime we replac e P by the current value of P times m." }}{PARA 0 "" 0 "" {TEXT -1 0 " " }}{PARA 0 "" 0 "" {TEXT -1 76 "\nIn the following example we seek th e smallest positive integer n such that " }{XPPEDIT 18 0 "1000 <= n!; " "6#1\"%+5-%*factorialG6#%\"nG" }{TEXT -1 22 ". Note that in maple \+ " }{TEXT 285 12 "factorial(n)" }{TEXT -1 5 " and " }{TEXT 286 2 "n!" } {TEXT -1 85 " give the same result. We put the print statements in ju st to see what is happening." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 161 "for n from 1 do \n print(n,n!);\n if 1000 <= n! then\n pri nt(`The answer is `, n); \n break;\n end if;\nend do:\nprint(`Aft er the loop n has the value `, n);\n" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 35 "Another way to do this is by using " }{TEXT 287 6 "while " } {TEXT 438 18 "Boolean expression" }{TEXT 439 7 " do: " }{TEXT 406 31 "The loop is executed until the " }{TEXT 440 18 "Boolean expression " }{TEXT 441 16 " becomes false. " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 64 "q:=0:\nfor n from 1 while q <= 1000 do\n q:= n!;\nen d do;\nn,n-1,q;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT 330 214 "Note that th e value of n at the end of the above loop is 8. When a \"while\" loop \+ is exited the index is increment by 1 as we see above. However, when b reak causes us to exit from a loop the index is not incremented." } {TEXT -1 69 " \n\nSee what happens if we omit the q:=0; statement at t he beginning:\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart; " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 48 "for n from 1 while q < \+ 1000 do\n q:= n!;\nend do:" }}}{PARA 0 "" 0 "" {TEXT -1 352 "This is \+ due to the fact that Maple does not know the value of q at the first s tep, so cannot tell if q < 1000 or not.\n\nAn alternative way to writ e the program is the following. Note that in this case nothing is done inside the loop, so when the condition n! < 1000 fails the value of \+ n takes that value and the value of the index is not incremented. " }} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 42 "for n from 1 while n! < 1000 do\nend do;\nn;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 109 "[Generally u se of break allows more control over the situation. So I tend to avoid use of while statements. ]" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 44 "Old notation for end do, end if and end proc" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 " " {TEXT -1 52 "In versions of Maple prior to Maple 6 one used \n\n \+ " }{TEXT 364 2 "od" }{TEXT -1 12 " instead of " }{TEXT 365 6 "end do" }{TEXT -1 1 "\n" }}{PARA 0 "" 0 "" {TEXT -1 3 " " }{TEXT 366 2 "fi" }{TEXT -1 12 " instead of " }{TEXT 367 6 "end if" }{TEXT -1 5 "\n\n \+ " }{TEXT 368 3 "end" }{TEXT -1 12 " instead of " }{TEXT 369 8 "end pro c" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 260 "" 0 "" {TEXT -1 18 "On e may still use " }{TEXT 370 6 "od, fi" }{TEXT -1 5 " and " }{TEXT 371 4 "end " }{TEXT -1 141 "in Maple 6 and 7. You may wish to do so si nce the old way is a little shorter and so far as I know it does not e ffect the speed of execution." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT -1 67 "Also in Maple IV one used \", \"\", and \+ \"\"\" instead of %, %%, %%% and " }{TEXT 372 18 "RETURN(expression)" }{TEXT -1 12 " instead of " }{TEXT 373 17 "return expression" }{TEXT -1 88 " in procedures. Maple 6 and 7 still recognizes RETURN(expressio n) but not \",\"\", and \"\"\"." }}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 25 "for x in L do ... end do;" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {EXCHG {PARA 0 "" 0 "" {TEXT -1 118 "Here is another way to use do loo ps. Here we specify exactly which values of the index we want the loop to go through:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart; " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 54 "for x in [1,3,X,Y, t^2+ t+1] do\n print(x,x^2);\nend do:" }}}{EXCHG {PARA 0 "" 0 "" {TEXT 442 21 "[1,2,X,Y,t^2 + t + 1]" }{TEXT -1 20 " is an example of a " } {TEXT 288 5 "list " }{TEXT -1 70 "--- we will say more about lists lat er. You may also use set brackets " }{TEXT 443 3 "\{ \}" }{TEXT -1 13 " instead of " }{TEXT 444 4 "[ ]" }{TEXT -1 118 " as in the followin g example. Be warned, however, that the order in sets is sometimes los t. If order is important use " }{TEXT 445 5 "[ ]" }{TEXT -1 12 " ins tead of " }{TEXT 446 3 "\{ \}" }{TEXT -1 1 "." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 54 "for x in \{1,3,X,Y, t^2+t+1\} do\n print(x,x^2) ;\nend do:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 15 "Nested do loops" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 21 "You may need to have " }{TEXT 331 27 "do loops insid e of do loops" }{TEXT -1 115 ". Here are some examples. The first all ows us to generate all ordered pairs [i,j ] where i and j are in \{1,2 ,3,4\}:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 80 "for i from 1 to 4 do\n for j from 1 to 4 do\n pri nt([i,j]);\n end do;\nend do;\n" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 21 "Note that if you use " }{TEXT 447 5 "(i,j)" }{TEXT -1 12 " instead of " }{TEXT 448 6 "[i,j] " }{TEXT -1 64 "in the above code the parent heses will not appear in the output." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 199 "The following allows us to gen erate all 2 element subsets of \{1,2,3,4\}. Note carefully that the i ndex j goes from i+1 to 4 so that j is always greater than i. This is legitimate in this case since " }{TEXT 449 13 "\{i,j\} = \{j,i\}" } {TEXT -1 27 " and so we may assume that " }{TEXT 450 5 "i < j" }{TEXT -1 2 ". " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 84 "for i from 1 to 4 do\n for j from i+1 to 4 do\n \+ print(\{i,j\});\n end do;\nend do;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 51 "Of course, we may do other things other than just " } {TEXT 356 12 "print(\{i,j\})" }{TEXT -1 187 ". We can take i,j and per form various other operations. For example, here we form the set of al l sums of i and j where i < j and put them in a set called S when i + j is a prime number " }{TEXT 451 3 "and" }{TEXT -1 94 " we count the number of times that i + j is a prime. For this we need a \"counter\" . We call it " }{TEXT 289 5 "count" }{TEXT -1 27 ". It could be any va riable." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 55 "We set printlevel to 2 so we can see what is going on. " }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "printlevel:=2;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 378 "S:=\{\}:\ncount:=0:\nfor i from 1 \+ to 4 do\n for j from i+1 to 4 do\n print(`-----------------`);\n print(i,j);\n n:=i+j;\n if isprime(n) then\n print( `prime found`);\n count:=count+1;\n print(`count = `, coun t); \n S:=S union \{n\};\n print(`S = `, S); \n en d if;\n end do;\nend do;\nprint(`----------`);\nprint(`S = `, S, `co unt = `,count);" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 198 "Why is count = 4, yet S only contains three elements?\n \nLater we will show how to get rid of unwanted commas such as the com mas in the last output statement S = , \{ 3,5,7\}, count = , 4 by use \+ of the " }{TEXT 407 6 "printf" }{TEXT -1 18 " comma instead of " } {TEXT 408 5 "print" }{TEXT -1 143 ".\n\nWe can have do loops nested th ree levels deep as in the following example where we form the set of a ll binary sequences [lists] of length 3:" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT -1 64 "Note that the print statement in the foll owing program has been " }{TEXT 452 13 "commented out" }{TEXT -1 69 " \+ by use of #. Try removing the # and seeing the difference in output." }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 164 "S:=\{\}:\nfor x1 from 0 to 1 do\n for x2 from 0 to 1 do\n \+ for x3 from 0 to 1 do\n #print(x1,x2,x3);\n S:=S union \{ [x1, x2,x3] \};\n end do:\n end do:\nend do:\nS;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 198 "We will learn other ways to define this set later. \+ Clearly you would not want to use this method to produce the set of al l 1024 binary sequences of length 10. That would require 10 nested do \+ loops. " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 26 "Local and Global Variables" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "" 0 "" {TEXT 290 15 "Local variab les" }{TEXT -1 29 " are variables that are used " }{TEXT 332 6 "inside " }{TEXT -1 99 " a procedure. After the procedure is executed the loca l variables revert to their original values. " }{TEXT 291 16 "Global v ariables" }{TEXT -1 121 " may be changed inside the procedure and the \+ values will be retained after the procedure is over. Here are some exa mples:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart:" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 97 "We first set the value of each of \+ the four variables x1,x2,y1,y2 to 1 by executing the following:" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "(x1, x2, y1, y2):=(1,1,1,1); \n" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 89 "Now we define a simple proc edure called f: Take a minute to try to guess what it will do:" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 109 "f:=proc(n)\n global x1,x2; \n local y1,y2;\n x1:=2:\n x2:=3:\n y1:=5:\n y2:=7:\n return n*x1* x2*y1*y2;\nend proc:\n" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 29 "Let's s ee what f(11) returns:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "f( 11);\n" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 36 "It will help to factor \+ this integer:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "ifactor(%) ;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 45 "Now let's see what happened \+ to the variables " }{TEXT 357 14 "x1, x2, y1, y2" }{TEXT -1 1 ":" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "x1,x2, y1,y2;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 150 "You can see that the global variables re tain the changes made inside the procedure f, but the local variables \+ are unchanged by what happened inside f." }{TEXT 380 51 " I recommend \+ using global variables very sparingly " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 118 "Here are two simple exam ples. Execute these commands in order. Try to anticipate what the outp ut will be in each case." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 " restart;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 159 "Note that a procedur e may have no input. But to execute it one still needs a pair of paren theses. Note that we use NULL as output. NULL is the empty sequence. " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 51 "f2:=proc()\nglobal x;\n x:=2*x;\nreturn NULL;\nend proc:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 51 "f3:=proc()\nglobal x;\nx:=3*x;\nreturn NULL;\nend pro c:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "x:=2;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "f2();" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "x;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "f3(); " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "x;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 " " }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 33 "print vs return inside proc edures" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 69 "It is very important that you know the difference between the use of \+ " }{TEXT 453 5 "print" }{TEXT -1 5 " and " }{TEXT 454 6 "return" } {TEXT -1 116 " when used inside procedures. Note that return can only \+ be used inside a procedure, but print can be used elsewhere." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 50 "Consider carefully the following procedures named " }{TEXT 455 6 "gprint" } {TEXT -1 5 " and " }{TEXT 456 7 "greturn" }{TEXT -1 25 ": Notice that \+ the output " }{TEXT 383 5 "seems" }{TEXT -1 60 " to be the same for ea ch. However, see below for differences" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 53 "gprint:=proc(x)\nlocal y;\ny:=2*x;\nprint(y);\nend proc:\n" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 53 "greturn:=proc(x)\nlocal y;\n y:=2*x;\nreturn y;\nend proc:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "gprint(3);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "greturn (3);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 13 "But note how " }{TEXT 457 6 "gprint" }{TEXT -1 38 " misbehaves in the following examples:" } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "y:=gprint(3);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "2+gprint(3);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 4 "But " }{TEXT 458 7 "greturn" }{TEXT -1 26 " behaves a s we would wish:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "y:=gret urn(3);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "2+greturn(3);" } }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 41 "The moral of this section is: DO NOT USE " }{TEXT 381 5 "print" }{TEXT -1 13 " INSTEAD OF " }{TEXT 382 6 "return" }{TEXT -1 109 " WHEN CONSTRUCTING A PROCEDURE. The appr opriate use of print in procedures is explained in the next section. \+ " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 " " 0 "" {TEXT -1 57 "Use of print, debug, undebug and printlevel for de bugging" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 56 "Consider the following attempt to construct a procedure \+ " }{TEXT 409 6 "binexp" }{TEXT -1 63 " whose input is n and whose outp ut is the smallest k such that " }{XPPEDIT 18 0 "n <= 2^k;" "6#1%\"nG) \"\"#%\"kG" }{TEXT -1 1 "." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 107 "binexp:=pro c(n)\nlocal k;\nfor k from 1 to 10 do\n if 2^k >= n then\n return \+ k;\n end if;\nend do;\nend proc:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "binexp(10000);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 163 "Note that we get no output for binexp(10000). In this case you ca n no doubt see the problem but let's illustrate a few debugging techni ques to try to find the bug." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 29 "First we set printlevel:=100;" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "printlevel:=100;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "binexp(10000);\n" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 48 "This doesn't help in this case. Next we try the " }{TEXT 414 5 "debug" }{TEXT -1 69 " command after setting the print level back to the default level of 1:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "printlevel:=1:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "debug(binexp):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "b inexp(10000);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 25 "Again not much h elp. Use " }{TEXT 413 7 "undebug" }{TEXT -1 53 " to turn off the debug ger after you are done with it." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "undebug(binexp);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 29 "Now l et's try inserting some " }{TEXT 415 5 "print" }{TEXT -1 223 " stateme nts in the procedure to see what the value of the variables are as the procedure runs. (In practice you don't have to recopy the procedure t o do this. Just insert the statements as you would with any wordproces sor.)" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 197 "binexp:=proc(n)\n local k;\nfor k from 1 to 10 do\nprint(`k=`,k);\nprint(`2^k = `,2^k); \nprint(`n=`, n);\nprint(`---------------------------`);\n if 2^k >= \+ n then\n return k;\n end if;\nend do;\nend proc:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "binexp(10000);" }}}{EXCHG {PARA 0 "" 0 " " {TEXT -1 87 "Here we see that k only goes up to 10. So we look back \+ and see that we need to increase" }}{PARA 0 "" 0 "" {TEXT -1 172 "the \+ value of 10 in the upper limit of the do loop. When doing this it suff ices to comment out the print statements by inserting # before them as we now do as we change the " }{TEXT 410 2 "10" }{TEXT -1 4 " to " } {TEXT 411 8 "infinity" }{TEXT -1 37 " -- or we could merely leave out \+ the " }{TEXT 412 5 "to 10" }{TEXT -1 120 " part and we would get equiv alent results. But note that you must be assured that the procedure wo uld eventually return " }{TEXT 459 9 "something" }{TEXT -1 30 " else i t could go on forever." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 207 "binexp:=proc(n)\nlocal k;\nfor k from 1 to infinity do\n#print(`k=`,k );\n#print(`2^k = `,2^k);\n#print(`n=`, n);\n#print(`----------------- ----------`);\n if 2^k >= n then\n return k;\n end if;\nend do;\n end proc:" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 17 "Now we try again:" } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "binexp(10000);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 17 "Let's check this." }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 42 "evalb(2^13 >= 10000), evalb(2^14 >=10000);" }} }{EXCHG {PARA 0 "" 0 "" {TEXT -1 153 "So the procedure seems to be oka y. In general we might want to check more values of n, but in this cas e we can see clearly that the procedure is correct." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 7 "names (" }{TEXT 421 3 "aka" }{TEXT -1 31 " variables) and reserved words." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {EXCHG {PARA 0 "" 0 "" {TEXT -1 11 "In Maple a " }{TEXT 35 4 "name" } {TEXT -1 2 " (" }{TEXT 333 3 "aka" }{TEXT -1 4 ", a " }{TEXT 292 9 "va riable " }{TEXT -1 3 "or " }{TEXT 363 13 "variable name" }{TEXT -1 320 ") is usually a letter followed by zero or more letters, digits, a nd underscores, with lowercase and uppercase letters distinct. The max imum length of a name is system dependent. It may even contain spaces \+ if you enclose it in backquotes ` `. [Note that in output the backquot es are not shown.] Here's an extreme example." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 36 "`this is the name of a variable`:=2;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 35 "`this is the name of a variable`^2; " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 88 "If you use underscores where \+ spaces would be you don't need the back quotes, for example" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 34 "t his_is_the_name_of_a_variable:=3;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 60 "But note that the following will not work due to the spaces:" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 38 "this is not the name of a va riable:=2;" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 15 "" 0 "" {TEXT 417 8 "Keywords" }{TEXT -1 141 " are reserved words that are used in f orming Maple statements. These words cannot be used as variable names. There are 11 operator keywords: " }}{PARA 15 "" 0 "" {TEXT 35 8 " \+ and" }{TEXT -1 2 ", " }{TEXT 35 2 "or" }{TEXT -1 2 ", " }{TEXT 35 3 " xor" }{TEXT -1 2 ", " }{TEXT 35 3 "not" }{TEXT -1 2 ", " }{TEXT 35 7 " implies" }{TEXT -1 2 ", " }{TEXT 35 5 "union" }{TEXT -1 2 ", " }{TEXT 35 9 "intersect" }{TEXT -1 2 ", " }{TEXT 35 6 "subset" }{TEXT -1 2 ", \+ " }{TEXT 35 5 "minus" }{TEXT -1 2 ", " }{TEXT 35 3 "mod" }{TEXT -1 2 " , " }{TEXT 35 8 "assuming" }{TEXT -1 2 ", " }}{PARA 15 "" 0 "" {TEXT -1 81 "plus 35 additional language keywords, for a total of 46 reserve d words in Maple: " }}{PARA 0 "" 0 "" {TEXT -1 7 " " }{TEXT 416 631 "and assuming break by catch \n de scription do done elif else \n end \+ error export fi finally \n for \+ from global if implies \n in \+ intersect local minus mod \n module \+ next not od option \n options or proc quit read \n return save stop subset then \n to try \+ union use while \n xor \+ " }}{EXCHG {PARA 260 "" 0 "" {TEXT -1 0 "" }}{PARA 260 "" 0 "" {TEXT -1 28 "Be especially wary of using " }{TEXT 418 4 "stop " }{TEXT -1 2 ", " }{TEXT 419 4 "quit" }{TEXT -1 4 " or " }{TEXT 420 4 "done" }{TEXT -1 76 ". This may cause Maple to quit and you may lose any thing you haven't saved!" }}}{PARA 0 "" 0 "" {TEXT -1 22 " \+ " }}{PARA 0 "" 0 "" {TEXT -1 51 "You may find them at a ny time by using the command " }{MPLTEXT 1 0 9 "?reserved" }{TEXT -1 19 " . Note that since " }{TEXT 293 2 "in" }{TEXT -1 73 " is reserved \+ it cannot be used as a variable. But `in` can be a variable." }} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "in:=2;" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 8 "`in`:=2;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "`in`^2;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 58 "But quit even w ith backquotes will not work as a variable." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "`quit`:=3;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 34 "A name cannot begin with a number." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "1x:=2;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 165 "Some l etters are not allowed to be used as variables. For example the letter D cannot be used since it is the differential operator and I cannot b e used since it is " }{XPPEDIT 18 0 "sqrt(-1);" "6#-%%sqrtG6#,$\"\"\"! \"\"" }{TEXT -1 1 "." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "D:=3 ;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "I:=4;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 17 "Indexed variables" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 69 "We can use indexed variables to create subscripted variables such as " } {XPPEDIT 18 0 "x[1],x[2],x[3],x[4];" "6&&%\"xG6#\"\"\"&F$6#\"\"#&F$6# \"\"$&F$6#\"\"%" }{TEXT -1 13 ". Here's how:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 10 " Note that " }{XPPEDIT 18 0 "x[i];" "6#&%\"xG6#%\"iG" }{TEXT -1 29 " is denoted in Maple by x[i]:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "x[1], x[2], x[3], x[4];" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 49 "Su ch variables can be used as ordinary variables." }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 26 "x[1]:=2; \nx[3]:=x[1]*x[2];" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 24 "Here's another example:\n" }}}{EXCHG {PARA 0 " " 0 "" {TEXT -1 131 "We count the number of times each digit appears i n an integer. We first generate a large positive integer. Execute this assignment." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "N:=2^100-1; " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 25 "Now we set up a variable " } {XPPEDIT 18 0 "c[i];" "6#&%\"cG6#%\"iG" }{TEXT -1 18 " for each intege r " }{XPPEDIT 18 0 "i;" "6#%\"iG" }{TEXT -1 47 ". This will hold the n umber of times the digit " }{XPPEDIT 18 0 "i;" "6#%\"iG" }{TEXT -1 56 " appears in N. First we initialize these variables to 0:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 37 "for i from 0 to 9 do c[i]:=0; end d o;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 132 "Now we count the number of times each digit appears using the following loop. Note that the leas t significant digit of N is give by " }{XPPEDIT 18 0 "`mod`(N,10);" "6 #-%$modG6$%\"NG\"#5" }{TEXT -1 112 ". Then we can get rid of this dig it by subtracting it and then dividing by 10. Usually we would place \+ : after " }{TEXT 422 6 "end do" }{TEXT -1 54 ", but here we place ; so you can see what's happening." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 69 "N;\nwhile N > 0 do\nk:=N mod 10;\nc[k]:=c[k]+1;\nN:=(N - k)/10 ; \nend do;\n" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 50 "Now let's see wh at the values of the counters are:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 77 "2^100-1;\nfor i from 0 to 9 do \nprint(`digit`,i,`app ears`, c[i], `times`);\nod:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 " > " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 " " 0 "" {TEXT -1 19 "assigned and anames" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 12 "The command " }{TEXT 423 11 "assigne d(n)" }{TEXT -1 9 " returns " }{TEXT 424 4 "true" }{TEXT -1 55 " if n \+ has a value other than its own name, and returns " }{TEXT 425 5 "false " }{TEXT -1 65 " otherwise. This will be useful in the next section. F or example:" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "assigned(x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "x:=1;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "assigned(x);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 58 " The following command is a way to unassign the variable x:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "x:='x':" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 12 "assigned(x);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 51 "This also works for indexed variables. For example:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 66 "for i from 1 to 10 do\nif isprime(i ) then P[i]:=i; end if;\nend do:\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 70 "for i from 1 to 10 do\nif assigned(P[i]) then print(i ); end if;\nend do;" }}}{EXCHG {PARA 15 "" 0 "" {TEXT -1 12 "The comma nd " }{TEXT 426 8 "anames()" }{TEXT -1 103 " returns an expression seq uence of names that are currently assigned values other than their own name. " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "anames();" }}} {EXCHG {PARA 0 "" 0 "" {TEXT 427 10 "`isprime/w" }{TEXT -1 6 "` and " }{TEXT 428 7 "isprime" }{TEXT -1 29 " are names assigned by Maple." }} }{EXCHG {PARA 0 "" 0 "" {TEXT -1 79 "If we restart, you can see that t here are no names that are assigned variables." }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "anames();" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 28 "Squares and Sums of Squares." }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 14 "The procedure " }{MPLTEXT 1 0 9 "root(x,n)" }{TEXT -1 184 " (wh en x is real or complex and n is a positive integer) computes the nth \+ root of x. If x is an integer that is a perfect nth power then the nth root is returned; otherwise the power " }{XPPEDIT 18 0 "x^(1/n);" "6 #)%\"xG*&\"\"\"F&%\"nG!\"\"" }{TEXT -1 98 " is returned unevaluated. \+ We can tell if x is a positive integer by use of the Boolean function \+ " }{MPLTEXT 1 0 14 "type(x,posint)" }{TEXT -1 86 " which is true if x is a positive integer and false otherwise. Here are some examples:" } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "root(8,3); " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "root(2,3); " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "root(27,3);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 32 "Compare this with the following:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "27^( 1/3);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "simplify(%);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "type(27^(1/3),posint);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "type(root(27,3),posint);" }} }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "root(28,3);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "type(%,posint);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 11 "The command" }{TEXT 430 5 " root" }{TEXT -1 100 " also works for floating point numbers and complex numbers. Recall tha t I is the square root of -1. " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "root(28.0,3);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "ro ot(1+2.0*I,3);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 26 "We now define a procedure " }{TEXT 460 6 "is_sqr" }{TEXT -1 127 " which determines wh ether or not a positive integer is a square, that is, whether or not it is the square of another integer:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 36 "is_sqr:=n->type(root(n,2), posint):\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "is_sqr(16);" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 11 "is_sqr(17);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 130 "Now we want to determine whether or not the positive integer n is a sum of two positive squares or not. If it is, we want to find " }{TEXT 334 14 "all solutions " }{TEXT -1 17 "to the equations " } {XPPEDIT 18 0 "n = x^2+y^2;" "6#/%\"nG,&*$%\"xG\"\"#\"\"\"*$%\"yGF(F) " }{TEXT -1 41 " where x and y are positive integers and " }{XPPEDIT 18 0 "x <= y;" "6#1%\"xG%\"yG" }{TEXT -1 28 ". Note we may assume tha t " }{XPPEDIT 18 0 "x <= sqrt(n/2);" "6#1%\"xG-%%sqrtG6#*&%\"nG\"\"\" \"\"#!\"\"" }{TEXT -1 0 "" }{TEXT 350 2 " ." }{TEXT -1 38 " [Can you \+ see why? What happens if " }{XPPEDIT 18 0 "sqrt(n/2) < x;" "6#2-%%sq rtG6#*&%\"nG\"\"\"\"\"#!\"\"%\"xG" }{TEXT -1 46 " ?] Here's one way t o write such a procedure:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 210 "sumsqrs:=proc(n)\n local x, y, Sols;\n Sols:=\{\};\n for x from 1 to evalf(sqrt(n/2)) do\n y:= root(n-x^2,2);\n if type(y,posint) t hen \n Sols:=Sols union \{\{x,y\}\}; \n end if;\n end do;\n ret urn Sols;\nend proc: " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 34 "\nWhat h appens if we leave off the " }{TEXT 351 5 "evalf" }{TEXT -1 21 " in th e 4-th line of " }{TEXT 352 7 "sumsqrs" }{TEXT -1 66 "? Remove it and \+ try. Next we illustrate the use of this procedure:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "sumsqrs(50);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 50 "We check these two answers. Note that \{5\} = \{5,5\}." } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "1^2+7^2, 5^2 + 5^2;" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 74 "What would happen in the definitio n of sumsqrs if you replaced the command" }{MPLTEXT 1 0 21 " Sols unio n \{\{x,y\}\}; " }{TEXT -1 5 " by " }{MPLTEXT 1 0 17 "Sols union \{x, y\};" }{TEXT -1 1 "?" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 46 "The numbe r of elements in a set S is given by " }{MPLTEXT 1 0 7 "nops(S)" } {TEXT -1 1 "." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "nops(\{\}); " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "nops(\{a,b,c,d\});" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 70 "We use this to find the number of \+ different solutions to the equation " }{XPPEDIT 18 0 "n = x^2+y^2" "6# /%\"nG,&*$%\"xG\"\"#\"\"\"*$%\"yGF(F)" }{TEXT -1 28 " where x and y ar e integers " }{XPPEDIT 18 0 "x <= y;" "6#1%\"xG%\"yG" }{TEXT -1 14 ". \+ For example:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "nops(sumsqrs(50));" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 36 "Let's find the smallest n for which " }{XPPEDIT 18 0 "n = x^2+y^2;" "6#/%\"nG,&*$%\"xG\"\"#\"\"\"*$%\"yGF(F)" }{TEXT -1 36 " ha s at least 2 different solutions:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 100 "for n from 1 do \nif nops(sumsqrs(n)) >= 2 then \n \+ print(n,sumsqrs(n));\n break; \n end if;\nend do;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 36 "Let's find the smallest n for which " } {XPPEDIT 18 0 "n = x^2+y^2;" "6#/%\"nG,&*$%\"xG\"\"#\"\"\"*$%\"yGF(F) " }{TEXT -1 36 " has at least 3 different solutions:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 102 "for n from 1 do \n if nops(sumsqrs(n)) \+ >= 3 then \n print(n,sumsqrs(n));\n break; \n end if;\nend do;" } }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 " " }}{PARA 0 "" 0 "" {TEXT -1 92 "Here's a much more efficient program \+ due to Robert Israel for the determination of integers " }{XPPEDIT 18 0 "n <= 20^2+20^2;" "6#1%\"nG,&*$\"#?\"\"#\"\"\"*$F'F(F)" }{TEXT -1 72 " that can be expressed as the sum of two squares in more than two \+ ways. " }{TEXT 461 113 "You should use this technique when solving one of the homework exercises. So don't skip trying to understand it:\n" }{TEXT -1 42 "\nNote the use of the subscripted variable " }{TEXT 462 4 "T[m]" }{TEXT -1 17 " and the command " }{TEXT 429 8 "assigned" } {TEXT -1 84 " which tells us whether or not something has already bee n assigned to the variable " }{TEXT 463 5 "T[m]." }{TEXT -1 51 " Note that this will cover all integers from 1 to " }{XPPEDIT 18 0 "1800 = \+ 30^2+30^2;" "6#/\"%+=,&*$\"#I\"\"#\"\"\"*$F'F(F)" }{TEXT -1 1 "." }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 203 "restart:\nfor i from 1 to 3 0 do\n for j from 1 to i do\n m:= i^2 + j^2;\n if assi gned(T[m]) then \n T[m]:= T[m],[i,j];\n else T[m]:= [i, j]\n end if:\n end do: \n end do:" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 23 "Here are some examples:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "T[1];\nT[13];\nT[50];\nT[325];" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 78 "We can get the number of solutions for, say, T[325], by the following command:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "nops([T[325]]);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 39 "Using this we see which integers up to " }{XPPEDIT 18 0 "2*30^2;" "6#*&\"\"#\"\" \"*$\"#IF$F%" }{TEXT -1 68 " can be express as a sum of square in thre e or more different ways: " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 73 "for m from 1 to 2*30^2 do\nif nops([T[m]]) >=3 then print(m,T[m]); fi;\nod;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 41 "Assignment 3 (Due Tuesday, September 17) " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 431 "Perhaps you have heard the famous story about Ramanujan and Hard y's taxi number: Once when Ramanujan was ill in London, Hardy visited \+ Ramanujan in the hospital. When Hardy remarked that he had taken taxi \+ number 1729, a singularly unexceptional number, Ramanujan immediately \+ responded that this number was actually quite remarkable: it is the sm allest positive integer that can be represented in two ways by the sum of two cubes. [" }{TEXT 303 60 "from Eric Weisstein's Treasure Trove \+ of Scientific Biography" }{TEXT -1 1 "]" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 302 10 "Problem 1." }{TEXT -1 467 " \n\n(a ) Verify (using Maple) Ramanujan's statement that 1729 is the smallest positive integer that can be expressed in two different ways as a sum of two cubes. You should be able to use the ideas in the section abov e on perfect squares and sums of squares. [Use of the analogue of the \+ procedure given there due to Robert Israel is recommended.] Only here \+ we are talking of cubes instead of squares. But there are other ways \+ to do the problem that may occur to you. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 85 "(b) Find the next number after 172 9 that is a sum of two cubes in two different ways." }}{PARA 0 "" 0 " " {TEXT -1 1 " " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 1 "\n" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }{TEXT 295 11 "Problem 2. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 315 11 " Definition." }{TEXT 335 25 " A positive integer n is " }{TEXT 314 7 "p erfect" }{TEXT 336 49 " if the sum of its proper positive divisors is \+ n." }{TEXT -1 1 " " }}{PARA 0 "" 0 "" {TEXT -1 288 "\nFor example, the proper positive divisors of 6 are 1, 2, and 3. Further 6 = 1 + 2 + 3. So 6 is perfect. [If you have had number theory you may know about th e structure of even perfect numbers. Do not use that knowledge for th is exercise. Use only the definition to write your programs.]" }} {PARA 0 "" 0 "" {TEXT 313 6 " \n(a) " }{TEXT -1 108 "Write a procedure which takes as input a positive integer n and returns the sum of all \+ proper divisors of n." }{TEXT 300 1 " " }{TEXT -1 81 "Show how your pr ocedure works for the following values of n: 2, 3, 4, 6, 30, 900." }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 294 4 "(b) " } {TEXT 304 34 "Using the procedure you wrote in " }{TEXT 337 3 "(a)" } {TEXT 338 1 " " }{TEXT -1 18 "write a procedure " }{TEXT 339 9 "isperf ect" }{TEXT -1 55 " which takes as input a positive integer n and retu rns " }{TEXT 298 4 "true" }{TEXT -1 21 " if n is perfect and " }{TEXT 299 5 "false" }{TEXT -1 9 " if not. " }{TEXT 296 4 "Note" }{TEXT -1 53 ": proper divisors of n can not be greater than n/2. " }{TEXT 316 46 "Use the procedure to find all perfect numbers " }{XPPEDIT 18 0 "n \+ <= 1000;" "6#1%\"nG\"%+5" }{TEXT 317 2 ". " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 297 17 "Interesting Fact:" } {TEXT 340 293 " It is an open question whether or not there are any od d perfect numbers. So far no one has found one. In number theory you l earn the structure of the even perfect numbers. So far only a finite n umber of even perfect numbers have been found. But it is suspected tha t there are infinitely many." }{TEXT -1 1 " " }}}{EXCHG {PARA 0 "" 0 " " {TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }{TEXT 305 11 "Problem 3 ." }{TEXT -1 4 " \n\n" } {TEXT 341 10 "Definition" }{TEXT -1 6 ". The " }{TEXT 308 5 "order" } {TEXT -1 1 " " }{TEXT 319 13 "of an integer" }{TEXT -1 3 " a " }{TEXT 318 17 "modulo an integer" }{TEXT -1 59 " m is defined to be the least positive integer e such that " }{XPPEDIT 18 0 "`mod`(a^e,m) = 1;" "6# /-%$modG6$)%\"aG%\"eG%\"mG\"\"\"" }{TEXT -1 32 ". \n\nWrite a procedu re, call it " }{TEXT 306 3 "Ord" }{TEXT -1 12 ", such that " }{TEXT 320 8 "Ord(a,m)" }{TEXT -1 9 " returns " }{TEXT 358 4 "FAIL" }{TEXT -1 46 " if the order does not exist and the order of " }{TEXT 433 10 " a modulo m" }{TEXT -1 18 " if it exists.\n\n" }{TEXT 342 91 "You may use the number theoretic result that the order of a modulo m exists i f and only if " }{TEXT 321 13 "igcd(a,m) = 1" }{TEXT 343 46 ". Also yo u may use the fact that the order of " }{TEXT 359 10 "a modulo m" } {TEXT 360 23 " is never greater than " }{TEXT 361 5 "m - 1" }{TEXT 362 24 ". [Note that Maple uses " }{TEXT 322 4 "igcd" }{TEXT 344 49 " \+ for the greatest common divisor of integers and " }{TEXT 323 3 "gcd" } {TEXT 345 46 " for greatest common divisor of polynomials.] " }{TEXT -1 29 "\n\n(a) Check that you obtain: " }{TEXT 307 65 "\n\n Ord (0,11) = FAIL, Ord(2,11) = 10, Ord(4,11) = 5." }}{PARA 0 "" 0 " " {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 12 "(b) Compute " }{TEXT 432 10 "Ord(a, 15)" }{TEXT -1 20 " for a from 0 to 20." }}{PARA 0 "" 0 "" {TEXT 431 1 "\n" }}{PARA 0 "" 0 "" {TEXT 324 11 "Problem 4. " } {TEXT -1 15 "For each prime " }{TEXT 348 1 "p" }{TEXT -1 50 " from 2 t o 100 find the smallest positive integer " }{TEXT 347 1 "a" }{TEXT -1 11 " such that " }{TEXT 346 14 "Ord(a,p) = p-1" }{TEXT -1 25 ". Print \+ out a table with " }{TEXT 349 4 "p, a" }{TEXT -1 39 " on each row. \n \n[Such an a is called a " }{TEXT 309 27 "primitive elements modulo p " }{TEXT -1 47 " and plays an important role in number theory.]" }} {PARA 0 "" 0 "" {TEXT -1 1 " " }}{PARA 0 "" 0 "" {TEXT 310 5 "Hint:" } {TEXT -1 82 " You might use a loop for p from 2 to 100. If p is not pr ime then use the command " }{TEXT 311 5 "next;" }{TEXT -1 195 " to go \+ to the next value of p. If p is prime then go into another loop for a \+ from 1 to p - 1 looking for an a which has order 1 modulo p. When you \+ find one, print it out and then use the command " }{TEXT 312 6 "break; " }{TEXT -1 19 " to leave the loop." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}}}}{MARK "13 0 0" 26 }{VIEWOPTS 0 0 0 1 1 1803 1 1 1 1 } {PAGENUMBERS 1 1 2 33 1 1 }