{VERSION 5 0 "APPLE_PPC_MAC" "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 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 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 262 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 263 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 264 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 265 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 266 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 267 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 268 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 269 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 270 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 271 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" 18 272 "" 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" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 314 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 315 "" 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 } {CSTYLE "" -1 316 "" 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 317 "" 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 318 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 319 "" 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 320 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 } {CSTYLE "" -1 321 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 322 "" 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 "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 }{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 }3 1 0 0 0 0 1 0 1 0 2 2 0 1 }} {SECT 0 {EXCHG {PARA 257 "" 0 "" {TEXT -1 17 "Lecture 8 Part a " }}} {EXCHG {PARA 258 "" 0 "" {TEXT -1 54 "Please shrink all plots before p rinting to save paper." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT 320 149 "This lecture is split into two workshee ts since the large number of plots in the lecture sometimes causes a m emory problem which may lead to crashes." }{TEXT -1 1 " " }}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 32 "displaying several plots at once" }} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart:" }}}{EXCHG {PARA 0 " " 0 "" {TEXT -1 158 "There are two ways of doing this. The following i llustrates one way. It also shows how to color the different graphs an d increase the thickness of the curves." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 104 "g:=x^3:\ndg:=diff(g,x):\nddg:=diff(dg,x):\nplot([g,d g,ddg],x=-2..2, color=[red,blue,black], thickness = 3);" }}}{PARA 0 " " 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 43 "We can do t he same thing using the command " }{TEXT 291 7 "display" }{TEXT -1 13 " after doing " }{TEXT 292 11 "with(plots)" }{TEXT -1 29 " which bring s in the package " }{TEXT 293 5 "plots" }{TEXT -1 114 ". We create plo ts for each of c, D(c) and (D@D)(c). Then \"display\" them on a single set of axes using the command " }{TEXT 260 7 "display" }{TEXT -1 80 " . This method is much more flexible that the previous one as we shall \+ see later." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "with(plots): " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 41 "P[1]:=plot(x^4, x = -2. .2, color = red): " }{TEXT -1 102 "<--Use colon here instead of semico lon. Otherwise you will gets lots more output than you wish to see." } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 40 "P[2]:=plot(4*x^3,x=-2..2, \+ color = blue):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 85 "P[3]:=plo t(12*x^2, x=-2..2, color = black):\nP[4]:=plot(12*x, x=-2..2, color = \+ green):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "display(\{seq(P[ i],i=1..4)\});" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 60 "Or you may arra nge the plots in a 2 by 2 matrix, as follows:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 40 "display(matrix(2,2,[seq(P[i],i=1..4)]));" }}} {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 coordinates may often be defined b y parametric equations:" }}{PARA 0 "" 0 "" {TEXT -1 24 "\n \+ " }{TEXT 273 44 "x=f(t), \n y=g(t), \+ \n\n" }{TEXT 296 24 "where t goes from a to b" }{TEXT 297 3 ". \n" }} {PARA 0 "" 0 "" {TEXT -1 104 "Perhaps the best example is the circle o f radius r = a centered at the origin, which is parametrized by " }} {PARA 0 "" 0 "" {TEXT -1 24 "\n " }{XPPEDIT 272 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..2*Pi]);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 44 "To make this look r ounder we add the option " }{MPLTEXT 1 0 21 "scaling = constrained" } {TEXT -1 59 " to force Maple to use the same scale on the x and y axe s:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 59 "plot([2*cos(t),2*sin( t),t=0..2*Pi], scaling = constrained);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 120 "Next we modifiy the circle slightly by giving it a varia ble radius making it into a spiral: Note that we use the option " } {MPLTEXT 1 0 12 "axes = boxed" }{TEXT -1 33 ". We discuss other option s 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 107 "Next we plot a bunch of concent ric circles of radii 1, 2, . . . , 10. We first form the plots, then w e use " }{TEXT 298 7 "display" }{TEXT -1 112 " to display them all a o nce. Notice the trick used here to give different colors to different \+ curves. Check out " }{MPLTEXT 1 0 11 "?plot,color" }{TEXT -1 29 " to s ee the available colors." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 192 "L0:=red,blue,green,gold, turquoise, orange, magenta, aquamarine, \+ yellow, pink, plum, wheat:\nfor r from 1 to 10 do\n P[r]:=plot([r*cos (t),r*sin(t),t=0..2*Pi], color = L0[r], thickness = 3):\nod:" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 70 "plots[display](\{seq(P[r],r= 1..10)\}, scaling = constrained, axes=none);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "?plot,color" }}}}{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 " }{MPLTEXT 1 0 13 "?plot/options" }{TEXT -1 49 ". There are many options. We examine only a few." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 262 14 "Vertical Range" }{TEXT -1 94 " may be controlled as in t he following two examples. In our first example we plot a procedure:" }}}{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 cu t 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 303 1 "S" }{TEXT -1 47 " as a variable and write the plot limits using " }{TEXT 301 1 "S" }{TEXT -1 5 " and \+ " }{TEXT 302 1 "T" }{TEXT -1 51 " as in the following example, the axe s are labeled " }{TEXT 304 1 "S" }{TEXT -1 5 " and " }{TEXT 305 1 "T" }{TEXT -1 27 ". Here I also control what " }{TEXT 300 9 "tickmarks" } {TEXT -1 44 " are placed on the axes by suitable options." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 78 "plot(f(S),S=-2..2,T=-20..20, xtickm arks=[-2,-1,0,1,2], ytickmarks=[-10,0,10]);" }}}{EXCHG {PARA 0 "" 0 " " {TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 25 "We may also do \+ this with " }{TEXT 319 11 "expressions" }{TEXT -1 1 ":" }}}{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,xti ckmarks=[-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 274 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 at the places where " }{TEXT 299 6 "tan(x)" }{TEXT -1 44 " has a discontinuity one may use the option " }{MPLTEXT 1 0 12 "di scont=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 306 7 "scaling" }{TEXT -1 29 " option: By using the option " } {MPLTEXT 1 0 21 "scaling = constrained" }{TEXT -1 64 " you can insure \+ that Maple with use the same 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=constrained);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 58 " One can restrict the range as we did above or one may use " }{TEXT 263 4 "view" }{TEXT -1 14 ". The option " }{TEXT 264 4 "view" }{TEXT -1 179 " has the advantage of being quicker since when it is used the \+ graph is not recomputed. The same data is used to redraw the graph: He re 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 wo rthless:" }}}{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 lines 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 loo k better by using the option " }{TEXT 294 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 134 "Now let's show how to use view: We look at the f amous sin(1/x) curbe graphed on the same axes with x^2. First we give \+ the plot a name." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 69 "P:=plot(\{sin(1/x),x^2\},x=0..1,col or=black, xtickmarks=5):\ndisplay(P);" }}}{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 can approximate the corrdinate of one point where the two graphs cross. " }{TEXT 275 253 "If you click on the intersection of the two curves you will see the coordinates di splayed in the upper left of the worksheet. But note that this only gi ves an approximation. Better methods are needed to get more precise co ordinates of the intersection." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 38 "display(P,view=[(.2)..(.4), 0..(.2)]);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT 261 6 "Style:" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 11 "The o ption " }{TEXT 276 5 "style" }{TEXT -1 14 " has the form " }{MPLTEXT 1 0 12 "style = line" }{TEXT -1 4 " or " }{MPLTEXT 1 0 13 "style = poi nt" }{TEXT -1 23 " These apply only to a " }{TEXT 295 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 39 "We can make the lines thicker by using " }{MPLTEXT 1 0 13 "thickness = i" } {TEXT -1 63 " where i should be 0, 1, 2, or 3. 0 is the default thic kness." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 77 "plot([[0,0],[1,-1 ],[2,2], [1,3],[0,0]],style=line, color=blue,thickness = 3);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 62 "Here's a way to plot a discrete fu nction such as the function " }{TEXT 307 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 75 "plot([[seq([i,ithprime(i)],i =1..5)]],style=point, symbol=box, color=black);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 11 "We can use " }{TEXT 308 7 "display" }{TEXT -1 33 " t o put two such graphs together." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 170 "p1:=plot([[seq([i,ithprime(i)],i=1..5)]],style=point, symbol= circle, color = red):\n\np2:=plot( [seq([i,ithprime(i)],i=1..5)],style = line,color = black):\n\ndisplay(\{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 curve " }{TEXT 277 6 "r = f(" }{XPPEDIT 278 0 "theta" "6#%&thetaG" }{TEXT 279 1 ")" }{TEXT -1 3 " , " }{TEXT 280 4 "for " }{XPPEDIT 281 0 "theta" "6#%&thetaG" }{TEXT 282 11 " from 0 to " }{XPPEDIT 283 0 "2*Pi" "6#*&\"\"#\"\"\"%#PiGF%" }{TEXT -1 6 ", in " }{TEXT 284 17 "polar coordinates" }{TEXT -1 7 " use \n" } {TEXT 265 1 " " }}{PARA 0 "" 0 "" {TEXT 285 18 " plot([f(" } {XPPEDIT 256 0 "theta" "6#%&thetaG" }{TEXT 266 4 ") , " }{XPPEDIT 257 0 "theta" "6#%&thetaG" }{TEXT 267 3 " , " }{XPPEDIT 258 0 "theta" "6#% &thetaG" }{TEXT 268 6 " = 0.." }{XPPEDIT 259 0 "2*Pi" "6#*&\"\"#\"\"\" %#PiGF%" }{TEXT 269 41 "], coords=polar, scaling = constrained):\n" }} }{EXCHG {PARA 0 "" 0 "" {TEXT -1 13 "The variable " }{XPPEDIT 18 0 "th eta;" "6#%&thetaG" }{TEXT -1 99 " (theta) may be replaced by any varia ble. 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 309 10 "f(x,y) = 0" }{TEXT -1 84 " require different commands Note that above we hav e so far plotted either functions " }{TEXT 310 8 "y = f(x)" }{TEXT -1 33 " or lists of points. The command " }{TEXT 287 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 311 12 "implicitplot" }{TEXT -1 18 " from the package " } {TEXT 312 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 286 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 288 9 "numpoints" } {TEXT -1 27 " makes a lot of difference:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 72 "plot((1/10)*(x-24)^2 + cos(2*Pi*x),x=0..60, numpoints =4000,color=black);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 32 "disp lay(%,view=[40..50,20..70]);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 21 "Placing text in plots " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 74 "If you have the desire and e nergy you can also place text in plots. Using " }{TEXT 270 18 "title = \"whatever\"" }{TEXT -1 41 ",you may give a title to the plot, Using \+ " }{TEXT 271 15 "labels = [x,y]" }{TEXT -1 90 " you may have labels p ut on the x and y axes. But the placement may not be so good. Using " }{TEXT 289 8 "textplot" }{TEXT -1 5 " and " }{TEXT 290 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 55 "plot(sin, 0..2*Pi, title = \"The graph of y \+ = sin(x).\");" }}}{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:=textplot([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 42 "p := plot(sin(x), x=-Pi..Pi): \ndelta := .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,`Local Maxima (Pi/2, 1)`],align=ABOVE):\n\nt2 := textplot([-Pi/ 2,-1 -delta,`Local Minima (-Pi/2, -1)`],align=BELOW):\n\ndisplay(\{p,t 1,t2\});" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 29 "Basic three-dimensi onal plots" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 33 "First we consider th e ploting of " }{TEXT 315 24 "an expression or formula" }{TEXT -1 12 " of the form" }{TEXT 313 11 " z = f(x,y)" }{TEXT -1 58 " for x and y i n a given range. First we plot the surface " }{TEXT 314 12 "z = cos(x *y)" }{TEXT -1 150 " with x between -3 and 3 and y between -3 and 3. O f course, there is nothing special about x, y and z. Any variables cou ld be used instead. Note that " }{TEXT 321 6 "plot3d" }{TEXT -1 22 " r equires loading the " }{TEXT 322 5 "plots" }{TEXT -1 9 " package." }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "restart:\nwith(plots):" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 33 "plot3d(cos(x*y),x=-3..3,y=-3 ..3);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 226 "Note that if you click \+ on the graph you can rotate it with your cursor. Also a row of options , different types of spheres, etc. appear on the menu. By clicking on \+ these you can see the effect on the graph. Execute the command " } {MPLTEXT 1 0 16 "?plot3d[options]" }{TEXT -1 246 " to see what some of the many additional features you have to choose from. These options e ither appear on the menu at the top or may be obtained by (right) clic king on the graph on a PC. On a Mac hold down the option key while cli cking the mouse." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 35 "\nAs for ordi nary plots you may use " }{TEXT 316 10 "procedures" }{TEXT -1 12 " ins tead of " }{TEXT 317 21 "algebraic expressions" }{TEXT -1 88 " as in t he above example.To illustrate we convert the above expression into a \+ procedure:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "f:=unapply(co s(x*y),x,y);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "plot3d(f,-3 ..3,-3..3);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 " " {TEXT -1 86 "Changes made with the mouse can also be accomplished by adding various options to the " }{TEXT 318 6 "plot3d" }{TEXT -1 36 " \+ command itself: Here is an example:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 66 "plot3d(f,-3..3,-3..3,grid=[50,50],axes=box, style = p atchcontour);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 145 "The range of th e variable y can depend on the variable x as in the following examples . This has the effect of restricting the domain to a circle." }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 101 "plot3d((1-(x^2+y^2))*sin(x^ 2+y^2), x=-1..1,y=-sqrt(1-x^2)..sqrt(1-x^2), axes=box, style=patchnogr id);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 79 "plot3d(x*y, x=-1..1 ,y=-sqrt(1-x^2)..sqrt(1-x^2), axes=none, style=patchnogrid);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{PARA 3 "" 0 "" {TEXT -1 0 "" }}}}{MARK "10" 0 }{VIEWOPTS 1 0 0 1 1 1803 1 1 1 1 } {PAGENUMBERS 1 1 2 33 1 1 }