{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 "" 0 21 "" 0 1 0 0 0 1 0 0 0 0 2 0 0 0 0 1 }{CSTYLE "" -1 256 "" 0 1 0 0 0 0 1 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 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 260 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 261 "" 0 1 0 0 0 0 1 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 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 265 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 266 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 267 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 268 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 269 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 270 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 271 "" 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0 0 0 0 0 0 } {CSTYLE "" -1 374 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 375 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 376 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 377 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 378 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 } {CSTYLE "" -1 379 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 380 "" 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 "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 "Bullet Item" -1 15 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }1 1 0 0 3 3 1 0 1 0 2 2 15 2 }{PSTYLE "Normal" -1 256 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 "Title" -1 257 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 }} {SECT 0 {EXCHG {PARA 257 "" 0 "" {TEXT -1 9 "Lecture 7" }}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 21 "Can Maple be trusted?" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 21 "From Robert Israel's " } {TEXT 305 24 "Maple Advisor Datatbase:" }}{PARA 0 "" 0 "" {TEXT -1 543 "\nAny very large software project has bugs, and Maple has plenty \+ of them. You should not have blind faith in Maple, or any other compu ter algebra system, or a human for that matter. Use the same general \+ guidelines that you might apply to something one of your colleagues mi ght have come up with (after a long and complicated calculation): firs t ask yourself if the answer appears to be reasonable, and then check \+ it if possible. Try some special cases, a different method of calcula ting the answer, or verify some consequences of the answer." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 167 "In a situation where an error might have serious consequences, be especially diligen t in checking the answer. You might even try it on another computer al gebra system." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 201 "It's not unlikely that after using Maple for a while you will discover some bugs. If you find what appears to be a bug, first \+ make sure that it really is a bug rather than your own mistake. Check the " }{TEXT 304 22 "Maple Advisor Database" }{TEXT -1 305 " and the \+ help pages on the functions you are using, to be sure that you are usi ng them correctly. Perhaps try some simpler examples, to determine th e nature of the problem and under what conditions it appears. If poss ible, consult a more experienced Maple user (your instructor, if you a re a student). " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 87 "If you still think it is a bug, you can report it by e-ma il to the Maple developers at " }{MPLTEXT 0 21 21 "support@maplesoft.c om" }{TEXT -1 47 ", to the Maple User Group, or to the newsgroup " } {MPLTEXT 0 21 24 "comp.soft-sys.math.maple" }{TEXT -1 1 "." }}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 34 "solve and fsolve: simple examples " }} {EXCHG {PARA 0 "" 0 "" {TEXT -1 14 "The procedure " }{TEXT 310 5 "solv e" }{TEXT -1 102 " attempts to find an exact solution to an equation. \+ It often fails to do this for theoretical reasons:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "poly:=x^4+x^2+1;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 159 "Note carefully the difference in the following two commands and t he difference in the output. This is sometimes an important distinctio n as we shall see later." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "sol1:=solve(poly,x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "so l2:=solve(poly,\{x\});" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "Y :=evalf(sol1); \n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "Z:=eva lf(sol2);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "pol:=x^5-x^4+x ^3+2*x-1;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "S:=solve(pol=0 ,x);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 230 "This indicates that Mapl e is unable to find a solution--it has been proved that in general the re are no formulas for polynomials of degree greater than 4. We can, \+ however, obtain the numerical values of these 5 roots as follows:" }} }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "evalf(S);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 108 " We can, also, direct Maple to find floating p oint approximations to the solutions to an equations by using " } {TEXT 334 8 "fsolve. " }{TEXT -1 11 "For example" }{TEXT 336 1 ":" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "fsolve(pol,x);" }}}{EXCHG {PARA 15 "" 0 "" {TEXT -1 24 "For a general equation, " }{TEXT 306 46 "fsolve attempts to compute a single real root." }{TEXT -1 124 " Howev er, for polynomials it will compute all real (non-complex) roots, alt hough exceptionally ill-conditioned polynomials " }{TEXT 307 36 "may c ause fsolve to miss some roots" }{TEXT -1 2 ". " }}{PARA 15 "" 0 "" {TEXT -1 11 "To compute " }{TEXT 308 25 "all roots of a polynomial" } {TEXT -1 51 " over the field of complex numbers, use the option " } {TEXT 309 7 "complex" }{TEXT -1 13 " as follows: " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "S2:=fsolve( pol=0,x,complex);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 52 "Note that th is gives the same result as found above:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "evalb(\{evalf(S)\} = \{S2\});" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 70 "If you want \+ to do something with the roots use the following approach:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "Sol:=fsolve(pol=0,x,complex);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 104 "Now Sol[i] is the ith-solution. N ote that the solutions are returned as a sequence -- not a list or set ." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "nops([Sol]);\n" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 49 "for i from 1 to nops([Sol]) \+ do\nprint(Sol[i]);\nod;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 131 "Some \+ solutions may be lost when the equation contains \"transcendental\" f unctions (sin,cos, exp, ln, etc..). Consider the example " }{TEXT 313 14 "sin(x) - x^2=0" }{TEXT -1 61 ". From the graph we see clearly \+ that there are two solutions:" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 1 " \+ " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 38 "plot(sin(x)-x^2,x=-.5.. 1,color=BLACK);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 38 "But see what h appens when we try both " }{TEXT 314 5 "solve" }{TEXT -1 5 " and " } {TEXT 315 5 "fsolv" }{TEXT -1 32 "e. Neither gives both solution. " }} }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "solve(sin(x) = x^2,x);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "evalf(%);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "fsolve(sin(x) = x^2,x);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 78 "Even specifying that we want a root in the interv al -2..2 gives only one root:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "fsolve(sin(x) = x^2,x,-2..2);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 75 "But if we say we want a root in the interval .5..1, we find the other root." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "fsolve(sin( x) = x^2,x,.5..1);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 71 "So the best advice is when seeking roots of transcendental equations: " }{TEXT 335 77 "look at the grap h and try to determine an interval containing a desired root." }{TEXT -1 10 " Then use " }{TEXT 311 6 "fsolve" }{TEXT -1 51 " specifying the interval as in the above examples. " }{TEXT 337 18 "Keep in mind that " }{TEXT 312 6 "fsolve" }{TEXT 338 48 " is happy to find just one roo t in any interval." }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 14 "Basic plo tting" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 " " {TEXT 320 15 "Acknowledgement" }{TEXT -1 47 ": Some of the material \+ below is from the book " }{TEXT 261 21 "Introduction to Maple" } {TEXT -1 16 " by Andre Heck " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 " " }}{PARA 0 "" 0 "" {TEXT -1 20 "One may plot either " }{TEXT 321 11 " expressions" }{TEXT -1 4 " or " }{TEXT 322 10 "procedures" }{TEXT -1 4 " or " }{TEXT 323 9 "functions" }{TEXT -1 27 " (--in maple terminolo gy). " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT 360 9 "NOTE WELL" }{TEXT -1 23 " the calculus function " } {XPPEDIT 18 0 "e^x;" "6#)%\"eG%\"xG" }{TEXT -1 54 " is NOT denoted by \+ e^x in Maple. One MUST use instead " }{TEXT 359 6 "exp(x)" }{TEXT -1 1 "." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "h:=exp(-x^2)*cos(Pi*x^3);\n" }}}{EXCHG {PARA 0 " " 0 "" {TEXT -1 18 "Note that h is an " }{TEXT 339 10 "expression" } {TEXT -1 20 " -- NOT a function. " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "plot(h,x=-2..2);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 43 "Or we may turn expression into a procedure." }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 16 "f:=unapply(h,x);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 64 "Here's a simple way to get a graph of f on the interval ( -2..2):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "plot(f,-2..2);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 61 "The same result is obtained as \+ follows by plotting the Maple " }{TEXT 324 8 "function" }{TEXT -1 6 " \+ f(t):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "plot(f(t),t=-2..2) ;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 54 "But here is a common problem : If the procedure has an " }{TEXT 340 10 "if ...then" }{TEXT -1 65 " \+ statement in it Maple will often be confused: Here's an example:" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 44 "g:=proc(u) if u > 0 then u e lse -u; fi; end:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "plot(g( u),u=-2..2);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 35 "Here are three wa ys to remedy this:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "plot( g,-2..2);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "plot('g(u)',u= -2..2);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 40 "The third way is by us ing the procedure " }{TEXT 325 9 "piecewise" }{TEXT -1 25 " to define \+ the procedure:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "g:=piecew ise(u<0,-u,u>=0,u);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "plot (g(u),u=-2..2);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 96 "Two or more fu nctions may be plotted on the same set of axes as in the next example: This plots " }{XPPEDIT 18 0 "x^3;" "6#*$%\"xG\"\"$" }{TEXT -1 165 " a nd its first and second derivative. Note that here we use expressions \+ and not functions. Since the default colors are not easy to see, I hav e added a color option:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 72 " plot(\{x^3, diff(x^3,x), diff(x^3,x$2)\},x=-2..2, color=[red,blue,blac k]);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 59 "We can also do this with \+ the operator notation, as follows:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "f:=x->x^3:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "plot(\{f,D(f),(D@@2)(f)\},-2..2);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 74 "Recall that f@g is the composition of f with g and g@@n i s the composition" }}{PARA 0 "" 0 "" {TEXT -1 25 "of g with itself n t imes." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "eval(f);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "D(f);" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 9 "(D@D)(f);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "(D@@2)(f);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 38 "Finding Maxima and Minim a via Calculus" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 127 "Here we show how to use some theory from calculus to \+ find the maximum and minimum values of a function. Consider the functi on: " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 69 "p := (6*x^4+312*x^2 +10706-20*x^3-20*x)/(x^6-197*x^4+10003*x^2+10201);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "plot(p,x=-20..20);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 129 "Note the different scales on the x and y axes in the \+ graph above. Let's plot the derivative to see where the critical point s are:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "dp:=diff(p,x);" } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "plot(dp,x=-20..20);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 230 "Let's find the exact location of \+ the critical points corresponding to the three peaks which we see in t he graph of p. We can see that the peaks occur approximately when x = \+ -10, 0 and 10. But are these the exact values? Let's use " }{TEXT 361 6 "fsolve" }{TEXT -1 1 ":" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "x1:=fsolve(dp=0,x,-11..-9);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "x2:=fsolve(dp=0,x,-(.1)..(.1));" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "x3:=fsolve(dp=0,x,9..11);" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 17 "ff:=unapply(p,x):" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 47 "The three peaks have the following coordinates:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 40 "[x1,ff(x1)]; \n[x2,ff(x2)]; \n[x3,f f(x3)];" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 95 "Note that it looks as \+ if dp has a root at x = 0, however as we see below this is not the cas e. " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "fdp:=unapply(dp,x): \nfdp(0);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 66 "We can also see this by plotting the derivative nearer the origin." }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 25 "plot(dp,x=-1/100..1/100);" }}}{EXCHG {PARA 0 " > " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 32 "di splaying several plots at once" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart:" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 68 "There are two wa ys of doing this. First, one can do as we did above:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 65 "g:=x^3:\ndg:=diff(g,x):\nddg:=diff(dg,x): \nplot(\{g,dg,ddg\},x=-2..2);" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {EXCHG {PARA 0 "" 0 "" {TEXT -1 43 "We can do the same thing using the command " }{TEXT 316 7 "display" }{TEXT -1 13 " after doing " }{TEXT 317 11 "with(plots)" }{TEXT -1 29 " which brings in the package " } {TEXT 318 5 "plots" }{TEXT -1 114 ". We create plots for each of c, D( c) and (D@D)(c). Then \"display\" them on a single set of axes using t he command " }{TEXT 262 7 "display" }{TEXT -1 74 ". This method is muc h more flexible that the previous one as we shall see." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "with(plots):" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 42 "Plot1:=plot(x^3, x = -2..2, color = red): " } {TEXT -1 26 "Use : here instead of ; !!" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 41 "Plot2:=plot(3*x^2,x=-2..2, color = blue):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 41 "Plot3:=plot(6*x, x=-2..2, color = g reen):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "display(\{Plot1,P lot2,Plot3\});" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}} {SECT 1 {PARA 3 "" 0 "" {TEXT -1 17 "parametric curves" }}{EXCHG {PARA 256 "" 0 "" {TEXT -1 38 "Ploting curves defined parametrically: " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 80 "A curve in rectangular coordi nates may often be defined by parametric equations:" }}{PARA 0 "" 0 " " {TEXT -1 24 "\n " }{TEXT 276 44 "x=f(t), \n \+ y=g(t), \n\n" }{TEXT 342 24 "where t goes from a to b" }{TEXT 343 3 ". \n" }}{PARA 0 "" 0 "" {TEXT -1 104 "Perhaps the best example is the circle of radius r = a centered at the origin, wh ich is parametrized by " }}{PARA 0 "" 0 "" {TEXT -1 24 "\n \+ " }{XPPEDIT 275 0 "x = a*cos(t),y = a*sin(t),t = 0 .. 2*Pi: " "6%/%\"xG*&%\"aG\"\"\"-%$cosG6#%\"tGF'/%\"yG*&F&F'-%$sinG6#F+F'/F+; \"\"!*&\"\"#F'%#PiGF'" }{TEXT -1 3 ": \n" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 62 "For example, we can plot a circle of radius r = 2 as follows:\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 36 "plot([2*cos(t),2*sin(t),t=0..1*Pi]);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 122 "Next we modifiy the circle slightly by giving it a varia ble radius making it into a spiral: Note that we use the \"option\" " }{TEXT 341 12 "axes = boxed" }{TEXT -1 33 ". We discuss other options \+ below:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 50 "plot([t*cos(t), t*sin(t), t=0..4*Pi], axes=boxed);" } }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 120 "Next we obtain a bunch of conce ntric circles of radii 1, 2, 3, 4, and 5.\nNote that we first form the plots, then we use " }{TEXT 344 7 "display" }{TEXT -1 29 " to display them all a once.\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 68 "for \+ r from 1 to 5 do \nP[r]:=plot([r*cos(t),r*sin(t),t=0..2*Pi]):\nod:" }} }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 35 "plots[display](\{seq(P[r],r =1..5)\});" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 17 "Some plot options" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 " restart:\nwith(plots):" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 137 "We now go through some options that allo w us to exert more control over the graphs. To see the full list of su ch options use the command " }{TEXT 277 13 "?plot/options" }{TEXT -1 40 ". As you can see there are many options." }}}{EXCHG {PARA 0 "" 0 " " {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "?plot/opt ions" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 265 14 "Vertical Range" }{TEXT -1 52 " may be controlled as in the fol lowing two examples:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "f:= x->2*x^5-10*x+2:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "plot(f, -2..2,-20..20);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 73 "If you are not careful, you may cut off part of the graphs as we do here:" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "plot(f,-2..2,-5..5);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 10 "If we use " }{TEXT 349 1 "S" } {TEXT -1 42 " as a variable and write the limits using " }{TEXT 347 1 "S" }{TEXT -1 5 " and " }{TEXT 348 1 "T" }{TEXT -1 51 " as in the foll owing example, the axes are labeled " }{TEXT 350 1 "S" }{TEXT -1 5 " a nd " }{TEXT 351 1 "T" }{TEXT -1 27 ". Here I also control what " } {TEXT 346 9 "tickmarks" }{TEXT -1 44 " are placed on the axes by suita ble options." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 78 "plot(f(S),S =-2..2,T=-20..20, xtickmarks=[-2,-1,0,1,2], ytickmarks=[-10,0,10]);" } }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 37 "We may also do this with expressions:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "p:=2*s^5-10*s+2:" }}}{EXCHG {PARA 0 "" 0 " " {TEXT -1 36 "Note that this also labels the axes:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 75 "plot(p,s=-2..2,t=-20..20,xtickmarks=[-2,- 1,0,1,2], ytickmarks=[-10,0,10] );" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 99 "Sometimes it is necessary to limit the range on the y-axis. For example, if we naively try to plot " }{TEXT 278 6 "tan(x)" }{TEXT -1 23 " we get nothing of use:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "plot(tan(x), x=-2*Pi..2*Pi);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 45 "What we need is something like the following:" }}}{EXCHG {PARA 0 " > " 0 "" {MPLTEXT 1 0 39 "plot(tan(x), x=-2*Pi..2*Pi, y=-10..10);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 53 "To get rid of the vertical lines a t the places where " }{TEXT 345 6 "tan(x)" }{TEXT -1 44 " has a discon tinuity one may use the option " }{TEXT 264 12 "discont=true" }{TEXT -1 1 "." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 53 "plot(tan(x), x=- 2*Pi..2*Pi, y=-10..10, discont=true);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 101 "Note that in the above graph the scales on the two axes \+ are different. To remedy this we may use the " }{TEXT 352 7 "scaling" }{TEXT -1 29 " option: By using the option " }{TEXT 279 21 "scaling = \+ constrained" }{TEXT -1 64 " you can insure that Maple with use the sam e scale on both axes." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "plot(sin,0..2*Pi);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 38 "plot(sin,0..2*Pi,scaling=con strained);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 58 "One can restrict th e range as we did above or one may use " }{TEXT 266 4 "view" }{TEXT -1 14 ". The option " }{TEXT 267 4 "view" }{TEXT -1 179 " has the adv antage of being quicker since when it is used the graph is not recompu ted. The same data is used to redraw the graph: Here are some examples : We also change the color." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" } }{PARA 0 "" 0 "" {TEXT -1 28 "The first plot is worthless:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 56 "plot(1/(x^2-1),x=-2..2,color=black, ytickmarks=[-1,0,1]);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 84 "As above we can improve it by limiting the vertical range: But it is still not very " }}{PARA 0 "" 0 "" {TEXT -1 60 "nice since it gives vertical li nes where the asymptotes are." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 44 "plot(1/(x^2-1),x=-2..2,-10..10,color=black);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 57 "As before we can make it look better by using the option " }{TEXT 326 12 "discont=true" }{TEXT -1 12 " as follows:" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 57 "plot(1/(x^2-1),x=-2..2,-10.. 10,color=black,discont=true);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 43 " Now let's show how to use view: Note that " }{TEXT 280 4 "Plot" } {TEXT -1 70 " is just a variable name we are using and should not be c onfused with " }{TEXT 281 4 "plot" }{TEXT -1 1 "." }}}{EXCHG {PARA 0 " " 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 75 "Plot :=plot(\{sin(1/x),x^2\},x=0..1,color=black, xtickmarks=5):\ndisplay(Pl ot);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 165 "Now we can use view with display to get a better look in a particular range: In this view we c an approximate the corrdinate of one point where the two graphs cross. " }{TEXT 282 253 "If you click on the intersection of the two curves you will see the coordinates displayed in the upper left of the works heet. But note that this only gives an approximation. Better methods a re needed to get more precise coordinates of the intersection." }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 41 "display(Plot,view=[(.2)..(.4 ), 0..(.2)]);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT 263 6 "Style:" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 11 "The option " }{TEXT 283 5 "style" }{TEXT -1 14 " has the form " }{TEXT 319 8 "style= s" }{TEXT -1 12 " w here s is " }{TEXT 327 4 "line" }{TEXT -1 4 " or " }{TEXT 328 5 "point " }{TEXT -1 25 "., These apply only to a " }{TEXT 329 25 "list of two \+ element lists" }{TEXT -1 36 " (points). Let's give some examples:" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 51 "plot([[0,0],[1,-1],[2,2], [1 ,3],[0,0]],style=line);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 115 "We ca n make the lines thicker by using thickness = i where i should be 0, \+ 1, 2, or 3. 0 is the default thickness." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 78 "plot([[0,0],[1,-1],[2,2], [1,3],[0,0]],style=line, co lor=green,thickness = 3);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 62 "Here 's a way to plot a discrete function such as the function " }{TEXT 353 8 "ithprime" }{TEXT -1 1 ":" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 49 "plot( [seq([i,ithprime(i)],i=1..5)],style= line);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 64 "plot([[seq([i,ithprime(i)],i=1..5)] ],style=point, symbol=cross);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 78 "plot([[seq([i,ithprime(i)],i=1..5)]],style=point, symbol=circle, color=black);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 11 "We can use " } {TEXT 354 7 "display" }{TEXT -1 33 " to put two such graphs together. " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 170 "p1:=plot([[seq([i,ithp rime(i)],i=1..5)]],style=point, symbol=circle, color = red):\n\np2:=pl ot( [seq([i,ithprime(i)],i=1..5)],style= line,color = black):\n\ndispl ay(\{p1,p2\});" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}} {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 17 " polar coordinates" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 18 "To plot the c urve " }{TEXT 284 6 "r = f(" }{XPPEDIT 285 0 "theta" "6#%&thetaG" } {TEXT 286 1 ")" }{TEXT -1 3 " , " }{TEXT 287 4 "for " }{XPPEDIT 288 0 "theta" "6#%&thetaG" }{TEXT 289 11 " from 0 to " }{XPPEDIT 290 0 "2*Pi " "6#*&\"\"#\"\"\"%#PiGF%" }{TEXT -1 6 ", in " }{TEXT 291 17 "polar c oordinates" }{TEXT -1 7 " use \n" }{TEXT 268 1 " " }}{PARA 0 "" 0 "" {TEXT 292 18 " plot([f(" }{XPPEDIT 256 0 "theta" "6#%&thetaG " }{TEXT 269 4 ") , " }{XPPEDIT 257 0 "theta" "6#%&thetaG" }{TEXT 270 2 ", " }{XPPEDIT 258 0 "theta" "6#%&thetaG" }{TEXT 271 6 " = 0.." } {XPPEDIT 260 0 "2*Pi" "6#*&\"\"#\"\"\"%#PiGF%" }{TEXT 272 41 "], coord s=polar, scaling = constrained):\n" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 57 "We start with an example where r = 1. So we get a circle:" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 61 "plot([1,theta,theta=0..Pi],c oords=polar,scaling=constrained);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 47 "Next r = cos(2*theta) for theta from 0 to 2*Pi:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 78 "plot([cos(2*theta),theta, theta=0..2*Pi], coords=polar, scaling = constrained);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 12 "implicitplo t" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 34 "Plots of plane curves of the form " }{TEXT 355 10 "f(x,y) = 0" }{TEXT -1 84 " require different commands Note that above we hav e so far plotted either functions " }{TEXT 356 8 "y = f(x)" }{TEXT -1 33 " or lists of points. The command " }{TEXT 294 12 "implicitplot" } {TEXT -1 31 " is needed to plot things like " }{XPPEDIT 18 0 "x^2+y^2 \+ = 1;" "6#/,&*$%\"xG\"\"#\"\"\"*$%\"yGF'F(F(" }{TEXT -1 11 ". We need \+ " }{TEXT 357 12 "implicitplot" }{TEXT -1 18 " from the package " } {TEXT 358 5 "plots" }{TEXT -1 10 " for this:" }}}{EXCHG {PARA 0 "" 0 " " {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "with(plot s):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "eqn:=x^4+y^4-5*x*y + 1/5 = 0;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 47 "implicitplot(e qn, x=-3..3,y=-3..3,color=black);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 103 "There are two ways to increase the number of points plotted and t hus improve the accuracy of the graph:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 64 "implicitplot(eqn, x=-3..3,y=-3..3,color=black, numpoi nts=10000);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 125 "The default numbe r of points plotted is a 25 x 25 grid of points equally spaced in the indicate range. To increase this use " }{TEXT 293 9 "grid[A,B]" } {TEXT -1 40 " for some integers A and B, for example:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 63 "implicitplot(eqn, x=-3..3,y=-3..3, \+ color=black,grid=[100,100]);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 16 "Misleading plots" }} {EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 86 "The default number of points plotted is 50. This sometimes give s a false impression of" }}{PARA 0 "" 0 "" {TEXT -1 84 "the graph. See how the following graph changes when we increase the number of points " }}{PARA 0 "" 0 "" {TEXT -1 46 "plotted by adding the option numpoint s= 4000. " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 38 "expr:=(1/10)*( x-24)^2 + cos(100*Pi*x);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "plot(expr,x=0..60,color=black);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 32 "display(%,view=[40..50,20..70]);" }}}{EXCHG {PARA 0 " " 0 "" {TEXT -1 22 "Increasing the option " }{TEXT 295 9 "numpoints" } {TEXT -1 27 " makes a lot of difference:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 82 "plot((1/10)*(x-24)^2 + cos(2*Pi*x),x=40..50,y=20..70, numpoints=4000,color=black);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 21 "Placing text in plots" }}{EXCHG {PARA 0 " " 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 74 "If you hav e the desire and energy you can also place text in plots. Using " } {TEXT 273 18 "title = `whatever`" }{TEXT -1 41 ",you may give a title \+ to the plot, Using " }{TEXT 274 15 "labels = [x,y]" }{TEXT -1 90 " yo u may have labels put on the x and y axes. But the placement may not b e so good. Using " }{TEXT 296 8 "textplot" }{TEXT -1 5 " and " }{TEXT 297 10 "textplot3d" }{TEXT -1 100 " one may place text where one wants to. Here are some examples. Text may be enclosed by \" \" or ` `. " } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "with(plots):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 155 "a:=plot(sin(x),x=-Pi..Pi):\nb:=tex tplot([Pi/2,1.1,\"Local Maximum\"]):\nc:=textplot([-Pi/2,-1.1,\"Local \+ Minimum\"]):\ndisplay(\{a,b,c\}, title = \"Graph of sin(x)\");" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 41 "p := plot(sin(x),x=-Pi..Pi): delta := .1:" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 71 "We may also add \+ the options align = one of BELOW, RIGHT, ABOVE, LEFT or" }}{PARA 0 "" 0 "" {TEXT -1 36 "a set of thes such as \{BELOW,LEFT\}. " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 164 "t1 := textplot([Pi/2,1+delta,`Loca l Maxima (Pi/2, 1)`],align=ABOVE):\n\nt2 := textplot([-Pi/2,-1 -delta, `Local Minima (-Pi/2, -1)`],align=BELOW):\n\ndisplay(\{p,t1,t2\});" }} }}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 28 "Assignment 7 Due Next Monday" } }{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }{TEXT 300 69 "Note that you wil l have to do some experimenting to get nice graphs. " }{TEXT 330 19 "T o get full credit " }{TEXT 331 0 "" }{TEXT 301 82 "the graphs should r esemble the descriptions given and should be relatively smooth." } {TEXT 332 1 "\n" }}}{EXCHG {PARA 0 "" 0 "" {TEXT 298 10 "Problem 1." } {TEXT -1 6 " Let " }{XPPEDIT 18 0 "f(x) = sin(x)*exp(-x^2);" "6#/-%\" fG6#%\"xG*&-%$sinG6#F'\"\"\"-%$expG6#,$*$F'\"\"#!\"\"F," }{TEXT -1 3 " . " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 90 "(a ) Plot the graph of f for x in the interval [-2,2]. \n\n(b) Find to 10 decimal digits the " }{TEXT 363 7 "maximum" }{TEXT -1 5 " and " } {TEXT 364 7 "mimimum" }{TEXT -1 32 " values of f(x) for x in [-2,2] " }{TEXT 362 3 "AND" }{TEXT -1 6 " find " }{TEXT 365 31 "the correspondi ng values of x. " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 " " 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT 299 10 "Problem 2 ." }{TEXT -1 15 " Plot the curve" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT -1 1 " " }{XPPEDIT 18 0 "x^4+2*x^2*y^2+10*x^2-4* x^3-4*x*y^2-16*x*y-12*x-6*y^2+16*y+21+y^4 = 0;" "6#/,8*$%\"xG\"\"%\"\" \"*(\"\"#F(*$F&F*F(%\"yGF*F(*&\"#5F(*$F&F*F(F(*&F'F(*$F&\"\"$F(!\"\"*( F'F(F&F(F,F*F3*(\"#;F(F&F(F,F(F3*&\"#7F(F&F(F3*&\"\"'F(*$F,F*F(F3*&F6F (F,F(F(\"#@F(*$F,F'F(\"\"!" }{TEXT -1 2 ". " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 140 "Choose your options an d ranges so that it looks like two circles Note that this curve is not the graph of a function. If you use the option " }{TEXT 375 11 "axes \+ = none" }{TEXT -1 5 " and " }{TEXT 376 13 "color = black" }{TEXT -1 87 " you may get a nicer picture. You may need other options to get a \+ really nice picture. " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT 302 10 "Problem 3." }{TEXT -1 100 " Use Maple t o make the following picture. [The 13 stars in the original flag of th e United States.]" }}}{EXCHG {PARA 13 "" 1 "" {GLPLOT2D 136 135 135 {PLOTDATA 2 "64-%'CURVESG6%7(7$$\"\"!F)$\"\")F)7$$\"38+++CD&y(e!#=$\"3 s*****f+$)4>'!#<7$$!3/+++l^c5&*F/$\"3F+++%*p,4tF27$$\"3/+++l^c5&*F/F67 $$!38+++CD&y(eF/F0F'-%'COLOURG6&%$RGBG$\"#5!\"\"F(F(-%&STYLEG6#%%LINEG -F$6%7(7$$\"3#)*****H?iID$F2$\"3Q+++!=#>)>(F27$$\"3-+++bu%3%QF2$\"36++ +'=v\"*Q&F27$$\"3A+++'o0?I#F2$\"3w*****R<4s]'F27$$\"3J+++?(=T?%F2FY7$$ \"30+++^pFlEF2FTFLF>FE-F$6%7(7$$\"36+++iq)3w&F2$\"3H+++EKXw\\F27$$\"3( )*****RJs'[jF2$\"3,+++KiVnJF27$$\"3r*****faI)4[F2$\"3m******>-Z&G%F27$ $\"3j*****zdV>r'F2F[p7$$\"3M+++5=5t^F2FfoF^oF>FE-F$6%7(7$$\"3$*******= @'*[pF2$\"3-+++jnvV=F27$$\"3q*****4PZn`(F2$\"3r******\\o(RZ$!#>7$$\"3M +++-c!z*fF2$\"31+++dPx_6F27$$\"3V+++O'=+!zF2Fdq7$$\"3<+++noFE-F$6%7(7$$\"3#********p8^a'F2$!3%******z?MA[\"F27$$\"3o*****>&*)*G 8(F2$!3?+++-7D\"H$F27$$\"3S+++%=dSf&F2$!36+++9s@t@F27$$\"3K+++;-<'\\(F 2F\\s7$$\"3;+++[%Gt&fF2FgrF_rF>FE-F$6%7(7$$\"3!)******3'e=k%F2$!3I+++O _dRUF27$$\"3c*****4'QkH_F2$!3o******HAf[gF27$$\"3=+++#4-3p$F2$!3.+++U# e0$\\F27$$\"3G+++E^\"Hf&F2Fdt7$$\"3/+++dL2aSF2F_tFgsF>FE-F$6%7(7$$\"3) *******\\'4_n\"F2$!3u*****>s#f'z&F27$$\"3(******>!\\*HE#F2$!3-+++;(4cg (F27$$\"3!******\\LJ:C(F/$!3P+++Gdd(['F27$$\"3=+++mhEEEF2F\\v7$$\"3,++ +)RCu3\"F2FguF_uF>FE-F$6%7(7$$!3)*******\\'4_n\"F2Fbu7$$!3,+++)RCu3\"F 2Fgu7$$!3=+++mhEEEF2F\\v7$$!3!******\\LJ:C(F/F\\v7$$!3(******>!\\*HE#F 2FguFgvF>FE-F$6%7(7$$!3!)******3'e=k%F2Fjs7$$!3/+++dL2aSF2F_t7$$!3G+++ E^\"Hf&F2Fdt7$$!3=+++#4-3p$F2Fdt7$$!3c*****4'QkH_F2F_tFiwF>FE-F$6%7(7$ $!3#********p8^a'F2Fbr7$$!3;+++[%Gt&fF2Fgr7$$!3K+++;-<'\\(F2F\\s7$$!3S +++%=dSf&F2F\\s7$$!3o*****>&*)*G8(F2FgrF[yF>FE-F$6%7(7$$!3$*******=@'* [pF2Fip7$$!3<+++noFE-F$6%7(7$$!36+++iq)3w&F2Fao7$$!3M+++5=5t^F2Ff o7$$!3j*****zdV>r'F2F[p7$$!3r*****faI)4[F2F[p7$$!3()*****RJs'[jF2FfoF_ [lF>FE-F$6%7(7$$!3#)*****H?iID$F2FO7$$!30+++^pFlEF2FT7$$!3J+++?(=T?%F2 FY7$$!3A+++'o0?I#F2FY7$$!3-+++bu%3%QF2FTFa\\lF>FEF#-%+AXESLABELSG6%Q!6 \"Fc]l%(DEFAULTG-%*AXESSTYLEG6#%%NONEG-%(SCALINGG6#%,CONSTRAINEDG-%%VI EWG6$Fe]lFe]l" 1 2 0 1 10 0 2 9 1 1 1 1.000000 45.000000 45.000000 0 0 "Curve 1" "Curve 2" "Curve 3" "Curve 4" "Curve 5" "Curve 6" "Curve 7 " "Curve 8" "Curve 9" "Curve 10" "Curve 11" "Curve 12" "Curve 13" "Cur ve 14" }}}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 65 "Here are some hints: Te st each step by plotting the points using " }{TEXT 373 13 "style = poi nt" }{TEXT -1 8 " and or " }{TEXT 374 12 "style = line" }{TEXT -1 161 " before continuing to the next step.\n\n1. The following procedure w ill produce a list of n equally spaced points on a circle of radius r \+ centered at the origin :" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 96 "CirclePoints:=proc(n,r) \nevalf([seq(r*[sin(i*(2*Pi/n)), cos(i*(2*Pi/ n))], i=0..n)]); \nend proc:\n" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 42 "2. Use the above procedure to make a list " }{TEXT 377 1 "L" }{TEXT -1 62 " of 5 points on the unit circle. Then you may form a new list \+ " }{TEXT 366 21 "W:=[L[1], L[3], ...,]" }{TEXT -1 36 " which when plot ted with the option " }{TEXT 380 12 "style = line" }{TEXT -1 146 " wil l produce a star. Number the points in the original circle and by hand trace out the star. This will show you how to complete the list for W . " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 69 "3. \+ The following procedure can be used to translate the star give by " } {TEXT 370 1 "W" }{TEXT -1 32 " from the origin to a new point " } {TEXT 371 1 "P" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 47 "translate :=proc(W,P)\n map(x->x+P,W);\nend proc:" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 30 "4. Now create the list , say, " }{TEXT 369 1 "X" }{TEXT -1 57 " of 13 points in a suitably sized circle. For each point " } {TEXT 368 8 "P = X[i]" }{TEXT -1 32 " in the list translate the star \+ " }{TEXT 378 1 "W" }{TEXT -1 18 " to the new point " }{TEXT 372 1 "P" }{TEXT -1 48 " and create a plot of this star. Call it, say, " } {TEXT 379 7 "Plot[i]" }{TEXT -1 39 ". Do this using a do loop. Finally use " }{TEXT 367 7 "display" }{TEXT -1 72 " to show all these plots a t the same time to create the above picture.\n\n" }}}{EXCHG {PARA 0 " " 0 "" {TEXT 303 9 "Problem 4" }{TEXT -1 33 ". Plot the graph of the f unction " }{XPPEDIT 18 0 "g(x) = 10/(x^3-10*x-10*x^2+100);" "6#/-%\"gG 6#%\"xG*&\"#5\"\"\",**$F'\"\"$F**&F)F*F'F*!\"\"*&F)F**$F'\"\"#F*F/\"$+ \"F*F/" }{TEXT -1 18 " using the option " }{TEXT 333 14 "discont = tru e" }{TEXT -1 235 " to remove the vertical asymptotic lines. Choose hor izontal as well as vertical ranges to give a nice picture of the curve s showing clearly where ALL THREE vertical asymptotes are located. Ag ain this may require some experimentation. " }}}{EXCHG {PARA 0 "" 0 " " {TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT 259 0 " " }}}}{MARK "12" 0 }{VIEWOPTS 0 0 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 1 1 2 33 1 1 }