{VERSION 5 0 "SUN SPARC SOLARIS" "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 Output" 2 20 "" 0 1 0 0 255 1 0 0 0 0 0 0 0 0 0 1 } {PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Maple Output" 0 11 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }3 3 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }} {SECT 0 {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 51 "# A Maple Session to compute the next approximation" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "with(plots):with(plottools):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 70 "f:=x^3-3*x*y+y^3; # This is the function on problems \+ #7 & #5 of test 2" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"fG,(*$)%\"xG \"\"$\"\"\"F**(F)F*F(F*%\"yGF*!\"\"*$)F,F)F*F*" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 54 "P0:=[1/2,9/8]; # This is roughly the Q in #5 o f test 2" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#P0G7$#\"\"\"\"\"##\"\"* \"\")" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 79 "x0:=P0[1]; y0:=P0[ 2]; # P0 is a Maple list, x0 is the first element, y0 the 2nd" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#>%#x0G#\"\"\"\"\"#" }}{PARA 11 "" 1 " " {XPPMATH 20 "6#>%#y0G#\"\"*\"\")" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 54 "z0:=eval(f,\{x=x0,y=y0\}); #For later use in the 3d p lot" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#z0G#!#r\"$7&" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 72 "f_x:=diff(f,x); f_y:=diff(f,y); # T his the Maple way to take derivatives" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%$f_xG,&*$)%\"xG\"\"#\"\"\"\"\"$*&F+F*%\"yGF*!\"\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%$f_yG,&%\"xG!\"$*&\"\"$\"\"\")%\"yG\"\"#F*F*" }} }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 52 "a:=eval(f_x,\{x=x0,y=y0\}); # This computes f_x(x0,y0)" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"aG# !#@\"\")" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 52 "b:=eval(f_y,\{x =x0,y=y0\}); # This computes f_y(x0,y0)" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"bG#\"$Z\"\"#k" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 56 " u:=[-a, -b]; # this is the direction of steepest descent" }}{PARA 11 " " 1 "" {XPPMATH 20 "6#>%\"uG7$#\"#@\"\")#!$Z\"\"#k" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 64 "PuLine:=[x0-a*t,y0-b*t,t=0..1]; #Something \+ you can put into plot" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%'PuLineG7%, &#\"\"\"\"\"#F(*&#\"#@\"\")F(%\"tGF(F(,&#\"\"*F-F(*&#\"$Z\"\"#kF(F.F(! \"\"/F.;\"\"!F(" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 286 "display (\ncontourplot(f,x=-1..2,y=-1..2,contours=[z0, -1/2,0,1,2,4,8]), #Note contours\nplot(PuLine,color=green), # This is the Puline\ntextplot([x 0,y0,\"P0\"],color=green), # The text label P0\narrow([x0,y0],vector(u ),.1,.2,.2,color=red) # An arrow, just to be fancy\n); # end display c ommand" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 53 "g:=eval(f,\{x=x0- a*t,y=y0-b*t\}); # g(t) = f(x(t),y(t))" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"gG,(*$),&#\"\"\"\"\"#F**&#\"#@\"\")F*%\"tGF*F*\"\"$F*F**(F1F *F(F*,&#\"\"*F/F**&#\"$Z\"\"#kF*F0F*!\"\"F*F:*$)F3F1F*F*" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 45 "diff(g,t); # looking for critical p oints of g" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#,**$),&#\"\"\"\"\"#F(*&# \"#@\"\")F(%\"tGF(F(F)F(#\"#jF-#\"$$p\"$G\"!\"\"*&#\"%h#*\"$c#F(F.F(F( *&#\"$T%\"#kF(*$),&#\"\"*F-F(*&#\"$Z\"F " 0 "" {MPLTEXT 1 0 53 "expand(diff(g,t)); # force maple to expand the powers" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#,(#!&L)\\\"%'4% \"\"\"*&#\"(N[^\"\"&%Q;F'%\"tGF'F'*&#\"(F`p%\"'W@EF')F,\"\"#F'F'" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 47 "solve(diff(g,t)=0,t); # find the critical point" }}{PARA 11 "" 1 "" {XPPMATH 20 "6$,&#!%g\"*\"%\\N \"\"\"*&#\"#KF&F'-%%sqrtG6#\"&%H!*F'F',&F$F'*&#F*F&F'*$F+F'F'!\"\"" }} }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 61 "# There are two critical po ints, we want the local min which " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "# has to be the first. Why?" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 62 "t1:=solve(diff(g,t)=0,t)[1]; # A way to pull the first one off" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#t1G,&#!%g\"*\"%\\ N\"\"\"*&#\"#KF(F)-%%sqrtG6#\"&%H!*F)F)" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 80 "# If f was a quadratic instead of a cubic, t0 would b e a fraction and not a surd" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 54 "x1:=eval(x0-a*t,\{t=t1\}); # new approximation's x value" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#x1G,&#!%@@\"$Q$\"\"\"*&#\"\"%\"$p\"F)-%%s qrtG6#\"&%H!*F)F)" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 54 "y1:=ev al(y0-b*t,\{t=t1\}); # new approximation's y value" }}{PARA 11 "" 1 " " {XPPMATH 20 "6#>%#y1G,&#\"%#>\"\"$p\"\"\"\"*&#\"\"(\"$Q$F)*$-%%sqrtG 6#\"&%H!*F)F)!\"\"" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 32 "P1:=[ x1,y1]; # new approximation" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#P1G7 $,&#!%@@\"$Q$\"\"\"*&#\"\"%\"$p\"F*-%%sqrtG6#\"&%H!*F*F*,&#\"%#>\"F.F* *&#\"\"(F)F**$F/F*F*!\"\"" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 63 "z1:=eval(f,\{x=x1,y=y1\}); # value of f(P1) for contourplot below " }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#z1G,(*$),&#!%@@\"$Q$\"\"\"*&#\" \"%\"$p\"F,-%%sqrtG6#\"&%H!*F,F,\"\"$F,F,*(F5F,F(F,,&#\"%#>\"F0F,*&#\" \"(F+F,*$F1F,F,!\"\"F,F>*$)F7F5F,F," }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 283 "display(\ncontourplot(f,x=0..1.5,y=0..1.5,contours=[ z0, z1,-1/2,0,1,2,4,8]), #Notice z0 z1\nline(P0,P1,color=green), # lin e seqment P0 to P1\ntextplot([x0,y0,\"P0\"],color=green), # starting p oint\ntextplot([x1,y1,\"P1\"],color=blue), # next approximation\nscali ng=constrained\n); #end display" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 348 "display(\nplot3d(f,x=0..1.5,y=0..1.5,style=patchcontour,shadi ng=z,\ncontours=[z0, evalf(z1),-1/2,0,1,2,4,8]), #Note z0, z1 \nspacec urve([x0-a*t,y0-b*t,g],t=0..t1,color=green, #\nthickness=3), #plot g a s a spacecurve\ntextplot3d([x0,y0,z0,\"P0\"],color=green), #starting p oint\ntextplot3d([x1,y1,z1,\"P1\"],color=red) #next approximation poin t\n); #end display" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}} {MARK "25 0 0" 89 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }