{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 0 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 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 259 "" 0 14 0 0 0 0 0 1 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 260 "" 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 261 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 262 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 263 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 264 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 } {CSTYLE "" -1 265 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 266 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 267 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 268 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 269 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 } {CSTYLE "" -1 270 "" 0 14 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 }{CSTYLE "" -1 374 "" 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 "Maple Plot" -1 13 1 {CSTYLE "" -1 -1 "Time s" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }3 1 0 0 0 0 1 0 1 0 2 2 0 1 } {PSTYLE "List Item" -1 14 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 14 5 }{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 "Ti mes" 1 14 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 "Normal" -1 258 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 }{PSTYLE "Normal" -1 259 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 "Heading 1" -1 260 1 {CSTYLE "" -1 -1 "Time s" 1 18 0 0 0 1 2 1 1 2 2 2 1 1 1 1 }1 1 0 0 8 4 1 0 1 0 2 2 0 1 }} {SECT 0 {EXCHG {PARA 256 "" 0 "" {TEXT -1 10 "Lecture 11" }}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 10 "printlevel" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 15 "The setting of " }{TEXT 280 10 "printlevel" }{TEXT -1 93 " causes the display of the results of al l statements executed up to the \"level\" indicated by " }{TEXT 281 10 "printlevel" }{TEXT -1 10 ". If the " }{TEXT 278 10 "printlevel" } {TEXT -1 32 " is set to the positive integer " }{TEXT 279 1 "k" } {TEXT -1 31 " then only computations inside " }{TEXT 337 1 "k" }{TEXT -1 188 " nested levels of do loops , if then statements, or nested pro cedures, will be shown unless one uses a print statement. As usual, \+ this is best understood by looking at specific examples." }}{PARA 0 " " 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 30 "We first see that \+ the default " }{TEXT 338 10 "printlevel" }{TEXT -1 4 " is " }{TEXT 370 1 "1" }{TEXT -1 1 "." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 " restart:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "printlevel;" }} }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "for i from 1 to 2 do i^2; o d;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 48 "Let's see the effect of set ting printlevel to 0:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "pr intlevel:=0;" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 37 "N:=2*3;\nfor i from 1 to 2 do i^2; od;" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 255 "You see that nothing is printed i nside the do loop, but the statement N:=6 is printed since it is at le vel 0, i.e., it's not inside any loops or if statements or procedures. \n\nBut by writing print statements you can force anything you wish t o be printed: " }{TEXT 260 189 "Many times when using do loops I like \+ to set the printlevel to 0, then I can control what's printed by use o f print statements and I don't have to worry about excessive stuff bei ng printed." }{TEXT -1 38 " As in the following example. Recall " } {TEXT 371 10 "printlevel" }{TEXT -1 13 " is still at " }{TEXT 372 1 "0 " }{TEXT -1 1 "." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 78 "for i from 1 to 2 do \n x:=i^3; \n y:=sqrt(i) *sin(i);\n print(i^2);\n z:=x*y; \nod;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 106 "Now put the printlevel back to 1 and reexecute the progr am above. You see that everything is printed out. " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "printlevel:=1;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 48 "With printlevel still 1 see what happens inside " }{TEXT 373 3 "two" }{TEXT -1 17 " nested do loops:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 64 "for i from 1 to 2 do\n for j from 1 to 2 do\n i,j ,i + j;\n od;\nod;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 77 "Nothing is \+ printed: Again we can force output by putting in print statements:" }} }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 69 "for i from 1 to 2 do\n for \+ j from 1 to 2 do\n print(i,j,i+j);\n od;\nod;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 60 "We can also get this result by changing the printlev el to 2:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "printlevel:=2; " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 63 "for i from 1 to 2 do\n \+ for j from 1 to 2 do\n i,j,i + j;\n od;\nod;" }}}{EXCHG {PARA 0 "" 0 " " {TEXT -1 239 "A few more examples: (Recall the printlevel is still 2 .) Note that here we use an \"if then\" statement to induce a third le vel. Note that since 1 = 1 is true the command x:= level_3 is executed , but not printed since it is inside \"level 3\"." }}}{EXCHG {PARA 0 " > " 0 "" {MPLTEXT 1 0 107 "for i from 1 to 2 do\n for j from 1 to 2 do \n y:=level_2;\n if 1 = 1 then\n x:= level_3;\n end if;\n od;\nod ;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 51 "Let's see what happens when \+ we set printlevel to 3." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 " printlevel:=3;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 107 "for i fr om 1 to 2 do\n for j from 1 to 2 do\n y:=level_2;\n if 1 = 1 then\n \+ x:= level_3;\n end if;\n od;\nod;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 77 "Setting the printlevel very high has an effect similar to debug . For example:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "restart: \nprintlevel:=1000;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "diff (exp(x^2),x);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 51 "If we set printl evel to -1 we get no output at all." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 36 "printlevel:=-1;\ndiff(exp(sin(x)),x);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 38 "Before continuing we set it back to 1." } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "printlevel:=1;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 260 "" 0 "" {TEXT 339 18 "combine and expand" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 18 "For many purposes " }{TEXT 340 7 "co mbine" }{TEXT -1 37 " may be thought of as the inverse of " }{TEXT 341 6 "expand" }{TEXT -1 55 ". This will be made clear by examples. A lso sometimes " }{TEXT 343 7 "combine" }{TEXT -1 54 " can be used to s implify expressions when the command " }{TEXT 342 8 "simplify" }{TEXT -1 15 " will not help." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "re start:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "w:=sin(x+y);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "v:=expand(w);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "simplify(v);" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 11 "combine(v);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 47 "z1:=3*t*Int(x,x=a..b)-2*sin(u)*Int(x^2,x=a..b);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "z2:=combine(z1);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "expand(z2);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 11 "Note that " }{TEXT 344 6 "expand" }{TEXT -1 80 " do esn't work as it should in the above example. However if one first loa ds the " }{TEXT 345 7 "student" }{TEXT -1 24 " package, it will work. \+ " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "with(student):" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "expand(z2);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 28 "Here are some more examples:" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 58 "a:=I nt(f(x),x=0..2)+2*Int(g(x),x=0..2)+5*Int(h(x),x=0..2);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "b:=combine(a);" }}}{EXCHG {PARA 0 " > " 0 "" {MPLTEXT 1 0 10 "expand(b);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 41 "More examples and here we don't need the " }{TEXT 346 7 "studen t" }{TEXT -1 9 " package." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 58 "s:=sum(f[i],i= 1..n) + sum(g[i],i=1..n) + sum(h[i],i=1..n);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "s2:=combine(s);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "s3:=expand(s);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 70 "The following example was also recently discussed on the Usenet gr oup " }{TEXT 347 24 "comp.soft-sys.math.maple" }{TEXT -1 132 "-- a goo d place on the internet to go to get answers to Maple problems The que stion was how to get Maple to simplify the expression " }{XPPEDIT 18 0 "sqrt(exp(x)-1)/sqrt(exp(x/2)-1)" "6#*&-%%sqrtG6#,&-%$expG6#%\"xG\" \"\"F,!\"\"F,-F%6#,&-F)6#*&F+F,\"\"#F-F,F,F-F-" }{TEXT -1 1 "." }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 36 "z:= sqrt(exp(x)-1)/sqrt(exp( x/2)-1);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 89 "Robert Israel, one o f the leading experts on Maple, came up with the following solution:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "assume(x>0):\ncombine(z); " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "simplify(%);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 14 "More examples:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "restart:\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "exp(x)^2*exp(y); \ncombine(%);" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 43 "[2*sin(x)*cos(x),2*cos(x)^2-1];\ncombine(%);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 60 "Note that the following doesn't combine as one might expect." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "combine(2*ln(y)-ln(z));" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 51 " However if we make the following assumptions first," }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "assume(y>0,z>0);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 13 "it will work:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "combine(2*ln(y)-ln(z));" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 24 " Note that in some cases " }{TEXT 348 6 "factor" }{TEXT -1 9 " and not \+ " }{TEXT 374 7 "combine" }{TEXT -1 19 " is the inverse of " }{TEXT 349 6 "expand" }{TEXT -1 14 ", for example:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "b:=(x+y)^3; \nc:=expand(b);" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 11 "factor(c);\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "combine(c);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 23 "simplify, subs, algsub s" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 4 "The " }{TEXT 35 8 "simplify" }{TEXT -1 95 " procedure is used to ap ply simplification rules to an expression. Let's look at some examples :" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "4^(1/2)+3;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "simplify(%);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 60 "expr1:=cos(x)^5 +2*cos(x)^2 + sin(x)^4 -2*sin(x)^2-co s(2*x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "simplify(expr1); " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 72 "Note that in this case we see that combine will have a different effect:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "combine(expr1);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 29 "Compare the effect of expand:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "expand(expr1);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 37 "expr2:=cos(x)^2 + sin(x)^2 + ln(2*x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "simplify(expr2);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 123 "By adding an extra argument as in the following we can r estrict the simplification to only certain parts of the expression:" } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "simplify(expr2, 'trig');" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "simplify(expr2,'ln');" }} }{EXCHG {PARA 0 "" 0 "" {TEXT -1 58 "You can also make your own simpli fication rules by use of " }{TEXT 258 14 "side relations" }{TEXT -1 136 ", as in the following example: Note that a \"side relation\" is j ust a set or list of equations that are to be used in the simplificati on." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 36 "expr3:=expand((x^2+y ^2)^5 + cos(x));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 32 "simplif y(expr3,\{x^2 + y^2 = r\});" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 88 "Yo u may think of this as a sort of substitution: But, note that subs wil l not work here:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "subs(\{x^2 + y^2 = r\},expr3);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 40 "Consider the following similar examples: " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 33 "simplify(x^4+x^2+3,\{x^ 2=cos(t)\});" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 68 "Note that the fol lowing subs does not \"see\" the x^2 in the x^4 term." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "subs(\{x^2=cos(t)\},x^4+x^2+3);" }} }{EXCHG {PARA 0 "" 0 "" {TEXT 261 8 "simplify" }{TEXT -1 6 " with " } {TEXT 262 14 "side relations" }{TEXT -1 47 " has its limits as the fol lowing example shows." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 40 "si derel3:=\{sin(x) = (1-cos(x)^2)^(1/2)\};" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 37 "expr5:=3*tan(x) +sin(x)^2 + cos(x)^2;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "simplify(expr5,siderel3);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 73 "This means no fractional powers ar e allowed in side relations. Note that " }{TEXT 257 4 "subs" }{TEXT -1 25 " has no such restriction." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "subs(siderel3,expr5);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 81 "On the other hand we can often get rid of fractional powe rs, as in the following:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 41 "siderel4:=\{sin(x)^2 = 1-cos(x)^2\};\nexpr5;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "simplify(expr5,siderel4);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 13 "\nThe command " }{TEXT 259 7 "algsubs" }{TEXT -1 62 " performs \"algebraic substitution\". It is more versatile than " } {TEXT 263 4 "subs" }{TEXT -1 4 " or " }{TEXT 264 9 "simplify " }{TEXT 265 19 "with side relations" }{TEXT -1 53 ": \n\n\nHere are some examp les: First in the expression " }{XPPEDIT 18 0 "2*a*b^2/c;" "6#**\"\"# \"\"\"%\"aGF%%\"bGF$%\"cG!\"\"" }{TEXT -1 33 " if we want to substitu te d for " }{XPPEDIT 18 0 "a*b/c;" "6#*(%\"aG\"\"\"%\"bGF%%\"cG!\"\"" }{TEXT -1 17 ". We should get " }{XPPEDIT 18 0 "2*d*b;" "6#*(\"\"#\" \"\"%\"dGF%%\"bGF%" }{TEXT -1 22 ". Let's try to do it." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 35 "simplify(2*a*b^2/c,\{(a*b)/c = d\}) ; " }{TEXT -1 21 "Note that this fails." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 79 "On the other hand we can get the desired result by changi ng the side condition:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 32 "s implify(2*a*b^2/c,\{a*b = c*d\});" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 28 "Note that subs doesn't work:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 50 "subs(a*b/c=d,2*a*b^2/c);\nsubs(a*b=d*c,2*a*b^2/c); " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 28 "What does work here best is " } {TEXT 291 7 "algsubs" }{TEXT -1 1 ":" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "algsubs(a*b/c=d,2*a*b^2/c ); " }{TEXT -1 63 "This works! Note that we write a*b/c = d instead o f d = a*b/c." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 14 "More examples:" } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "EXP:=exp(2-a+a^2/2-a^3/6); " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 15 "We want to set " }{XPPEDIT 18 0 "a^2;" "6#*$%\"aG\"\"#" }{TEXT -1 24 " to 0. And consequently " } {XPPEDIT 18 0 "a^3;" "6#*$%\"aG\"\"$" }{TEXT -1 37 " will also be 0. W e can do this with " }{TEXT 266 7 "algsubs" }{TEXT -1 1 ":" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "algsubs(a^2=0, EXP);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 4 "But " }{TEXT 267 4 "subs" }{TEXT -1 43 " d oesn't quite do it. It's not as smart as " }{TEXT 268 7 "algsubs" } {TEXT -1 2 ". " }{TEXT 269 4 "subs" }{TEXT -1 25 " doesn't realize tha t if " }{XPPEDIT 18 0 "a^2 = 0;" "6#/*$%\"aG\"\"#\"\"!" }{TEXT -1 6 " \+ then " }{XPPEDIT 18 0 "a^3 = 0;" "6#/*$%\"aG\"\"$\"\"!" }{TEXT -1 7 " \+ also. " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "subs(a^2=0, EXP); " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 17 "But in this case " }{TEXT 352 8 "simplify" }{TEXT -1 45 " with siderelations does work to some e xtent:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "EXP2:=simplify(EX P, \{a^2 = 0\});" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 12 "But we must \+ " }{TEXT 350 8 "simplify" }{TEXT -1 4 " or " }{TEXT 351 7 "combine" } {TEXT -1 26 " again to get a nice form:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 30 "combine(EXP2);\nsimpli fy(EXP2);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 46 "expand, normal, combine, and simplify com pared" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "" 0 "" {TEXT 285 27 "expand, normal and simplify" }{TEXT -1 34 " in some context b ehave the same;" }{TEXT 282 7 " normal" }{TEXT -1 5 " and " }{TEXT 283 8 "simplify" }{TEXT -1 38 " are pretty much the same except that \+ " }{TEXT 286 6 "normal" }{TEXT -1 45 " deals only with rational functi ons where as " }{TEXT 287 8 "simplify" }{TEXT -1 92 " also can simplif y\020 expressions containing other functions (trig functions, exp, ln, etc..) " }{TEXT 284 7 "expand " }{TEXT -1 32 "is more or less the opp osite of " }{TEXT 288 6 "factor" }{TEXT -1 4 " or " }{TEXT 353 7 "comb ine" }{TEXT -1 72 ". Sometimes all three behave the same. Consider th e following examples:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "res tart:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "A:=x^2-(x+1)*(x-1) -1;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 46 "expand(A);\nnormal(A );\nsimplify(A);\ncombine(A);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "B:=(x+1)^3;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 46 "expand (B);\nnormal(B);\nsimplify(B);\ncombine(B);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 30 "C:=sin(2*x) - 2*sin(x)*cos(x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 46 "expand(C);\nnormal(C);\nsimplify(C);\ncombi ne(C);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 34 "P:=sin(x)*cos(y) \+ + cos(x)*sin(y) ;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 46 "expand (P);\nnormal(P);\nsimplify(P);\ncombine(P);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "Q:=exp(x^2)^3*exp(y);" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 46 "expand(Q);\nnormal(Q);\nsimplify(Q);\ncombine(Q);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 24 "The many uses of convert" }}{EXCHG {PARA 0 "" 0 "" {TEXT 271 7 "convert" }{TEXT -1 105 " has lots of options. We have alr eady seen many of these. Here we look at more examples. To see all th e " }{TEXT 354 7 "convert" }{TEXT -1 29 " options execute the command \+ " }{TEXT 292 8 "?convert" }{TEXT -1 2 ". " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 32 "Note that a command of th e form " }{TEXT 272 17 "convert(x,option)" }{TEXT -1 18 " is equivalen t to " }{TEXT 273 19 "`convert/option`(x)" }{TEXT -1 32 ". For exampl e if the option is " }{TEXT 274 5 "set, " }{TEXT -1 37 " the following give the same result.\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 41 "convert([1,2],set);\n`convert/set`([1,2]);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "convert(\{1,2\},list);" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 33 "A:=convert([[2,3],[4,5]],matrix);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "B:=convert(A,Matrix);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 37 "whattype(eval(A)), whattype(eval(B));" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "convert(B,listlist);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "convert(35,binary);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "convert(35,octal);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "convert(1234567,hex);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "convert(100011,decimal,binar y);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 69 "convert(553100754871 63797179490457039169594160088430571675, base,10);" }}}{EXCHG {PARA 0 " > " 0 "" {MPLTEXT 1 0 72 "convert(553100754871637971794904570391695941 60088430571675, base, 10^5);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 68 "convert(55310075487163797179490457039169594160088430571675, base ,2);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 67 "convert(55310075487 163797179490457039169594160088430571675,binary);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "convert(\"text\", bytes);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 34 "convert([116,101,120,116], bytes);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 49 "binomial(n,k);\nconvert(bino mial(n,k), factorial);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "c onvert(Pi/6,degrees);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 67 "But when converting the other way we must use the following format." }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "convert(30*degrees,radians); " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 88 "See the following to find out about all the builtin unit conversions available in Maple." }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "?units" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 29 "convert( 1.23456, fraction );" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 38 "convert(1/11137,float)=evalf(1/1113 7);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "Digits;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "Digits:=100;" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 23 "convert(1/11137,float);" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 11 "Digits:=10:" }}}{EXCHG {PARA 0 "" 0 "" {TEXT 277 7 "convert" }{TEXT -1 76 " may also be used to add up or multiply \+ together the items in a set or list:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "convert(\{x,x,z,w\},`+`);" }{TEXT -1 60 " Note that h ere we have a set so the x is counted only once." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "convert([x,x,z,w],`+`); " }{TEXT -1 58 "Note \+ that here we have a list, the the x is counted twice." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "convert([x,x,z,w],`*`);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT 270 7 "convert" }{TEXT -1 55 " is also useful so metimes to deal with trig identities:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 34 "expr:=3*tan(x)*sin(x)^2 +cos(x)^2;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "convert(expr,sincos);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "convert(%,tan);" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 23 "convert(sin(x),string);" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 16 "convert(%,name);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 35 "taylor, ser ies, and convert/polynom" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 14 "The procedure " }{TEXT 332 15 "convert/po lynom" }{TEXT -1 74 " is particularly important when dealing with the \+ output of the procedures " }{TEXT 330 6 "series" }{TEXT -1 4 " or " } {TEXT 331 8 "taylor. " }{TEXT -1 14 "The procedure " }{TEXT 355 6 "tay lor" }{TEXT -1 54 " computes the Taylor series expansion. The procedu re " }{TEXT 333 6 "taylor" }{TEXT -1 22 " is a special case of " } {TEXT 334 6 "series" }{TEXT -1 28 ". The difference is that in " } {TEXT 335 6 "taylor" }{TEXT -1 72 " you have only non-negative exponen ts in the series expansion, but with " }{TEXT 336 6 "series" }{TEXT -1 32 " you may have terms of the form " }{XPPEDIT 18 0 "x^(-n);" "6#) %\"xG,$%\"nG!\"\"" }{TEXT -1 111 " where n is a positive integer ----t hese are sometimes called Laurent series. \n\nConsider the following e xample:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "E:=exp(x)/sin(x^2);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "tay lor(E,x=0,7);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 90 "This fails due t o the pole at x = 0. We can see the negative powers of x in the follow ing:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "series(E,x=0,7);" } }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 27 "Another example: We expand " } {XPPEDIT 18 0 "exp(x);" "6#-%$expG6#%\"xG" }{TEXT -1 67 " about x = 0 \+ up to order 3. Note that we actually get terms up to " }{XPPEDIT 18 0 "x^2;" "6#*$%\"xG\"\"#" }{TEXT -1 1 "." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "s := taylor(exp(x),x =0,3);\n" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 14 "The last term " } {XPPEDIT 18 0 "O(x^3);" "6#-%\"OG6#*$%\"xG\"\"$" }{TEXT -1 56 " indica tes that the remaining terms all are of the form " }{XPPEDIT 18 0 "a*x ^n;" "6#*&%\"aG\"\"\")%\"xG%\"nGF%" }{TEXT -1 7 " where " }{XPPEDIT 18 0 "3 <= n;" "6#1\"\"$%\"nG" }{TEXT -1 2 ".\n" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 64 "We cannot plot the expression s as the following at tempt shows:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "plot(s,x=-1 ..1);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 72 "We must first convert s \+ to a polynomial by use of the following command:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "p:=convert(s, polynom); " }{TEXT -1 21 "This \+ gets rid of the " }{XPPEDIT 262 0 "O(x^10);" "6#-%\"OG6#*$%\"xG\"#5" } {TEXT -1 1 "." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 158 "Now we can plot it. For comparison we put exp(x) in the same picture. Notice also the use of the legend option to distinguish the graphs of the two functio ns." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 107 "plot([p,exp(x)],x=- 1..1, color=[red,blue], thickness=3, legend=[convert(p,string),convert (exp(x),string)]);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 142 "Here's ano ther illustration of how the Taylor polynomials of degree n of sin(x) \+ give better and better approximation to sin(x) as n increases." }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 80 "for n in [1,3,5,11] do \n P oly[n]:=convert(taylor(sin(x),x = 0,n),polynom):\nod;\n" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 29 "Here we again use the option " }{TEXT 356 6 "legend" }{TEXT -1 101 " to indicate which curve is which, but t he colors are not that successful due to the masking effects." }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 262 "plot([seq(Poly[i],i=[1,3,5, 11]), sin(x)], x=-4*Pi..4*Pi, y=-10..10,title = \"Taylor polynomial ap proximations to sin(x)\", legend=[seq(convert(Poly[i],string),i=[1,3,5 ,11]), convert(sin(x),string)], color=[yellow,green,blue,red,black], t hickness = 3, axes=normal);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 19 "assume and assuming" }} {EXCHG {PARA 0 "" 0 "" {TEXT -1 4 "The " }{TEXT 35 6 "assume" }{TEXT -1 205 " command sets variable properties and relationships between va riables. The following examples should help to understand these featur es. But don't be surprised if they don't always work as you might expe ct." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "sqrt (a^2);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 92 "This does not simplify \+ to a. Actually it should not, since if a is negavtive it should give \+ " }{XPPEDIT 18 0 "abs(a);" "6#-%$absG6#%\"aG" }{TEXT -1 17 " . For ex ample: " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "sqrt((-5)^2);" } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "simplify(sqrt((-5)^2));" } }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 60 "However, the following command lets Maple know that we wa nt " }{TEXT 362 1 "a" }{TEXT -1 7 " to be " }{TEXT 363 4 "real" } {TEXT -1 5 " and " }{TEXT 364 8 "positive" }{TEXT -1 1 "." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart:" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 16 "assume(a, real);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 56 "Having added the assumption that a is real, we see that " } {XPPEDIT 18 0 "sqrt(a^2);" "6#-%%sqrtG6#*$%\"aG\"\"#" }{TEXT -1 8 " is now " }{XPPEDIT 18 0 "abs(a);" "6#-%$absG6#%\"aG" }{TEXT -1 17 " when simplified." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "simplify(sq rt(a^2));" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 27 "To see what is assum ed use " }{TEXT 359 8 "about(a)" }{TEXT -1 1 ":" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 9 "about(a);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 334 "In previous versions of Maple the wiggle ~ was always attached to variables after assumptions were made. In Maple 8 this is no longer t he case. But if you want to be reminded of the assumptions you may exe cute the command interface(showassumed=i) where i is 1 or 2. To not se e, i should be 0. This is the default. Here I demonstrate:" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "interface(showassumed=1):" } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "assume(a,real): a;" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "interface(showassumed=2):" } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "assume(a,real): a;" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "interface(showassumed=0):" } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "assume(a,real): a;" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 60 "To add the assumption that a is po sitive we use the command:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "additionally(a, positive);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "about(a);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "simplif y(sqrt(a^2));" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 46 "We can add more \+ assumptions on a, for example:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "additionally(a< 2);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "about(a);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 69 "Now Maple can ans wer certain questions about expressions involving a:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 52 "coulditbe(a^2 > 4), coulditbe(a^2 < 1), i s(a^2 < 1);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "assume(b < 0 );" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 49 "coulditbe(a*b >0), co ulditbe(a*b < 0), is(a*b<0);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 127 " Note that the use of assume successively will usually not work. Any a ssumptions after the first assumption must be made using " }{TEXT 360 12 "additionally" }{TEXT -1 1 ":" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "assume(x,integer);\nabout(x);" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 24 "assume(x > 0);\nabout(x);" }}}{EXCHG {PARA 0 " > " 0 "" {MPLTEXT 1 0 15 "is(x, integer);" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 15 "is(x,positive);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 51 "To get rid of assumptions about x do the following:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "x:='x':" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 9 "about(x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "sin(Pi*n);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 140 "Here's another way to make an \+ assumption about a variable. Recall this is the way parameter types ar e declared when constructing procedures:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "assume(n::integer); " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 43 "Now since n is an integer Maple knows that " }{XPPEDIT 18 0 "sin(Pi*n) = 0;" "6#/-%$sinG6#*&%#PiG\"\"\"%\"nGF)\"\"!" }{TEXT -1 54 ". This is not necessarily true if n is not an integer." }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "sin(Pi*n);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 134 "Recall that some laws of exponents hold only w hen the variables are positive. Maple knows this if you use the follow ing command. When " }{TEXT 357 17 "assume = property" }{TEXT -1 25 " i s used as an option in " }{TEXT 358 8 "simplify" }{TEXT -1 67 " all va riables in the expression are assumed to have that property." }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 " > " 0 "" {MPLTEXT 1 0 45 "(x^a)^b =simplify((x^a)^b , assume=positive) ;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 29 "We could also do it this way ." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 60 "restart:\nassume(x>0, \+ a>0, b>0):\n(x^a)^b = simplify((x^a)^b);" }{TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 13 "Or, this way:" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 74 "(x^a)^b =simplify((x^a)^b) assuming a::positive, b: :positive, x::positive;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 16 " More examples:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 42 "restart:\nass ume(x>5, y<-10);\nis(x*y < 50);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 107 "assume((i/2)::integer):\nis(i/2+1/2, integer);\nis(i/2 + 1,in teger);\nis(i::integer);\nis(i::even);\nis(i::odd);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "int(exp(-u*x),x=0..infinity);" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 12 "assume(u>0);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "int(exp(-u*x),x=0..infinity);" }{TEXT -1 0 "" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 24 "More examples using the " }{TEXT 361 8 "assuming" }{TEXT -1 8 " syntax." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 34 "simplify((-1)^n) assuming n::even;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 33 "simplify((-1)^n) assuming n::odd;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "ln(x^3*y^3); " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 34 "simplify(%) assuming x > 0, y > 0;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 22 "collect, degree, coeff" }} {EXCHG {PARA 0 "" 0 "" {TEXT -1 44 "The following examples are self-ex planatory:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 53 "p:=expand((x+y)^2+(x+z)^3*x* y + 2*x*y^2*z^3 + w*x^4);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 55 "qx:=collect(p,x);\nqy:=collect(p,y);\nqz:=collect(p,z);\n\n" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 50 "n:=degree(qx,x);\nm:=degree( qy,y);\nr:=degree(qz,z);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 189 "If w e want for some reason to do something with the coefficients we can as sign them to variables as follows. Note that to get coefficients of po wers of x, we must first have collected on x." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 3 "qx;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 56 "for i from 0 to degree(qx,x) do\nC[i]:=coeff(qx,x,i);\nod;" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 12 "The command " }{TEXT 275 7 "collec t" }{TEXT -1 83 " also works for non-polynomial terms of an expression as in the following examples." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 57 "h:=a*ln(x) -b*ln(x)*x + 3*b \+ + e*ln(x)^2 + sin(x)*ln(x)^2;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "h2:=collect(h,ln(x));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 45 "seq(coeff(h2,ln(x),i),i=0..degree(h2,ln(x)));" }}}{EXCHG {PARA 0 " > " 0 "" {MPLTEXT 1 0 66 "k:=3*z*sin(x)^2+sin(x)*ln(x) + 3*sin(x)*exp( x) + cos(x)*sin(x)^2;\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 22 " k2:=collect(k,sin(x));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 46 "s eq(coeff(k2,sin(x),i),i=0..degree(k,sin(x)));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 9 "infolevel" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 14 "In some cases " }{TEXT 289 9 "infolevel" }{TEXT -1 114 " may be used to give information about what a procedure is doing. The command for a procedure named, for example, " }{TEXT 290 8 "procname" }{TEXT -1 13 " is given by " }{TEXT 276 23 "infolevel[procname]:=i;" }{TEXT -1 65 " where i is 1,2,3,4,5. These levels have the following meanings . " }}{PARA 14 "" 0 "" {TEXT -1 61 "Level 1: reserved for information \+ that the user must be told." }}{PARA 14 "" 0 "" {TEXT -1 76 "Level 2,3 : general information, including technique or algorithm being used." } }{PARA 14 "" 0 "" {TEXT -1 74 "Level 4,5: more detailed information ab out how the problem is being solved" }}{PARA 0 "" 0 "" {TEXT -1 0 "" } }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 74 "Not all procedures give informat ion in this way. Here are a few examples:" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 8 "restart:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "infolevel[dsolve]:=5;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 75 "dsolve(\{diff(x(t),t$2) = t*diff(x(t),t) + t^3,D(x)(0) = 0, x(0) = 0\},x(t));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "infolevel[in t]:=5;" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "int(exp(b*x),x=0..infinity);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 1 " " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "assume( b > 0);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "int(b*x,x=0..inf inity);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 47 "p:=x^3+.9999998* x^2-.9999999*x-.99999970000002;" }}{PARA 13 "" 0 "" {TEXT -1 0 "" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "infolevel[fsolve]:=5;\n" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "fsolve(p,x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 41 "Assignment 11 -- Due Tuesday, November 26" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 314 10 "Definition" }{TEXT -1 32 ": A list or sequence of numbers " }{XPPEDIT 18 0 "a[1];" "6#&% \"aG6#\"\"\"" }{TEXT -1 2 ", " }{XPPEDIT 18 0 "a[2];" "6#&%\"aG6#\"\"# " }{TEXT -1 7 ", ..., " }{XPPEDIT 18 0 "a[n];" "6#&%\"aG6#%\"nG" } {TEXT -1 4 " is " }{TEXT 293 8 "unimodal" }{TEXT -1 54 " if there is a n index i such that \n " }{TEXT -1 6 " " } {XPPEDIT 18 0 "a[1];" "6#&%\"aG6#\"\"\"" }{TEXT -1 4 " <= " }{XPPEDIT 18 0 "a[2];" "6#&%\"aG6#\"\"#" }{TEXT -1 13 " <= . . . <= " }{XPPEDIT 18 0 "a[i];" "6#&%\"aG6#%\"iG" }{TEXT -1 4 " >= " }{XPPEDIT 18 0 "a[i+ 1];" "6#&%\"aG6#,&%\"iG\"\"\"F(F(" }{TEXT -1 4 " >= " }{XPPEDIT 18 0 " a[i+2];" "6#&%\"aG6#,&%\"iG\"\"\"\"\"#F(" }{TEXT -1 13 " >= . . . >= \+ " }{XPPEDIT 18 0 "a[n];" "6#&%\"aG6#%\"nG" }{TEXT -1 28 ". \nThat is, \+ the sequence is " }{TEXT 315 14 "non-decreasing" }{TEXT -1 36 " up to \+ some point after which it is " }{TEXT 316 14 "non-increasing" }{TEXT -1 80 ". Note that i can be 1 or n. A constant sequence is considered to be unimodal.\n" }}{PARA 0 "" 0 "" {TEXT -1 12 "Examples of " } {TEXT 297 14 "unimodal lists" }{TEXT -1 2 ":\n" }}{PARA 0 "" 0 "" {TEXT -1 181 " [1, 1, 1, 1, 1], \n [1,2,3,4,5,4,3,2,1 ], \n [1, 2, 2, 3, 4, 5, 5, 5], \n [5, 5, 4, 4, 3, 3 , 1], \n [1, 2, 2, 3, 3, 3, 4, 4, 2, 2, 1, 1, 1]\n" }}{PARA 0 "" 0 "" {TEXT -1 27 "Examples of lists that are " }{TEXT 298 12 "not unimodal" }{TEXT -1 85 ":\n\n [1, 0, 1, 0], \n [1, \+ 1, 2, 2, 3, 4, 5, 2, 2, 6, 4, 2, 2, 1, 0]\n\n" }{TEXT 299 10 "Problem \+ 1." }}{PARA 0 "" 0 "" {TEXT -1 23 "\n(a) Write a procedure " }{TEXT 365 8 "unimodal" }{TEXT -1 78 " to check whether or not a list of numb ers is unimodal. The input should be a " }{TEXT 366 4 "list" }{TEXT -1 26 " and the output should be " }{TEXT 300 4 "true" }{TEXT -1 4 " o r " }{TEXT 301 5 "false" }{TEXT -1 2 ". " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 56 "One way to do this is to first wri te procedures called " }{TEXT 295 10 "increasing" }{TEXT -1 5 " and \+ " }{TEXT 296 10 "decreasing" }{TEXT -1 63 " which will check whether o r not a sequence is non-decreasing (" }{XPPEDIT 18 0 "a[1];" "6#&%\"aG 6#\"\"\"" }{TEXT -1 4 " <= " }{XPPEDIT 18 0 "a[2];" "6#&%\"aG6#\"\"#" }{TEXT -1 27 " <=...) or non-increasing (" }{XPPEDIT 18 0 "a[1];" "6#& %\"aG6#\"\"\"" }{TEXT -1 3 ">= " }{XPPEDIT 18 0 "a[2];" "6#&%\"aG6#\" \"#" }{TEXT -1 228 ">=...). Then for a list L use these procedures to \+ check the two parts L[1..i] and L[i..n], n=nops(L) for each i. If you \+ find an i such that the first list is \"increasing\" and the second is \"decreasing\" then you can return true. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 89 "Check out your procedure on the above 7 examples of lists. Show the results of each test." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 294 1 " " }{TEXT -1 86 " \n(b) For n from 10 to 15 check whether or not the sequence of binomi al coefficients " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 68 "[binomial(n,0), binomial(n,1), binomial(n,2), . . ., bino mial(n,n)]\n" }}{PARA 0 "" 0 "" {TEXT -1 13 "is unimodal. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 " " {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 317 10 "Definition" }{TEXT -1 6 ". The " }{TEXT 305 23 "q-binomial coefficient " }{TEXT -1 14 "---de noted by " }{TEXT 312 9 "qbinomial" }{TEXT -1 36 "(n,k,q) --is defined by the formula\n" }}{PARA 0 "" 0 "" {TEXT -1 6 " " }{TEXT 308 9 "qbinomial" }{TEXT -1 19 "(n,k,q) = " }{XPPEDIT 18 0 "Product ((q^i - 1), i=n-k+1..n)/Product(q^i-1,i=1..k" "6#*&-%(ProductG6$,&)%\" qG%\"iG\"\"\"F+!\"\"/F*;,(%\"nGF+%\"kGF,F+F+F0F+-F%6$,&)F)F*F+F+F,/F*; F+F1F," }}}{EXCHG {PARA 0 "" 0 "" {TEXT 309 9 "qbinomial" }{TEXT -1 8 "(n,k,q) " }{TEXT 313 51 "is a polynomial of degree k*(n-k) in the var iable q" }{TEXT -1 36 ". These polynomials are also called " }{TEXT 306 20 "Gaussian polynomials" }{TEXT -1 4 " or " }{TEXT 307 22 "Gaussi an coefficients" }{TEXT -1 59 ". They occur in various places in math ematics. For example " }{TEXT 318 16 "qbinomial(n,k,q)" }{TEXT -1 116 " is the number of k-dimensional subspaces of an n-dimensional vector \+ space over a field with q elements. An example" }{TEXT 310 21 ": qbi nomial(6,3,q) " }{TEXT -1 18 "is the polynomial " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {XPPEDIT 18 0 "q^9+q^8+2*q^7+3*q^6+3*q ^5+3*q^4+3*q^3+2*q^2+q+1;" "6#,6*$%\"qG\"\"*\"\"\"*$F%\"\")F'*&\"\"#F' *$F%\"\"(F'F'*&\"\"$F'*$F%\"\"'F'F'*&F/F'*$F%\"\"&F'F'*&F/F'*$F%\"\"%F 'F'*&F/F'*$F%F/F'F'*&F+F'*$F%F+F'F'F%F'F'F'" }}}{EXCHG {PARA 0 "" 0 " " {TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 259 " " 0 "" {TEXT -1 10 "Problem 2." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT -1 30 "(a) Write a procedure to find " }{TEXT 311 9 "qbinomial" }{TEXT -1 120 "(n,k,q) and check to see that it agre es with the above for n=6 and k=3. Note that to get nice output you \+ will need to " }{TEXT 302 8 "simplify" }{TEXT -1 2 ", " }{TEXT 303 6 " expand" }{TEXT -1 5 " and " }{TEXT 304 4 "sort" }{TEXT -1 99 " the exp ression.\n\n(b) Check whether or not the sequence of coefficients of t he Gaussian polynomial " }{TEXT 367 9 "qbinomial" }{TEXT -1 198 "(n,k, q) is unimodal for 0 =< n < =10 and 0=< k < =n. Do not print out all these in your final work. Just write a program to do the checking. H ave it print out the number of pairs (n,k) for which " }{TEXT 368 9 "q binomial" }{TEXT -1 179 "(n,k,q) 's coefficients are not unimodal. Thi s is a number from 0 to 66.\n\nYou may use the following to convert th e coefficients of a polynomial f in the variable q to a sequence:\n" } }{PARA 0 "> " 0 "" {MPLTEXT 1 0 40 "L:=[seq(coeff(f,q,i),i=0..degree(f ,q))];" }{TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 320 9 "Problem 3 " }{TEXT -1 99 ". (a) Find and (b) graph the Taylor polynomial of orde r 8 about x = 0 of the each of the functions " }{XPPEDIT 256 0 "sin(x) ;" "6#-%$sinG6#%\"xG" }{TEXT -1 3 ", " }{XPPEDIT 18 0 "cos(x);" "6#-% $cosG6#%\"xG" }{TEXT -1 2 ", " }{XPPEDIT 18 0 "1/(x-1);" "6#*&\"\"\"F$ ,&%\"xGF$F$!\"\"F'" }{TEXT -1 2 ", " }{XPPEDIT 18 0 "ln(1+x);" "6#-%#l nG6#,&\"\"\"F'%\"xGF'" }{TEXT -1 6 ", and " }{XPPEDIT 18 0 "exp(x);" " 6#-%$expG6#%\"xG" }{TEXT -1 2 ". " }{TEXT 319 1 " " }{TEXT -1 165 "Use the following specifications: \n\n(i) For each plot make the x rang e -8..8 and the y range -5..5 and set discont=true.\n\n(ii) Set the s caling to constrained and " }{TEXT 369 26 "title each by the function " }{TEXT -1 76 " itself -- not the Taylor polynomial.\n\n(iii) Plot in each case the function " }{TEXT 328 3 "and" }{TEXT -1 49 " the Taylor polynomial on the same set of axes.\n\n" }{TEXT 327 6 "[Hint:" } {TEXT -1 20 " If you make a list " }{TEXT 325 32 "L:=[sin(x), cos(x), \+ ..., exp(x)]" }{TEXT -1 36 " you can make a do loop of the form " } {TEXT 326 23 "for f in L do...end do." }{TEXT -1 31 " This will save a little work.]" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 321 10 "Problem 4." }{TEXT -1 5 " Let " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {XPPEDIT 18 0 "f(x,y,z) = x^7*y-3*x^6*z+x^4* y^3+7*x^3*y^2*z-3*x^2*y*z^2+x*y^5-9*x*z^3+5*y^4*z;" "6#/-%\"fG6%%\"xG% \"yG%\"zG,2*&F'\"\"(F(\"\"\"F-*(\"\"$F-*$F'\"\"'F-F)F-!\"\"*&F'\"\"%F( F/F-**F,F-*$F'F/F-F(\"\"#F)F-F-**F/F-*$F'F7F-F(F-F)F7F2*&F'F-*$F(\"\"& F-F-*(\"\"*F-F'F-F)F/F2*(FF/ F/" }{TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 160 "is a polynomial of degree 8 in the variable t with posit ive integer coefficients. [Simplify both expressions and show that eac h gives the same polynomial in t.]" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT -1 18 "\n(b) Show that if " }{XPPEDIT 18 0 "u = \+ (t^2-1)^6/((t^3-1)^4);" "6#/%\"uG*&,&*$%\"tG\"\"#\"\"\"F*!\"\"\"\"'*$, &*$F(\"\"$F*F*F+\"\"%F+" }{TEXT -1 2 " " }{TEXT 329 3 "and" }{TEXT -1 15 " p(t) = 0 then " }{XPPEDIT 18 0 "27*u^2+18*u-125 = 0.;" "6#/,(* &\"#F\"\"\"*$%\"uG\"\"#F'F'*&\"#=F'F)F'F'\"$D\"!\"\"-%&FloatG6$\"\"!F2 " }{TEXT -1 55 " [Simplifying with a suitable side relation may help. ]" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 21 "[Thi s was taken from " }{TEXT 324 12 "Problem 1583" }{TEXT -1 8 " in the \+ " }{TEXT 323 12 "October 1999" }{TEXT -1 14 " issue of the " }{TEXT 322 20 "Mathematics Magazine" }{TEXT -1 56 ". In the problem it is sho wn that if the three numbers " }{XPPEDIT 18 0 "a^2-b^2,a^3-b^3,a^5-b^ 5;" "6%,&*$%\"aG\"\"#\"\"\"*$%\"bGF&!\"\",&*$F%\"\"$F'*$F)F-F*,&*$F%\" \"&F'*$F)F1F*" }{TEXT -1 128 " are all rational numbers then either a \+ = b or both a and b are rational numbers. The above computations are p art of the proof.]" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 " " {TEXT -1 0 "" }}}}}{MARK "10" 0 }{VIEWOPTS 0 0 0 1 1 1803 1 1 1 1 } {PAGENUMBERS 1 1 2 33 1 1 }