{VERSION 4 0 "APPLE_PPC_MAC" "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 Comment" 2 18 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 23 "Courier" 1 10 0 0 0 0 0 0 0 0 0 0 3 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 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 0 3 3 1 0 1 0 2 2 14 5 }{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 "Title " -1 18 1 {CSTYLE "" -1 -1 "Times" 1 18 0 0 0 1 2 1 1 2 2 2 1 1 1 1 } 3 1 0 0 12 12 1 0 1 0 2 2 19 1 }{PSTYLE "Title" -1 256 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 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 }} {SECT 0 {EXCHG {PARA 256 "" 0 "" {TEXT -1 9 "Lecture 6" }}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 35 "Cascade, Tile, Horizontal, Vertical" }} {PARA 0 "" 0 "" {TEXT -1 26 "Under the menu item named " }{TEXT 303 6 "Window" }{TEXT -1 33 " you will find the three options " }{TEXT 304 41 "Cascade, Tile, Horizontal, and Vertical. " }{TEXT -1 448 "To see t he effect of these first open several different worksheet in successio n. An easy way to do this is just by clicking on the blank page icon \+ on the menu bar. But you may also open any worksheets. Then select ea ch of these options. You will see what they do. [PS. I was unaware of \+ this feature of Maple till Marty Findley showed it to me the other day .] Note that assignments made in one open worksheet are recognized by \+ all open worksheets." }}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 44 "Equation s (A = B) versus Assignments (A:= B)" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 20 "A = B represents an " }{TEXT 307 8 "equation" }{TEXT -1 9 " whereas " }{TEXT 305 5 "A:= B" }{TEXT -1 7 " is an " }{TEXT 308 20 "assignment statement" }{TEXT -1 2 ". " } {TEXT 306 4 "A:=B" }{TEXT -1 55 " means, as we have seen, \"assign to A the value of B\"." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "rest art:" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 26 "We assign to the variable " }{TEXT 288 3 "eq1" }{TEXT -1 14 " the equation " }{TEXT 289 11 "x^2 + x = 1" }{TEXT -1 1 ":" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "eq1:=x^2+x = 2*x + 1;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 77 "There a re several things one can do with an equation: Here are some examples: " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "a:=lhs(eq1);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "b:=rhs(eq1);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "solve(eq1,x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "fsolve(eq1,x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "whattype(eq1);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "type(eq1,equation);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "type(q*g=r*t,equation);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 54 "No te the different results for the following commands:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "x:= s;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "x = y;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "x; " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "x:=y;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "x;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 63 "Int, int, Diff, diff , Sum, sum, Product, product, Limit, limit." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 156 "In general, when Maple \+ has two procedures of the same name where one begins with a capital le tter and one with lower case, the capitalized procedure is an " } {TEXT 258 10 "inert form" }{TEXT -1 34 " of the lower case procedure. \+ The " }{TEXT 290 5 "value" }{TEXT -1 24 " procedure forces these " } {TEXT 291 16 "inert procedures" }{TEXT -1 9 " such as " }{TEXT 292 15 "Int, Limit, Sum" }{TEXT -1 6 ", and " }{TEXT 259 4 "Diff" }{TEXT -1 78 " to be evaluated by their corresponding Maple (lower case) procedu re, such as " }{TEXT 260 17 "int, limit, sum, " }{TEXT -1 2 "or" } {TEXT 262 6 " diff." }{TEXT -1 48 " This is best understood by looking at examples:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart:" } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "z1:=Int(x^2,x=a..b);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "value(z1);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 10 "Note that " }{TEXT 256 21 "value(Int(x^2,x=a..b )" }{TEXT -1 16 " is the same as " }{TEXT 257 16 "int(x^2,x=a..b):" }} }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "int(x^2,x=a..b);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 70 "One can get a nice formula in the \+ following manner: (Note that we use " }{TEXT 261 13 "z1 = value(z)" } {TEXT -1 5 " not " }{TEXT 263 14 "z1:=value(z1)." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "z1=value(z1);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "z2:=Diff(sin(x)*exp(x),x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "z2=value(z2);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "diff(sin(x)*exp(x),x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "z3:=Sum(1/n^2,n=1..infinity);" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 13 "z3=value(z3);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "sum(1/n^2,n=1..infinity);" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 25 "z4:=Product(x-i,i=1..10);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "z4=value(z4);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "Product(x-i,i=1..10);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "z4=expand(value(z4));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 33 "z5:=Limit(sqrt(x^2)/x,x=0,right);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "z5=value(z5);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "limit(sqrt(x^2)/x,x=0,right);" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 47 "sum('f(i)','i'=m..n); product('f(i)','i'= m..n);" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 11 "The syntax " }{TEXT 293 19 "sum(f(i), i = a..b)" }{TEXT -1 5 " and " }{TEXT 294 20 "product(f(i),i=a..b)" }{TEXT -1 243 " will work if i ha s not been previously assigned but it is recommended (and often necess ary) that both f and i be enclosed in single quotes to prevent prematu re evaluation. (For example, i may have a previous value.) Thus the co mmon format is " }{TEXT 264 21 "sum('f(i)', 'i'=m..n)" }{TEXT -1 5 " a nd " }{TEXT 265 27 "product('f(i)', 'i'=m..n). " }{TEXT -1 32 "Conside r the following examples:" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 " restart:" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "for i from 1 to 2 do i^2; od;" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 2 "i;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "sum(i^2,i=1..n);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "sum ('i^2','i'=1..n);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "simpli fy(%);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 168 "The binomial coefficie nt \"n choose k\" is given by binomial(n,k). Recall that this is the n umber of k element subsets of an n element set. Also it is the coeffic ient of " }{XPPEDIT 18 0 "x^k*y^(n-k);" "6#*&)%\"xG%\"kG\"\"\")%\"yG,& %\"nGF'F&!\"\"F'" }{TEXT -1 21 " in the expansion of " }{XPPEDIT 18 0 "(x+y)^n;" "6#),&%\"xG\"\"\"%\"yGF&%\"nG" }{TEXT -1 105 ". There are \+ many formulas involving sums and binomial coefficients. Maple knows ma ny of these formulas. " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 33 "c onvert(binomial(n,k),factorial);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 41 "Here's a simple formula that Maple knows." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 64 "Sum('binomial(n,k)', 'k'=0..n) = sum('binomial(n ,k)', 'k'=0..n);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "product (i^2,i=1..n);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "product('i ^2','i'=1..n);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 45 "The answer is i n terms of the gamma function " }{XPPEDIT 18 0 "GAMMA;" "6#%&GAMMAG" } {TEXT -1 142 " (GAMMA in Maple input) which is a continuous analogue o f the factorial function. We can convert to factorial notation by the \+ following means." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "convert (%,factorial);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}} {SECT 1 {PARA 3 "" 0 "" {TEXT -1 34 "add and mul versus sum and produc t" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{PARA 15 "" 0 "" {TEXT -1 4 "The " }{TEXT 266 3 "add" }{TEXT -1 65 " procedure is used to add up an explicit sequence of values. The " }{TEXT 267 3 "mul" }{TEXT -1 104 " procedure computes a product of an explicit sequence of value s. A typical call to the add procedure is " }{TEXT 268 17 "add(f(i), i =1..n)" }{TEXT -1 2 ". " }{TEXT 309 47 "Here n must be a specific numb er not a variable" }{TEXT -1 58 ". This computes f(1) + f(2) + ... + f (n). More generally, " }{TEXT 269 18 "add(f(i), i=m..n) " }{TEXT -1 48 "computes f(m) + f(m+1) + ... + f(n). Similarly, " }{TEXT 270 17 "m ul(f(i), i=m..n)" }{TEXT -1 38 " computes f(m) * f(m+1) * ... * f(n). \+ " }}{PARA 15 "" 0 "" {TEXT -1 5 "Both " }{TEXT 271 3 "add" }{TEXT -1 5 " and " }{TEXT 272 3 "mul" }{TEXT -1 162 " are considered to be more efficient that the corresponding do-loop constructions. Also you do n ot have to put quotes around the arguments as you need to do with " } {TEXT 273 3 "sum" }{TEXT -1 5 " and " }{TEXT 274 7 "product" }{TEXT -1 131 ". Note also that unlike the for loop construction, the value o f the index i is unchanged by add and mul, as we see in our examples: " }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "i:=984;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "add(i^2,i=1..10);" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 2 "i;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "add(i^2,i=1..n);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "mul (i^2,i=1..10);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "i; " }} }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "interface(verboseproc=2);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "eval(add);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 212 "Note that the index, say i, in a for..do od; looping construction may have a value before the loop is entered. But it will have a possibly different values when the loop is finishe d executing. Here's an example:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "i:=999;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 39 " for i from 1 to 2 do print(sin(i)); od;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "i;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 15 "The procedu res " }{TEXT 295 3 "sum" }{TEXT -1 5 " and " }{TEXT 296 7 "product" } {TEXT -1 12 " unlike the " }{TEXT 297 3 "add" }{TEXT -1 5 " and " } {TEXT 298 3 "mul" }{TEXT -1 115 " procedures compute symbolic sums and products as we have seen already in previous examples. That is the li mits in " }{TEXT 299 8 "i = m..n" }{TEXT -1 296 " do not have to be sp ecific values, they can be variables. Note that sum is a very complica ted procedure since it not only does simple addition, but also has a l ot of theory about infinite series and closed forms for other finite s eries built into the procedure. Let's look at the definition of " } {TEXT 310 3 "sum" }{TEXT -1 1 ":" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "eval(sum);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 7 "printf " }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 44 "First I give a simple example of the use of " } {TEXT 280 6 "printf" }{TEXT -1 1 ":" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 32 "restart:\nA:=evalf(1000*sin(10));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 62 "printf(\"The value of 1000*sin(%d) is %E or %f. \\n\", 10, A, A);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "" 0 "" {TEXT 311 2 "%d" }{TEXT -1 43 " indicates an integer of unspecified size.\n" }} {PARA 0 "" 0 "" {TEXT 312 2 "%f" }{TEXT -1 56 " indicates a floating p oint number of unspecified size.\n" }}{PARA 0 "" 0 "" {TEXT 313 2 "%E " }{TEXT -1 91 " indicates a floating point number in scientific notat ion of unspecified size will go here." }}{PARA 0 "" 0 "" {TEXT -1 0 " " }}{PARA 0 "" 0 "" {TEXT 375 2 "%s" }{TEXT -1 73 " indicate a string, that is, a sequence of characters inclosed by quotes." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 314 2 "\\n" }{TEXT -1 67 " \+ is a new line character -- when encountered it causes a new line. " }} {PARA 0 "" 0 "" {TEXT -1 157 "\nNumbers can be added between the % and d,f,E, or s to indicate the numbers of places allocated for the numb er being printed. See the following examples. \n" }}{PARA 0 "" 0 "" {TEXT -1 167 "Numbers are right justified unless one places a minus si gn, - , juat after the % sign. in which case they are left justified. \+ Examine carefully the following examples." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 257 "" 0 "" {TEXT -1 167 "Note that the vertical lines | \+ are put in mosltly to make it easier to see the spacing determined by \+ the numbers between % and d, f, E and the effect of the - after %." }} }{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 4 "Se e " }{TEXT 276 8 "?printf " }{TEXT -1 63 "for more details and the use of many more codes in addition to " }{TEXT 315 1 "d" }{TEXT -1 2 ", \+ " }{TEXT 316 1 "f" }{TEXT -1 5 " and " }{TEXT 317 1 "E" }{TEXT -1 45 " for printing in other styles, for example, " }{TEXT 318 1 "o" } {TEXT -1 12 " for octal, " }{TEXT 319 1 "x" }{TEXT -1 18 " for hexadec imal, " }{TEXT 320 1 "s" }{TEXT -1 19 " for strings, etc. " }{TEXT 275 50 "But for now just concentrate on use of d, f and E." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 279 128 "Note that everything between the two quotatio n marks \" \" is printed verbatim --even spaces --unless it is preced ed by a % sign." }{TEXT -1 2 " \n" }}{PARA 0 "" 0 "" {TEXT -1 41 "The \+ stuff between the \" \" is called the " }{TEXT 278 13 "format string " }{TEXT -1 67 " The numbers after the format code are printed in the \+ place of the " }{TEXT 321 2 "%d" }{TEXT -1 2 ", " }{TEXT 322 2 "%f" } {TEXT -1 5 " and " }{TEXT 323 2 "%E" }{TEXT -1 7 " codes " }{TEXT 277 26 "in the order they appear. " }{TEXT 325 39 "The following was copie d from help for " }{TEXT 326 6 "printf" }{TEXT 327 10 ". Execute " } {TEXT 328 7 "?printf" }{TEXT 329 27 " for the entire help file. " }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 15 "" 0 "" {TEXT -1 19 "The format string, " }{TEXT 324 3 "fmt" } {TEXT -1 178 ", is a Maple symbol or string made up of a sequence of f ormatting specifications, possibly separated by other characters. Each formatting specification has the following format: " }}{PARA 0 "" 0 " " {TEXT -1 1 "\n" }{TEXT 23 39 " %[flags][width][.precision]cod e" }}{PARA 15 "" 0 "" {TEXT -1 117 "The % symbol begins the format spe cification. One or more of the following flags can optionally follow t he % symbol: " }}{PARA 14 "" 0 "" {TEXT -1 2 "+ " }}{PARA 14 "" 0 "" {TEXT -1 99 "A signed numeric value is output with a leading positive \+ or negative sign (+ or -) as appropriate. " }}{PARA 14 "" 0 "" {TEXT -1 2 "- " }}{PARA 14 "" 0 "" {TEXT -1 57 "The output is left justified instead of right justified. " }}{PARA 14 "" 0 "" {TEXT -1 6 "blank " }}{PARA 14 "" 0 "" {TEXT -1 153 "A signed numeric value is output with either a leading negative sign (-) or a leading blank, depending on w hether the value is negative or non-negative. " }}{PARA 14 "" 0 "" {TEXT -1 2 "0 " }}{PARA 14 "" 0 "" {TEXT -1 123 "The output is padded \+ on the left (between the sign and the first digit) with zeroes. If - i s also specified, 0 is ignored. " }}{PARA 15 "" 0 "" {TEXT -1 201 "The optional width indicates the minimum number of characters to output f or this field. If the formatted value has fewer characters, it is padd ed on the left (or right if - was specified) with blanks. " }}{PARA 15 "" 0 "" {TEXT -1 165 "The optional precision specifies the number o f digits that appear after the decimal point for floating point format s, or the maximum field width for string formats. " }}{PARA 15 "" 0 " " {TEXT -1 25 "Here are a few examples: " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 152 "In the first example below the width assigned for the fl oating point number is 13 -- this includes the decimal point. The 5 a fter the decimal point in " }{TEXT 301 6 "%13.5f" }{TEXT -1 194 " ind icates that we want 5 digits after the decimal point. In the case of \+ the E formats the standard is one digit to the left of the decimal poi nt and the number 5 indicated in the format code " }{TEXT 302 6 "%13.5 E" }{TEXT -1 292 " indicates that there will be 5 digits after the dec imal point. You can see the effect of the blank, - or + added after t he % signs in the following examples: To count the blanks more easily click on the paragraph icon at the right end of the menu bar. Clickin g again will undo the effect. " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 44 "printf(\"example: |%13.5f| \\n\",evalf(10*Pi));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 45 "printf(\"example: |%-13.5f| \\n\",e valf(10*Pi));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 45 "printf(\"e xample: |%+13.5f| \\n\",evalf(10*Pi));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 42 "printf(\"example: |%13d| \\n\",123456789012);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 43 "printf(\"example: |%13d| \\n \",123456789012.);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 43 "print f(\"example: |%-13d| \\n\",123456789012);" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 43 "printf(\"example: |%+13d| \\n\",123456789012);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 44 "printf(\"example: |%13.5E| \+ \\n\",evalf(10*Pi));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 45 "pri ntf(\"example: |%-13.5E| \\n\",evalf(10*Pi));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 45 "printf(\"example: |%-13.5E| \\n\",evalf(10*Pi)); " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 40 "printf(\"example: |%s| \+ \\n\", \"Some Word\");" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 43 "p rintf(\"example: |%-13s| \\n\", \"Some Word\");" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 42 "printf(\"example: |%13s| \\n\", \"Some Word\") ;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 42 "Here we use printf to make a little table:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 233 "printf( \" x | sim(x) | cos(x) | tan(x) \\n\");\nprintf(\"----------------- ------------------\\n\");\nfor x from 90 to 100 do\na:=evalf(sin(x)): \nb:=evalf(cos(x)):\nc:=evalf(tan(x)):\nprintf(\"%3d | % 6.5f | % 6.5f | % 6.5f \\n\", x, a,b,c);\nod:" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 257 "" 0 "" {TEXT 330 14 "The effect of " }{TEXT -1 3 "\\n " }{TEXT 331 70 "in the format is to cause a new line. Note \+ that if one repeatedly uses" }{TEXT -1 8 " printf " }{TEXT 332 7 "with out" }{TEXT -1 4 " \\n " }{TEXT 333 96 "no new line is produced. In th e following two examples we print every 5th number on a new line:" }} }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 119 "L:=[seq(i^2,i=1..20)]:\nfo r i from 1 to 20 do \n printf(\"%3d \",L[i]);\n if i mod 5 = 0 then printf(\"\\n\"); fi;\nod: " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 44 "\nHere are more examples illustrating use of " }{TEXT 334 2 "\\n" }{TEXT -1 20 " to control printing" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "with(linalg):\n" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 106 "Note that the rows of the next matrix ar e too long to get on one line so the matrix doesn't look so good." }} }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 40 "M:=randmatrix(5,70, entries =rand(0..1));" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 42 "Here's a way to \+ get it printed out nicely:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 96 "for i from 1 to 5 do\n for j from 1 to 70 do\n printf(\"%1d\", M[i,j]);\n od;\n printf(\"\\n\");\nod;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 36 "\nAn example using the string format:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 74 "L:=[\"Bill \+ Jones\", \"Ann Smith\", \"Kimiko Suzuki\",\"Juan Gonzalez\",\"Xin Lee \"];" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 80 "for i from 1 to nop s(L) do\nprintf(\"Student number %d is %s. \\n\",i,L[i]);\nend do;" }} }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 " " {TEXT -1 3 "map" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 " " 0 "" {TEXT 281 3 "map" }{TEXT -1 96 " is a very useful procedure whe n you want to apply the same procedure to \nall the elements of a " } {TEXT 282 11 "set, list, " }{TEXT -1 2 "or" }{TEXT 283 7 " matrix" } {TEXT -1 25 ". Here are some examples:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "X1:=map(sin,\{1,2,3,4,5,6,7,8\});" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 38 "Note that the following does NOT work:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "X2:=sin(\{1,2,3,4,5,6,7,8\});" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 77 "Now we want to evaluate each of the elements of X1 as floating point numbers:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "XX1:=map(evalf,X1);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 36 "We could have done this in one step:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 34 "map(evalf@sin, \{1,2,3,4,5,6,7,8\});" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 12 "Unlike sin, " }{TEXT 335 5 "evalf" } {TEXT -1 53 " is one of the few functions that do not require map:" }} }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "XX2:=evalf(X1); " }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 45 "simplify([(x-y)^2/(x-y), (z^ 2-w^2)/(z-w)]); \n" }{TEXT -1 1 "(" }{TEXT 336 8 "simplify" }{TEXT -1 43 " is another command that doesn't need map.)" }}{PARA 0 "" 0 "" {TEXT -1 52 "---but it won't hurt to use it , in case you forget." }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 48 "map(simplify, [(x-y)^2/(x-y) , (z^2-w^2)/(z-w)]);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 62 "map can a lso take \"unnamed\" functions. Here are some examples:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "Y1:=[seq(i,i=1..5)];" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "map(unapply(x^2,x),Y1);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "map(x->x^2,Y1);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "map(proc(x) x^2; end, Y1);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 38 "map(U->U[1]+U[2],[[a,b],[c,d],[e,f] ]);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 35 "poly2:=-sqrt(2)*x^2- sin(3)*x-4*x-1;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "evalf(po ly2);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "map(evalf,poly2); \n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "M:=matrix([[1,2],[3,4 ]]);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "map(sin,M);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "map(evalf@sin,M); " }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "5 mod 2, `mod`(5,2); " } {TEXT -1 58 "(Both of these give the remainder when 5 is divided by 2. )" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "evalm(M);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "map(`mod`,M,2); " }{TEXT -1 61 "(No te the second argument for `mod` goes after the matrix M)." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "map(`mod`,M,3);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "map(`mod`,M,4);\n" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 98 "A similar example would be the following: (Note that igcd (a,b,c) is the gcd of integers a,b and c." }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 25 "L:=[seq(i,i=1001..1021)];" }}}{EXCHG {PARA 0 "" 0 " " {TEXT -1 80 "The goal is to take the igcd of each element of L with \+ 6 and 10. Here's one way:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "map(igcd, L,6,10);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 20 "Another way is this:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "map(x->igc d(x,6,10),L);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}} {SECT 1 {PARA 3 "" 0 "" {TEXT -1 3 "zip" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 16 "This shows what " }{TEXT 337 3 "zip" }{TEXT -1 6 " does: " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "zip(f,[a,b,c,d],[1,2,3, 4]);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 36 "zip((x,y)->x^y,[a,b ,c,d],[1,2,3,4]);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 59 "A:=mat rix(2,2,[a1,b1,c1,d1]);\nB:=matrix(2,2,[a2,b2,c2,d2]);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "zip(f,A,B);" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 20 "zip((x,y)->x*y,A,B);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 23 "evalb \+ and linalg[equal]" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 " " 0 "" {TEXT -1 19 "The purpose of the " }{TEXT 338 5 "evalb" }{TEXT -1 131 " function is to force evaluation of expressions involving rela tional operators, using a three-valued logic system. The returns are \+ " }{TEXT 350 4 "true" }{TEXT -1 2 ", " }{TEXT 351 5 "false" }{TEXT -1 6 ", and " }{TEXT 352 4 "FAIL" }{TEXT -1 71 ". If evaluation is not po ssible, an unevaluated expression is returned." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 6 "Since " }{TEXT 353 5 "eval b" }{TEXT -1 46 " does not simplify expressions, it may return " } {TEXT 354 5 "false" }{TEXT -1 121 " to a relation which is actually tr ue. In such a case, appropriate simplification must be applied to the \+ relation before " }{TEXT 355 5 "evalb" }{TEXT -1 8 " is used" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "evalb(1 = 2);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "evalb(2 <= 3);" }}}{EXCHG {PARA 0 " > " 0 "" {MPLTEXT 1 0 14 "evalb(x <= x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "evalb(x <=y);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "f:=(u,v)->evalb(u > v);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "f(1,3);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "f(3,1);" } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 85 "A:=[1,2,3]:\nB:=[1,2,3]:\n evalb(A=B);\nA:=convert(A,set):\nB:=convert(B,set):\nevalb(A=B);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "x:=convert(sin(Pi/12),radica l);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "evalb(sin(Pi/12) = x );" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 51 "A:=matrix([[1,2],[3,4 ]]);\nB:=matrix([[1,2],[3,4]]);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "evalb(A=B);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 12 "We must us e " }{TEXT 356 10 "equal(A,B)" }{TEXT -1 68 " in the linear algebra pa ckage to test equality of matrices A and B." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "with(linalg):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "equal(A,B);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 11 "W hat about " }{TEXT 357 6 "tables" }{TEXT -1 14 ". We see that " } {TEXT 358 5 "evalb" }{TEXT -1 52 " doesn't work, but below is a method that does work." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 61 "T[1]:=1;\nT[red]:=green;\nS[1]:=1; \nS[red]:=green;\nevalb(T = S);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "equal(T,S);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "op(T) ;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "op(op(T));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "evalb(op(op(T)) = op(op(S)));" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 " " {TEXT -1 6 "testeq" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 15 "" 0 "" {TEXT -1 13 "The function " }{TEXT 341 6 "testeq" }{TEXT -1 23 " tests for equivalence " }{TEXT 339 17 "probabilistically" } {TEXT -1 13 ". It returns " }{TEXT 340 5 "false" }{TEXT -1 58 " if the expressions are not equal (or not equal to 0) and " }{TEXT 342 4 "tru e" }{TEXT -1 45 " otherwise for the class of expressions that " } {TEXT 343 6 "testeq" }{TEXT -1 25 " understands. The result " }{TEXT 344 5 "false" }{TEXT -1 6 " is al" }{TEXT 345 13 "ways correct;" } {TEXT -1 12 " the result " }{TEXT 346 4 "true" }{TEXT -1 1 " " }{TEXT 347 43 "may be incorrect with very low probability." }{TEXT -1 1 " " } }{PARA 15 "" 0 "" {TEXT -1 144 "It will return FAIL if the procedures \+ fail to produce an answer see ?testeq for a few more details and a ref erence to the mathematics involved. " }}{PARA 15 "" 0 "" {TEXT -1 41 " Some examples from the help pages follow:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 175 "a := (sin(x)^2 - cos(x)*tan(x)) * \+ (sin(x)^2 + cos(x)*tan(x))^2;\nb := 1/4*sin(2*x)^2 - 1/2*sin(2*x)*cos( x) - 2*cos(x)^2\n + 1/2*sin(2*x)*cos(x)^3 + 3*cos(x)^4 - cos(x)^ 6;\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "evalb(a=b);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "testeq(a=b);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 41 "c:=surd(2+sqrt(5),3) + surd(2-sqrt( 5),3);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 55 "According to an article in the Februarly 2001 issue of " }{TEXT 348 20 "Mathematics Magazine " }{TEXT -1 43 " the number c is actually 1. But note that " }{TEXT 349 11 "testeq(c=1)" }{TEXT -1 23 " doesn't tell us this. " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "testeq(c=1);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 98 "See the article for a proof that c is, in fact, equa l to 1. Meanwhile we can be fairly confident (" }{TEXT 359 20 "but not totally sure" }{TEXT -1 90 ") by finding a floating point evaluation \+ to say 1000 digits. Let's first try fewer digits:" }}}{EXCHG {PARA 0 " > " 0 "" {MPLTEXT 1 0 24 "Digits:=10;\nevalf(c,10);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "Digits:=100;\nevalf(c,100);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "Digits:=1000;\nevalf(c,1000);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 11 "Palindromes" }} {EXCHG {PARA 0 "" 0 "" {TEXT -1 59 "Here we show how to determine whet her or not a number is a " }{TEXT 287 5 "palin" }{TEXT -1 0 "" }{TEXT 286 5 "drome" }{TEXT -1 85 ", that is whether or not its digits read t he same forward as backwards. For example, " }{TEXT 300 9 "113343311" }{TEXT -1 17 " is a palindrome." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart:" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 100 "Recall that t he following command converts an integer to a list of its digits --- i n reversed order." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "L:=con vert(1234,base,10);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 15 "" 0 "" {TEXT -1 49 "A user can make her own conversions known to t he " }{TEXT 361 7 "convert" }{TEXT -1 79 " function by defining a Mapl e procedure in the following way. If the procedure " }{TEXT 360 11 "`c onvert/f`" }{TEXT -1 36 " is defined, then the function call " }{TEXT 362 20 "convert(a,f,x,y,...)" }{TEXT -1 13 " will invoke " }{TEXT 363 22 "`convert/f`(a,x,y,...)" }{TEXT -1 67 "; Here we create a procedur e to convert a list back to an integer." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 91 "`convert/number`:=proc(L)\n local i,n;\n n:=nops(L) ;\n add(L[i]*10^(i-1),i=1..n);\nend proc:" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 18 "convert(L,number);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 19 "Here's a procedur e " }{TEXT 284 3 "REV" }{TEXT -1 93 " whose input is a list L and whos e output is the list obtained by reversing the entries in L." }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 62 "REV:=proc(L)\n local i;\n \+ [seq(L[-i],i=1..nops(L))];\nend proc:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "REV([1,2,3,4,5,6,7,8,9]);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 41 "Using the above we can define a procedue " }{TEXT 364 3 " rev" }{TEXT -1 117 " which given as input a positive integer n returns the integer obtained by writing the digits of n in reversed order:" } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 91 "rev:=proc(n)\n local i,L, k;\n L:=convert(n,base,10);\n L:=REV(L);\n convert(L,number);\nend: " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "rev(123456789);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 17 "A number n is a " }{TEXT 285 12 " palindrome " }{TEXT -1 91 "if rev(n) = n. Using the above we can eas ily test whether or not a number is a palindrome:" }}}{EXCHG {PARA 0 " > " 0 "" {MPLTEXT 1 0 47 "ispalindrome:=proc(n)\n evalb(n = rev(n)); \nend:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "ispalindrome(1232 1);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "ispalindrome(1121); " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 45 "Let's find some primes which \+ are palindromes:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 107 "L:=NUL L:\nfor i from 1 to 3000 do \n p:=ithprime(i);\n if ispalindrome (p) then L:=L,p; end if; \nend do:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2 "L;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "nops( [L]);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{PARA 18 "" 0 "" {TEXT -1 0 "" }}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 30 "Assignment 6 \+ --Due Next Monday" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 365 10 "Problem 1." }{TEXT -1 2 " \n" }}{PARA 0 "" 0 "" {TEXT -1 211 "It is a fact that there are 16 2x2 matrices with entries fro m the set \{0,1\}. It follows that if one generates two random 2x2 ma trices A and B with entries from \{0,1\} the probability that A=B is 1 /16 = .0625. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 18 "Use the procedure " }{TEXT 369 10 "randmatrix" }{TEXT -1 335 " in the linear algebra package to generate two random 2x2 matrice s A and B with entries in \{0,1\}. Do this 3000 times and count the n umber of times the matrices A and B are equal. If they are equal N tim es out of 3000 then N/3000 is an approximation of the true probability . How does the approximation compare to the true probability? " } {TEXT 366 4 "Hint" }{TEXT -1 15 ": First define " }{TEXT 367 14 "bit:= rand(0..1" }{TEXT -1 8 "). Then " }{TEXT 368 20 "randmatrix(2,2,bit) \+ " }{TEXT -1 146 "will generate a random 2x2 matrix with entries in \{0 ,1\}. Note that doing the experiment repeatedly will give a different \+ approximation each time.\n" }}{PARA 0 "" 0 "" {TEXT 374 10 "Problem 2. " }{TEXT -1 25 " Find the exact value of " }{XPPEDIT 18 0 "Sum(`mod`(n ,5),n = 1 .. 5000);" "6#-%$SumG6$-%$modG6$%\"nG\"\"&/F);\"\"\"\"%+]" } {TEXT -1 50 " using each of the following methods: \n(a) using " } {TEXT 370 3 "sum" }{TEXT -1 2 ", " }}{PARA 0 "" 0 "" {TEXT -1 10 "(b) \+ using " }{TEXT 371 3 "add" }{TEXT -1 6 ", and " }}{PARA 0 "" 0 "" {TEXT -1 12 "(c) using a " }{TEXT 372 7 "do loop" }{TEXT -1 2 ". " }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 1 "[" }{TEXT 373 7 "Remark:" }{TEXT -1 73 " If you look closely at the answers you \+ may find something wrong. A bug!]" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT 376 7 "Problem" }{TEXT -1 1 " " }{TEXT 377 1 "3 " }{TEXT -1 127 ". The following program generates a 20x51 matrix M of 0's and 1's. (This is an example of a 1-dimensional cellular automat on.)" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 33 "( a) Print out the matrix M using " }{TEXT 378 6 "printf" }{TEXT -1 52 " with no spaces between the 0's and 1's in each row." }}{PARA 0 "" 0 " " {TEXT -1 9 "\n(b) Use " }{TEXT 380 3 "map" }{TEXT -1 114 " to change each 0 in the matrix M to the blank string \" \" and, each 1 in the \+ matrix to the string \"X\". Then use " }{TEXT 379 6 "printf" }{TEXT -1 11 " with the " }{TEXT 381 2 "%s" }{TEXT -1 92 " format code to pr int the matrix of blanks and X's with no spaces between them on each r ow. " }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 37 "L:=[seq(0,i=1..25),1,seq(0,i=1..25) ]:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 107 "f:=proc(X)\nlocal i; \n[X[1]+X[2] mod 2, seq(X[i-1]+X[i]+X[i+1] mod 2, i=2..50), X[50]+X[51 ] mod 2];\nend proc:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 44 "M:= matrix(20,51,[seq((f@@n)(L),n = 0..19)]):" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 382 11 "Problem 4. " }{TEXT -1 23 "Write three procedures " }{TEXT 386 1 "A" }{TEXT -1 1 "," }{TEXT 387 2 " M" }{TEXT -1 1 "," }{TEXT 388 7 " and S" }{TEXT -1 8 ", using " }{TEXT 383 3 "zip" }{TEXT -1 4 " or " }{TEXT 408 3 "add" }{TEXT -1 44 " to perform each of the tasks listed below:\n" }}{PARA 0 "" 0 "" {TEXT -1 4 "Let " }{TEXT 389 5 "v = [" }{XPPEDIT 18 0 "v[1];" "6#&%\"v G6#\"\"\"" }{TEXT -1 0 "" }{TEXT 391 1 "," }{XPPEDIT 18 0 "v[2];" "6#& %\"vG6#\"\"#" }{TEXT -1 0 "" }{TEXT 392 5 ",...," }{XPPEDIT 18 0 "v[n] ;" "6#&%\"vG6#%\"nG" }{TEXT -1 0 "" }{TEXT 393 1 "]" }{TEXT -1 5 " and " }{TEXT 390 5 "w = [" }{XPPEDIT 18 0 "w[1];" "6#&%\"wG6#\"\"\"" } {TEXT -1 0 "" }{TEXT 394 1 "," }{XPPEDIT 18 0 "w[2];" "6#&%\"wG6#\"\"# " }{TEXT -1 0 "" }{TEXT 395 5 ",...," }{XPPEDIT 18 0 "w[n];" "6#&%\"wG 6#%\"nG" }{TEXT -1 0 "" }{TEXT 396 2 "] " }{TEXT -1 57 "be lists (each of indeterminate length n). Then we want:\n" }}{PARA 0 "" 0 "" {TEXT -1 4 "(a) " }{TEXT 384 11 "A(v,w) = [(" }{XPPEDIT 18 0 "v[1]+w[1];" "6 #,&&%\"vG6#\"\"\"F'&%\"wG6#F'F'" }{TEXT -1 0 "" }{TEXT 397 10 ") mod 2 , (" }{XPPEDIT 18 0 "v[2]+w[2];" "6#,&&%\"vG6#\"\"#\"\"\"&%\"wG6#F'F( " }{TEXT -1 0 "" }{TEXT 398 18 ") mod 2, . . . , (" }{XPPEDIT 18 0 "v[ n]+w[n];" "6#,&&%\"vG6#%\"nG\"\"\"&%\"wG6#F'F(" }{TEXT -1 0 "" }{TEXT 399 8 ") mod 2]" }{TEXT -1 6 "\n\n(b) " }{TEXT 385 11 "M(v,w) = [(" } {XPPEDIT 18 0 "v[1]*w[1];" "6#*&&%\"vG6#\"\"\"F'&%\"wG6#F'F'" }{TEXT -1 0 "" }{TEXT 400 10 ") mod 2, (" }{XPPEDIT 18 0 "v[2]*w[2];" "6#*&&% \"vG6#\"\"#\"\"\"&%\"wG6#F'F(" }{TEXT -1 0 "" }{TEXT 401 18 ") mod 2, \+ . . . , (" }{XPPEDIT 18 0 "v[n]*w[n];" "6#*&&%\"vG6#%\"nG\"\"\"&%\"wG6 #F'F(" }{TEXT -1 0 "" }{TEXT 402 8 ") mod 2]" }{TEXT -1 6 "\n\n(c) " } {TEXT 403 9 "S(v,w) = " }{XPPEDIT 18 0 "v[1]*w[1]+v[2]*w[2];" "6#,&*&& %\"vG6#\"\"\"F(&%\"wG6#F(F(F(*&&F&6#\"\"#F(&F*6#F/F(F(" }{TEXT -1 11 " + . . . + " }{XPPEDIT 18 0 "v[n]*w[n];" "6#*&&%\"vG6#%\"nG\"\"\"&%\"w G6#F'F(" }{TEXT -1 51 ".\n\n(d) Show that your procedures work by comp uting " }{TEXT 404 14 "A(v,w), M(v,w)" }{TEXT -1 5 " and " }{TEXT 405 6 "S(v,w)" }{TEXT -1 32 " for the following values:\n\n " }{TEXT 406 17 "v = [1,1,1,1,1,1]" }{TEXT -1 5 " and " }{TEXT 407 26 "w = [1,0 ,1,0,1,0].\n\nHint: " }{TEXT -1 55 "The first procedure definition sho uld begin as follows:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "A:=proc(v,w)" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{PARA 0 "" 0 " " {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}}{MARK "12" 0 }{VIEWOPTS 0 0 0 1 1 1803 1 1 1 1 } {PAGENUMBERS 0 1 2 33 1 1 }