{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 23 "Courier" 1 10 0 0 0 0 0 0 0 0 0 0 3 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 "" 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im es" 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 "Times" 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 "T imes" 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 "Times" 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 "T imes" 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 "Times" 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 11 " is set to " }{TEXT 279 1 "k" }{TEXT -1 31 " then only co mputations inside " }{TEXT 337 1 "k" }{TEXT -1 188 " nested levels of \+ do loops , if then statements, or nested procedures, will be shown un less 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 6 " is 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; od;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 48 "Let's see t he effect of setting printlevel to 0:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "printlevel:=0;" }{TEXT -1 1 " " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 37 "N:=2*3;\nfo r i from 1 to 2 do i^2; od;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 255 "Y ou see that nothing is printed inside the do loop, but the statement N :=6 is printed since it is at level 0, i.e., it's not inside any loops or if statements or procedures. \n\nBut by writing print statements y ou can force anything you wish to be printed: " }{TEXT 260 189 "Many t imes when using do loops I like to set the printlevel to 0, then I can control what's printed by use of print statements and I don't have to worry about excessive stuff being printed." }{TEXT -1 63 " As in the following example. Recall printlevel is still at 0." }}{PARA 0 "" 0 " " {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 78 "for i fro m 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 81 "Now put the printlevel b ack to 1 and see what happens inside two nested do loops:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "printlevel:=1;" }}}{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 "Noth ing is printed: Again we can force output by putting in print statemen ts:" }}}{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 t he printlevel to 2:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "prin tlevel:=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 126 "A few more examples: (Recall the printle vel is still 2.) Note that here we use an \"if then\" statement to ind uce a third level." }}}{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 the n\n x:= level_3;\n end if;\n od;\nod;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "printlevel:=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 77 "Setting the printlevel very high has an e ffect 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 printlevel to -1 we get no output at all." }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 36 "printlevel:=-1;\ndiff(exp(si n(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 "print level:=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 "combine" }{TEXT -1 37 " may be thought of as the inver se of " }{TEXT 341 6 "expand" }{TEXT -1 45 ". This will be made clear \+ by examples: Often " }{TEXT 343 7 "combine" }{TEXT -1 54 " can be used to simplify expressions when the command " }{TEXT 342 8 "simplify" } {TEXT -1 15 " will not help." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart:" }}}{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 34 "z1:=Int(x,x=a..b)-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 13 "In this case " }{TEXT 344 6 "expand" }{TEXT -1 57 " doesn 't work as it should. However if we first load the " }{TEXT 345 7 "stu dent" }{TEXT -1 18 " package, it will." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "with(studen t):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "expand(z2);" }}} {PARA 0 "" 0 "" {TEXT -1 28 "Here are some more examples:" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 58 "a:=Int(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 do n't need the " }{TEXT 346 7 "student" }{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:=combi ne(s);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "s3:=expand(s);" } }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 70 "The following example was also r ecently discussed on the Usenet group " }{TEXT 347 25 "comp.soft-sys.m ath.maple\312" }{TEXT -1 118 "-- a good place on the internet to go to get answers to Maple problems The question was how to simplify the ex pression" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 39 "z:= sqrt(exp(x) -1)/sqrt(exp(x/2)-1);\n\n\n" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 89 "Ro bert Israel, one of the leading experts on Maple, came up with the fo llowing solution:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 38 "assume (x>0); \ncombine(z);\nsimplify(%);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "combine(z) assuming x > 0;" }}}{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 25 "combine( exp(x)^2*exp(y));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 40 "combin e([2*sin(x)*cos(x),2*cos(x)^2-1]);" }}}{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 "assu me(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 19 " is the inverse of " }{TEXT 349 6 "expand " }{TEXT -1 14 ", for example:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 50 "b:=(x+y)^3; \nc:=expand(b); \nfactor(c);\ncombine(c);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 " " {TEXT -1 23 "simplify, subs, algsubs" }}{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 apply simplification rules to an ex pression. 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 20 "simplify(4^( 1/2)+3);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 60 "expr1:=cos(x)^5 +2*cos(x)^2 + sin(x)^4 -2*sin(x)^2-cos(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 di fferent effect:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "combine( 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 "si mplify(expr2);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 123 "By adding an e xtra argument as in the following we can restrict the simplification t o 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 simplification rules by use of " }{TEXT 258 14 "side relations" }{TEXT -1 136 ", as in the following example: Note that a \"side relation\" is just a set or list of equat ions that are to be used in the simplification." }}}{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 "simplify(expr3,\{x^2 + y^2 = 1\});" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 88 "You may think of this a s a sort of substitution: But, note that subs will not work here:" }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "subs(\{x^2 + y^2 = 1\},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 following 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 following example sho ws." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 40 "siderel3:=\{sin(x) = (1-cos(x)^2)^(1/2)\};" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 37 "e xpr5:=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 are allowed in side relat ions. Note that " }{TEXT 257 4 "subs" }{TEXT -1 25 " has no such restr iction." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "subs(siderel3,ex pr5);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 81 "On the other hand we can often get rid of fractional powers, 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 examples: First in the expression " } {XPPEDIT 18 0 "2*a*b^2/c;" "6#**\"\"#\"\"\"%\"aGF%%\"bGF$%\"cG!\"\"" } {TEXT -1 30 " we want to substitute 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 "si mplify(2*a*b^2/c,\{(a*b)/c = d\}); " }{TEXT -1 21 "Note that this fail s." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 79 "On the other hand we can ge t the desired result by changing the side condition:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 32 "simplify(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);\nsu bs(a*b=d*c,2*a*b^2/c); " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 28 "What d oes 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 th at we write a*b/c = d instead of 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. We can do this with " }{TEXT 266 7 "algs ubs" }{TEXT -1 1 ":" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "algs ubs(a^2=0, EXP);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 4 "But " }{TEXT 267 4 "subs" }{TEXT -1 43 " doesn'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 that if " }{XPPEDIT 18 0 "a^2 = 0;" "6#/*$%\"a G\"\"#\"\"!" }{TEXT -1 6 " then " }{XPPEDIT 18 0 "a^3 = 0;" "6#/*$%\"a G\"\"$\"\"!" }{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 extent:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "EXP2:=simplify(EXP, \{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 for m:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 30 "combine(EXP2);\nsimplify(EXP2);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 46 "exp and, normal, combine, and simplify compared" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "" 0 "" {TEXT 285 27 "expand, normal and simp lify" }{TEXT -1 34 " in some context behave the same;" }{TEXT 282 7 " normal" }{TEXT -1 5 " and " }{TEXT 283 8 "simplify" }{TEXT -1 38 " ar e pretty much the same except that " }{TEXT 286 6 "normal" }{TEXT -1 45 " deals only with rational functions where as " }{TEXT 287 8 "simpl ify" }{TEXT -1 92 " also can simplify\020 expressions containing other functions (trig functions, exp, ln, etc..) " }{TEXT 284 7 "expand " } {TEXT -1 32 "is more or less the opposite of " }{TEXT 288 6 "factor" } {TEXT -1 4 " or " }{TEXT 353 7 "combine" }{TEXT -1 72 ". Sometimes al l three behave the same. Consider the following examples:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart:" }}}{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 "ex pand(C);\nnormal(C);\nsimplify(C);\ncombine(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 us es of convert" }}{EXCHG {PARA 0 "" 0 "" {TEXT 271 7 "convert" }{TEXT -1 105 " has lots of options. We have already seen many of these. Here we look at more examples. To see all the " }{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 the form " }{TEXT 272 17 "con vert(x,option)" }{TEXT -1 18 " is equivalent to " }{TEXT 273 19 "`conv ert/option`(x)" }{TEXT -1 32 ". For example 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 "co nvert(\{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(A,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,binary);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 69 "convert(5531007548716379717949045703916959416 0088430571675, base,10);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 72 "convert(55310075487163797179490457039169594160088430571675, base, 10^ 5);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 68 "convert(553100754871 63797179490457039169594160088430571675, base,2);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 67 "convert(5531007548716379717949045703916959416 0088430571675,binary);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "c onvert(\"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(binomial(n,k), factorial);" } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "convert(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 un it conversions available in Maple." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "?units" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "c onvert( 1.23456, fraction );" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "convert(1/11137,float);" }}}{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 b e used to add up or multiply together the items in a set or list:" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 47 "convert(\{x,y,z,w\},`+`);\nc onvert([x,y,z,w],`+`);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 47 "c onvert(\{x,y,z,w\},`*`);\nconvert([x,y,z,w],`*`);" }}}{EXCHG {PARA 0 " " 0 "" {TEXT 270 7 "convert" }{TEXT -1 55 " is also useful sometimes t o 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 34 "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,5);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 57 "This fails due t o the pole at x = 0. But series succeeds:" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 16 "series(E,x=0,5);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 27 "Another example: We expand " }{XPPEDIT 18 0 "exp(x);" "6#-%$exp G6#%\"xG" }{TEXT -1 67 " about x = 0 up to order 3. Note that we actua lly 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 " indicates 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 e xpression s as the following attempt 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 fol lowing command:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "p:=conve rt(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 di stinguish the graphs of the two functions." }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 107 "plot([p,exp(x)],x=-1..1, color=[red,blue], thickne ss=3, legend=[convert(p,string),convert(exp(x),string)]);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 142 "Here's another illustration of how the T aylor polynomials of degree n of sin(x) give better and better approxi mation to sin(x) as n increases." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 80 "for n in [1,3,5,11] do \n Poly[n]:=convert(taylor(si n(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 the colors are not that successf ul due to the masking effects." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 255 "plot([seq(Poly[i],i=[1,3,5,11]), sin(x)], x=-5..5, y=-10..10, title = \"Taylor polynomial approximations to sin(x)\", legend=[seq(co nvert(Poly[i],string),i=[1,3,5,11]), convert(sin(x),string)], color=[y ellow,green,blue,black,red], thickness = 3, axes=boxed);" }}}{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 propertie s and relationships between variables. The following examples should h elp to understand these features. But don't be surprised if they don't always work as you might expect." }}}{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, s ince if a is negavtive it should give " }{XPPEDIT 18 0 "abs(a);" "6#-% $absG6#%\"aG" }{TEXT -1 15 ". For example: " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "sqrt((-5)^2);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "simplify(sqrt(a^2));" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 13 "The procedure" }{TEXT 360 8 " csgn(x)" }{TEXT -1 57 " is defined for complex numbers by the following rule. [" }{TEXT 359 72 " Note that for many purposes Maple assumes variables are complex number s." }{TEXT -1 1 "]" }}{PARA 0 "" 0 "" {TEXT -1 1 "\n" }{TEXT 23 141 " \+ / 1 if Re(x) > 0 or Re(x) = 0 and Im(x) > 0\n csg n(x) = <\n \\ -1 if Re(x) < 0 or Re(x) = 0 and Im(x) \+ < 0" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 87 "\nFor real x, csgn(x) = 1, -1 or 0 depending on whether x is positive, negative or zero:" }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "csgn(5), csgn(-5), csgn(0);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 60 "However, the following command lets Maple know that we want " } {TEXT 364 1 "a" }{TEXT -1 7 " to be " }{TEXT 365 4 "real" }{TEXT -1 5 " and " }{TEXT 366 8 "positive" }{TEXT -1 1 "." }}}{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 " w hen simplified." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "simplify (sqrt(a^2));" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 113 "The wiggle, ~ , after a is Maple's way of saying something has been assumed about x. \+ To see what is assumed use " }{TEXT 361 8 "about(a)" }{TEXT -1 1 ":" } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "about(a);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 60 "To add the assumption that a is positive we use the command:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "additional ly(a, positive);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "about(a) ;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "simplify(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 "addition ally(a< 2);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "about(a);" }} }{EXCHG {PARA 0 "" 0 "" {TEXT -1 69 "Now Maple can answer certain ques tions about expressions involving a:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 39 "coulditbe(a^2 > 4), coulditbe(a^2 < 1);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "assume(b < 0);" }}}{EXCHG {PARA 0 " > " 0 "" {MPLTEXT 1 0 38 "coulditbe(a*b >0), coulditbe(a*b < 0);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 127 "Note that the use of assume succe ssively will usually not work. Any assumptions after the first assump tion must be made using " }{TEXT 362 12 "additionally" }{TEXT -1 1 ": " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "assume(x,integer);\nabo ut(x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "assume(x > 0);\na bout(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 thi s is the way parameter types are declared when constructing procedures :" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "assume(n::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 when the variables are positive. Maple knows this if you use the \+ following command. When " }{TEXT 357 17 "assume = property" }{TEXT -1 25 " is used as an option in " }{TEXT 358 8 "simplify" }{TEXT -1 67 " \+ all variables 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 wa y." }}}{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 66 "assume((i/2)::integer):\nis(i/2+1/2, integer);\nis(i/2 + 1,int eger);" }}}{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 363 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 "" {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-explanatory:" }}}{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 we want for some reason t o do something with the coefficients we can assign them to variables a s follows. Note that to get coefficients of powers 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 "collect" }{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 "seq(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 informatio n 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 t old." }}{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 about how the proble m is being solved" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 " " 0 "" {TEXT -1 74 "Not all procedures give information 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[dsolv e]:=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[int]:=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..infinity);" }}} {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 40 "Assignmen t 11 -- Due Wednesday, April 17" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 " " }}{PARA 0 "" 0 "" {TEXT 314 10 "Definition" }{TEXT -1 32 ": A list o r 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 51 " if there is an index i such that \n " }{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-decreas ing" }{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 cons tant 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 151 " [1, 1, 1, 1, 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 unimod al" }{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 367 8 "u nimodal" }{TEXT -1 78 " to check whether or not a list of numbers is u nimodal. The input should be a " }{TEXT 368 4 "list" }{TEXT -1 26 " an d the output should be " }{TEXT 300 4 "true" }{TEXT -1 4 " or " } {TEXT 301 5 "false" }{TEXT -1 2 ". " }}{PARA 0 "" 0 "" {TEXT -1 0 "" } }{PARA 0 "" 0 "" {TEXT -1 51 "[One way to do this is to write procedur es called " }{TEXT 295 10 "increasing" }{TEXT -1 5 " and " }{TEXT 296 10 "decreasing" }{TEXT -1 63 " which will check whether or not a s equence is non-decreasing (" }{XPPEDIT 18 0 "a[1];" "6#&%\"aG6#\"\"\" " }{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 115 ">=...). 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. ]" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 87 "Check out your \+ procedure on the above examples of lists. Show the results of each tes t." }}{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 sequ ence of binomial coefficients " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT -1 68 "[binomial(n,0), binomial(n,1), binomial(n ,2), . . ., binomial(n,n)]\n" }}{PARA 0 "" 0 "" {TEXT -1 13 "is unimod al. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 317 10 "Defini tion" }{TEXT -1 6 ". The " }{TEXT 305 23 "q-binomial coefficient " } {TEXT -1 14 "---denoted 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 "q binomial" }{TEXT -1 8 "(n,k,q) " }{TEXT 313 51 "is a polynomial of deg ree k*(n-k) in the variable q" }{TEXT -1 36 ". These polynomials are a lso called " }{TEXT 306 20 "Gaussian polynomials" }{TEXT -1 4 " or " } {TEXT 307 22 "Gaussian coefficients" }{TEXT -1 59 ". They occur in va rious places in mathematics. 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 ": qbinomial(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 t o find " }{TEXT 311 9 "qbinomial" }{TEXT -1 120 "(n,k,q) and check to \+ see that it agrees 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 expression.\n\n(b) Check whether or not the sequence of coefficients of the Gaussian polynomial " }{TEXT 369 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. Have it print out the number of pairs (n,k) for w hich " }{TEXT 370 9 "qbinomial" }{TEXT -1 179 "(n,k,q) 's coefficients are not unimodal. This is a number from 0 to 66.\n\nYou may use the f ollowing to convert the coefficients of a polynomial f in the variable q to a sequence:\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 40 "L:=[seq(coef f(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 93 ". (a) Find and (b) graph the 8-t h Taylor polynomial 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#-%#lnG6#,&\"\"\"F'%\"xGF'" }{TEXT -1 6 ", \+ and " }{XPPEDIT 18 0 "exp(x);" "6#-%$expG6#%\"xG" }{TEXT -1 2 ". " } {TEXT 319 1 " " }{TEXT -1 166 "Use the following specifications: \n\n( i) For each plot make the x range --8..8 and the y range -5..5 and s et discont=true.\n\n(ii) Set the scaling to constrained and " }{TEXT 371 26 "title each by the function" }{TEXT -1 76 " itself -- not the T aylor 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 ax es.\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 25 "for fun 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 deg ree 8 in the variable t with positive integer coefficients. [Simplify \+ both expressions and show that each gives the same polynomial in t.]" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 18 "\n(b) S how 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 "[This was taken from " }{TEXT 324 12 "Pro blem 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 shown that if the three numbers " } {XPPEDIT 18 0 "a^2-b^2,a^3-b^3,a^5-b^5;" "6%,&*$%\"aG\"\"#\"\"\"*$%\"b GF&!\"\",&*$F%\"\"$F'*$F)F-F*,&*$F%\"\"&F'*$F)F1F*" }{TEXT -1 128 " ar e all rational numbers then either a = b or both a and b are rational \+ numbers. The above computations are part 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 "6" 0 }{VIEWOPTS 0 0 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 1 1 2 33 1 1 }