{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 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 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 259 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 260 "" 0 14 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 261 "" 0 12 0 0 0 0 0 0 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 0 1 0 0 0 0 0 0 0 } {CSTYLE "" -1 265 "" 1 12 0 0 0 0 0 2 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 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 1 0 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 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 271 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1 353 "" 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 354 "" 0 1 0 0 0 0 0 0 1 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 }} {SECT 0 {EXCHG {PARA 256 "" 0 "" {TEXT -1 10 "Lecture 11" }}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 29 "Copying and pasting formulas " }}{PARA 0 "" 0 "" {TEXT -1 48 "If you select formulas that were inserted using \+ " }{TEXT 346 20 "Insert/Standard Math" }{TEXT -1 206 ", you can copy t hen from the top of the menu and paste them into an output region. You may have to make a few changes after pasting, but this is much easier than typing in the formulas. Here's an example: " }{XPPEDIT 18 0 "f( x,y) = x^2+y^2+3*x*y-12;" "6#/-%\"fG6$%\"xG%\"yG,**$F'\"\"#\"\"\"*$F(F +F,*(\"\"$F,F'F,F(F,F,\"#7!\"\"" }{TEXT -1 264 ". Select this formula and then you can copy it and paste it into an input region such as th e following. (I will demonstrate in class.) Note that for it to be use ful after pasting it we still need to change from regular mathematics \+ notation to proper Maple syntax." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "f(x,y) = x^2+y^2+3*x*y-12" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 22 "For example change to " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "f:=(x,y)-> x^2+y^2+3*x*y-12;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 13 "or change to " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "f:=x^2 +y^2+3*x*y-12;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}} {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 292 10 "printlevel" }{TEXT -1 91 " causes the display of the res ults of all statements executed up to the level indicated by " }{TEXT 293 10 "printlevel" }{TEXT -1 13 ". Initially, " }{TEXT 294 10 "printl evel" }{TEXT -1 38 " is set to 1. For debugging purposes, " }{TEXT 295 10 "printlevel" }{TEXT -1 24 " := 1000; is not uncommo" }{TEXT 291 2 "n." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 7 "If the " }{TEXT 290 10 "printlevel" }{TEXT -1 182 " is set to k the n only computations inside k nested do loops will be shown unless one \+ uses a print statement. We first see that the default level is 1. Then we examine some examples." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "printlevel;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "for i fr om 1 to 2 do i^2; od;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "pr intlevel:=0;" }{TEXT -1 1 " " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 48 "Let's see the effect of setting printlevel to 0 :" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "for i from 1 to 2 do i ^2; od;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 131 "You see that nothing \+ is printed inside the do loop. But by writing print statements you can force anything you wish to be printed: " }{TEXT 264 193 "Many times w hen using do loops I like to set the printlevel to 0, then I can contr ol what's printed out by use of print statements and I don't have to w orry about excessive stuff being printed." }{TEXT -1 1 " " }}}{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 81 "Now put the printlevel back to 1 and see what happ ens inside two nested do loops:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "printlevel:=1;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 64 "f or 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 p rint(i,j,i+j);\n od;\nod;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 60 "We c an also get this result by changing the printlevel 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 56 "A few more examples: (Recall the printlevel is still 2.)" }}}{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:=i+j;\n for k from 1 to 2 do\n x:= i + j + k;\n od;\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:=i+j;\n for k from 1 to 2 do\n x:= i + j + k; \n od;\n od;\nod;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "print level:=1000;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "ifactor(2^1 1 - 1);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 51 "If we set printlevel t o -1 we get no output at all." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 32 "printlevel:=-1;\nifactor(2^11-1);" }}}{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 3 "" 0 "" {TEXT -1 27 "Manupula tion of expressions" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 257 "" 0 "" {TEXT 261 29 "Last week we saw how we could" }{TEXT 265 2 " " }{TEXT -1 61 "pick up certain parts of an expression by use of th e command " }{TEXT 262 2 "op" }{TEXT -1 37 " and change the expression by use of " }{TEXT 266 6 "subsop" }{TEXT -1 105 ". Now we look at som e other ways to deal with expressions. Some of the examples below come from the book " }{TEXT 263 22 "Maple V Learning Guide" }{TEXT -1 38 " by KM Heal, ML Hansen and KM Rickard." }}}}{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 257 8 "simplify" } {TEXT -1 38 " command: 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 "" {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 "" {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 simplif ication rules by use of " }{TEXT 259 14 "side relations" }{TEXT -1 30 ", as in the following example:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "siderel1:=\{x^2 + y^2 = 1\};" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 35 "expr3:=expand((x^2+y^2)^5+ cos(x));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "simplify(expr3,siderel1);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 88 "You may think of this as a sort of substi tution: But, note that subs will not work here:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "subs(sidere l1,expr3);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 40 "Consider the follow ing similar examples:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "si derel2:=\{x^2=cos(t)\};" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 17 " expr4:=x^4+z^4+3;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "simpli fy(expr4,siderel2);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "subs (siderel2,expr4);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT 267 8 "simplify" } {TEXT -1 6 " with " }{TEXT 268 14 "side relations" }{TEXT -1 47 " has \+ its limits as the following example shows." }}}{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 "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 61 "This means no frac tional powers in side relations. Note that " }{TEXT 258 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 260 7 "algsubs" }{TEXT -1 62 " performs \"algebraic substitution\". It is more versatile than " } {TEXT 269 4 "subs" }{TEXT -1 4 " or " }{TEXT 270 9 "simplify " }{TEXT 271 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 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 "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 25 "subs(a*b/c=d,2*a*b^2/c); " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 28 "What does work here best is " }{TEXT 311 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 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 27 " to 0. We can do this with " }{TEXT 272 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 273 4 "subs" }{TEXT -1 43 " doesn't quite do it. It's not as sm art as " }{TEXT 274 7 "algsubs" }{TEXT -1 2 ". " }{TEXT 275 4 "subs" } {TEXT -1 25 " doesn't realize that 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 68 "But in this case simply with siderelations does work to some ex tent:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "EXP2:=simplify(EXP , \{a^2 = 0\});" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 46 "But we must si mplify again to get a nice form?" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "simplify(EXP2);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 36 "expand, nor mal and simplify compared" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "" 0 "" {TEXT 303 27 "expand, normal and simplify" }{TEXT -1 34 " in some context behave the same;" }{TEXT 300 7 " normal" }{TEXT -1 5 " and " }{TEXT 301 8 "simplify" }{TEXT -1 38 " are pretty much th e same except that " }{TEXT 304 6 "normal" }{TEXT -1 45 " deals only w ith rational functions where as " }{TEXT 305 8 "simplify" }{TEXT -1 92 " also can simplify\020 expressions containing other functions (tri g functions, exp, ln, etc..) " }{TEXT 302 7 "expand " }{TEXT -1 32 "is more or less the opposite of " }{TEXT 306 6 "factor" }{TEXT -1 71 ". \+ Sometimes all 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 34 "expand(A);\nnormal(A);\nsimplify(A) ;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "B:=(x+1)^3;" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 34 "expand(B);\nnormal(B);\nsimp lify(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 34 "expand(C );\nnormal(C);\nsimplify(C);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "P:=(x^2-y^2)/(x-y)^3 ;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 34 "expand(P);\nnormal(P);\nsimplify(P);" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 21 "p:=expand((x+y+z)^5);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "factor(p);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 12 "Re call that " }{TEXT 307 6 "factor" }{TEXT -1 77 " is used to factor pol ynomials (in several variables over the rationals) and " }{TEXT 308 7 "ifactor" }{TEXT -1 28 " is used to factor integers." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "q:=(x-1)*(y+a/2)*(z*w+6)/57;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "q2:=expand(q);" }}}{EXCHG {PARA 0 " > " 0 "" {MPLTEXT 1 0 11 "factor(q2);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "factor(12345);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "ifactor(12345);" }}}{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 277 7 "convert" }{TEXT -1 141 " has lots of options. We have already seen many of these. Here we look at more \+ examples. To see all the convert options execute the command " } {TEXT 312 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 278 18 "convert( x,option)" }{TEXT -1 18 " is equivale nt to " }{TEXT 279 19 "`convert/option`(x)" }{TEXT -1 32 ". For examp le if the option is " }{TEXT 280 5 "set, " }{TEXT -1 36 " the followin g give the same result." }}}{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 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 26 "convert(3789001, base,10);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "convert(3789001, base, 100);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "convert(3789001, base,2);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "convert(3789001,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(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 followi ng format." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "convert(30*de grees,radians);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "convert( 1.23456, fraction );" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "co nvert(1/7,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 19 "convert(1/7,float);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "Digits:=10:" }}}{EXCHG {PARA 0 "" 0 "" {TEXT 289 7 "convert" }{TEXT -1 78 " may also be used \+ to add up or multiply together the numbers in a set or list:" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 47 "convert(\{1,2,3,4\},`+`);\nc onvert([1,2,3,4],`+`);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 47 "c onvert(\{1,2,3,4\},`*`);\nconvert([1,2,3,4],`*`);" }}}{EXCHG {PARA 0 " " 0 "" {TEXT 276 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 "" {TEXT -1 14 "The procedure " }{TEXT 283 15 "convert/polynom" }{TEXT -1 74 " is \+ particularly important when dealing with the output of the procedures \+ " }{TEXT 281 6 "series" }{TEXT -1 4 " or " }{TEXT 282 8 "taylor. " } {TEXT -1 10 "Note that " }{TEXT 284 6 "taylor" }{TEXT -1 22 " is a spe cial case of " }{TEXT 285 6 "series" }{TEXT -1 28 ". The difference is that in " }{TEXT 296 6 "taylor" }{TEXT -1 68 " you have only positive exponents in the series expansion, but with " }{TEXT 297 6 "series" } {TEXT -1 32 " you may have terms of the form " }{XPPEDIT 18 0 "x^(-n); " "6#)%\"xG,$%\"nG!\"\"" }{TEXT -1 74 " where n is a positive integer. Consider the following example: We expand " }{XPPEDIT 18 0 "exp(x);" "6#-%$expG6#%\"xG" }{TEXT -1 67 " about x = 0 up to order n. Note that we actually get terms up to " }{XPPEDIT 18 0 "x^9;" "6#*$%\"xG\"\"* " }{TEXT -1 1 "." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "s := ta ylor(exp(x),x=0,10);\n" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 43 "We cann ot plot this as the following 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 co mmand:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "p:=convert(s, pol ynom); " }{TEXT -1 21 "This gets rid of the " }{XPPEDIT 298 0 "O(x^10) ;" "6#-%\"OG6#*$%\"xG\"#5" }{TEXT -1 1 "." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 19 "Now we can plot it:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "plot(p,x=-1..1);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 133 "The following shows how the Taylor polynomials of degree n of sin (x) give a better and better approximation of sin(x) as n increases." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 207 "L[1]:=red:\nL[3]:=green: \nL[5]:=blue:\nL[29]:=black:\nfor n in [1,3,5,29] do \n Poly[n]:=conv ert(taylor(sin(x),x = 0,n),polynom):\n Plot[n]:=plot(Poly[n],x=-4*Pi. .4*Pi,y=-10..10, thickness = 3, color=L[n]):\nod:\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 103 "plots[display]([seq(Plot[n],n=[1,3,5,29] )], scaling = constrained, title = \"approximations to sin(x)\");" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 67 "Note that the first approximation \+ (in red) is just a straight line." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 6 "assume" }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 31 "Consider \+ the following example:" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "res tart;" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "sqrt(x^2);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "simplify(sqrt(x^2));" }}}{EXCHG {PARA 0 "" 0 "" {TEXT 286 7 "csgn( x)" }{TEXT -1 57 " is defined for complex numbers by the following ru le. [" }{TEXT 313 72 "Note that for many purposes Maple assumes variab les are complex numbers." }{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 csgn(x) = <\n \\ -1 if Re(x) < 0 \+ or Re(x) = 0 and Im(x) < 0" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 86 "For real x, csgn(x) = 1, -1 or 0 depending on whether x is positive, nega tive or zero:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "csgn(2/3), csgn(-2/3), csgn(0);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 3 "x; \n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "assume(x,real);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 4 "x; " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 104 "The wiggle, ~ , after x is Maple's way of saying som ething has been assumed about x. To see what, use " }{TEXT 299 5 "abo ut" }{TEXT -1 4 "(x):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "abo ut(x);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 35 "Now let's simplify sqrt (x^2) again:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "simplify(sq rt(x^2));" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 72 "So we get the absolu te value of x. Let's next assume that x is positive." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "assume(x,positive);\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "simplify(sqrt(x^2));" }}}{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 34 "assume(n, integer, 1 <= n, n<=10);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "about(n);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "coulditbe(sqrt(n^2) = n);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 56 "Note that the us e of assume successively will not work. " }}}{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 "" {MPLTEXT 1 0 10 "sin(x*Pi);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "assume(x, integer, x > 0);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "sin(x*Pi);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "about( x);" }}}{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 19 "simplify((x^a)^b );" }}}{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 com mand. When " }{TEXT 314 17 "assume = property" }{TEXT -1 25 " is used \+ as an option in " }{TEXT 315 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 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 16 " More examples:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 42 "restart:\nassume(x>5, y<-10);\nis(x*y < 50);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "sin(n*Pi);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "assume(n, integer);\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "sin(n*Pi);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "assume(i/2, integer);\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 42 "is(i/2+1/2, integer);\nis(i/2 + 1,integer);" }}} {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 "" {MPLTEXT 1 0 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 108 "If we want for some reason t o do something with the coefficients we can assign them to variables a s follows:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 3 "qx;" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 45 "for i from 0 to 4 do\nC[i]:= coeff(qx,x,i);\nod;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 12 "The comman d " }{TEXT 287 7 "collect" }{TEXT -1 54 " also works for non-polynomia l terms of an expression:" }}}{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 17 "collect(h,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 18 "collect(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 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 14 "In some cases " }{TEXT 309 9 "i nfolevel" }{TEXT -1 114 " may be used to give information about what a procedure is doing. The command for a procedure named, for example, \+ " }{TEXT 310 8 "procname" }{TEXT -1 13 " is given by " }{TEXT 288 23 " infolevel[procname]:=i;" }{TEXT -1 65 " where i is 1,2,3,4,5. These le vels have the following meanings. " }}{PARA 14 "" 0 "" {TEXT -1 61 "Le vel 1: reserved for information that the user must be told." }}{PARA 14 "" 0 "" {TEXT -1 76 "Level 2,3: general information, including tech nique or algorithm being used." }}{PARA 14 "" 0 "" {TEXT -1 74 "Level \+ 4,5: more detailed information about how the problem 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 exam ples:" }}}{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[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 "" {TEXT -1 51 "This polynomial is difficult for fsolve to handle. " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 47 "p:=x^3+.9999998*x^2-.9 999999*x-.99999970000002;" }}{PARA 13 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "printlevel:=1:\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "infolevel[fsolve]:=5;\n" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 56 "After you execute the following you should clic k on the " }{TEXT 316 4 "STOP" }{TEXT -1 33 " button on the menu to sa ve time." }}}{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 29 "Assignment 11 Due Next Monday" }}{EXCHG {PARA 0 "" 0 " " {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 338 10 "Definition" }{TEXT -1 21 ": A list or sequence " }{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 5 "] is " }{TEXT 317 8 "unimodal" }{TEXT -1 51 " if there is an index i such tha t \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 339 14 "non -decreasing" }{TEXT -1 36 " up to some point after which it is " } {TEXT 340 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 321 14 "unimodal lists" }{TEXT -1 2 ":\n" }}{PARA 0 "" 0 "" {TEXT -1 121 " [1, 1, 1, 1, 1], \+ [1, 2, 2, 3, 4, 5, 5, 5], [5, 5, 4, 4, 3, 3, 1], [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 322 12 "not unimodal" }{TEXT -1 82 ":\n\n \+ [1, 0, 1, 0], [1, 1, 2, 2, 3, 4, 5, 2, 2, 6, 4, 2, 2, 1, \+ 0]\n\n" }{TEXT 323 10 "Problem 1." }}{PARA 0 "" 0 "" {TEXT -1 130 "\n( a) Write a procedure to check whether or not a list of numbers is unim odal. The input should be a list and the output should be " }{TEXT 324 4 "true" }{TEXT -1 4 " or " }{TEXT 325 5 "false" }{TEXT -1 51 ".[O ne way to dothis is to write procedures called " }{TEXT 319 10 "incre asing" }{TEXT -1 5 " and " }{TEXT 320 10 "decreasing" }{TEXT -1 63 " w hich will check whether or not a sequence 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 104 ">=...). Then fo r a list L look at the two parts of the list L[1..i] and L[i..n], n=no ps(L)] for each i. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 " " {TEXT -1 91 "(b) Check out your procedure on the above examples of l ists. Show the results of each test." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 318 1 " " }{TEXT -1 86 "\n(c) For n from 10 to 15 check whether or not the sequence 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 unimodal. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT 341 10 "Definition" }{TEXT -1 6 ". The " }{TEXT 329 23 "q-binomial coefficient " }{TEXT -1 19 "which we denote by " } {TEXT 336 9 "qbinomial" }{TEXT -1 34 "(n,k,q) is defined by the formul a\n" }}{PARA 0 "" 0 "" {TEXT -1 6 " " }{TEXT 332 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 333 9 "qbinomial" }{TEXT -1 8 "(n,k,q) " }{TEXT 337 51 "is a polynomial of degree k*(n-k) in the variable q" } {TEXT -1 36 ". These polynomials are also called " }{TEXT 330 20 "Gaus sian polynomials" }{TEXT -1 4 " or " }{TEXT 331 22 "Gaussian coeffici ents" }{TEXT -1 59 ". They occur in various places in mathematics. For example " }{TEXT 342 16 "qbinomial(n,k,q)" }{TEXT -1 116 " is the num ber of k-dimensional subspaces of an n-dimensional vector space over a field with q elements. An example" }{TEXT 334 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 to find " }{TEXT 335 9 "qbinomial" }{TEXT -1 120 "(n,k,q) and check to see that it agrees with the above \+ for n=6 \nand k=3. Note that to get nice output you will need to " } {TEXT 326 8 "simplify" }{TEXT -1 2 ", " }{TEXT 327 6 "expand" }{TEXT -1 5 " and " }{TEXT 328 4 "sort" }{TEXT -1 494 " the expression.\n\n(b ) Check whether or not the sequence of coefficients of the Gaussian po lynomial qbinomial(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 \+ which qbinomial(n,k,q) 's coefficients are not unimodal. This is a num ber from 0 to 66.\n\nYou may use the following to convert the coeffici ents 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 344 9 "Problem 3" }{TEXT -1 85 ". Find and graph the 8-th Taylor polynomial about x = 0 of the eac h 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 343 1 " " }{TEXT -1 208 "\n(i) For each plot \+ make the x range -10..10 and the y range -10..10. \n(ii) Set the scal ing to constrained and title each by the function itself -- not the po lynomial.\n\n(iii) Plot in each case the function " }{TEXT 353 3 "and " }{TEXT -1 25 " the Taylor polynomial.\n\n" }{TEXT 352 6 "[Hint:" } {TEXT -1 20 " If you make a list " }{TEXT 350 32 "L:=[sin(x), cos(x), \+ ..., exp(x)]" }{TEXT -1 36 " you can make a do loop of the form " } {TEXT 351 23 "for p in L do...end do." }{TEXT -1 31 " This will save a little work.]" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 345 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*(F