{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 "Text Output" -1 2 1 {CSTYLE "" -1 -1 "Courier" 1 10 0 0 255 1 0 0 0 0 0 1 3 0 3 0 }1 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Warning" 2 7 1 {CSTYLE "" -1 -1 " " 0 1 0 0 255 1 0 0 0 0 0 0 1 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):" }}{PARA 7 "" 1 "" {TEXT -1 50 "W arning, the name changecoords has been redefined\n" }}{PARA 7 "" 1 "" {TEXT -1 43 "Warning, the name arrow has been redefined\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 68 "f:=x^2-x*y+y^2; # This is the funct ion on problems #7 & #5 of test 2" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#> %\"fG,(*$)%\"xG\"\"#\"\"\"F**&F(F*%\"yGF*!\"\"*$)F,F)F*F*" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 50 "P0:=[1,0]; # This is roughly the Q \+ in #5 of 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 plot" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#z0G\"\"\"" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 72 "f_x:=diff(f,x); f_y:=diff(f,y); # This the Maple way to take deriv atives" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%$f_xG,&*&\"\"#\"\"\"%\"xGF (F(%\"yG!\"\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%$f_yG,&%\"xG!\"\"*& \"\"#\"\"\"%\"yGF*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!\"\"" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 56 "u:=[-a, -b]; # this is the direction of steepest desc ent" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"uG7$!\"#\"\"\"" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 64 "PuLine:=[x0-a*t,y0-b*t,t=0..1]; #So mething you can put into plot" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%'Pu LineG7%,&\"\"\"F'*&\"\"#F'%\"tGF'!\"\"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=gree n), # This is the Puline\ntextplot([x0,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 command" }}}{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)*&F(F)F,F)F-*$)F,F+F)F)" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 45 "diff(g,t); # looking for critical points of g" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#,&\"\"&!\"\"*&\"#9\"\"\"%\"tGF(F(" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 53 "expand(diff(g,t)); # force m aple to expand the powers" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#,&\"\"&! \"\"*&\"#9\"\"\"%\"tGF(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##\"\"&\"#9" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 59 "t1:=solve(diff(g,t)=0,t); # A way to pull the first one off" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#>%#t1G#\"\"&\"#9" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 80 "# If f was a quadratic instead of a cubic, t0 would be 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 va lue" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#x1G#\"\"#\"\"(" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 54 "y1:=eval(y0-b*t,\{t=t1\}); # new ap proximation's y value" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#y1G#\"\"& \"#9" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 32 "P1:=[x1,y1]; # new \+ approximation" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#P1G7$#\"\"#\"\"(# \"\"&\"#9" }}}{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#\"\"$\"#G" }}}{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 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{MARK "23 0 " 0 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }