{VERSION 5 0 "IBM INTEL NT" "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 "" {TEXT -1 11 "Maple Lab 4" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 36 "Example with numeric al approximation" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 73 "This example uses differentials to approximate a function f at a point p." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 80 "The algorithm stops when successive approximations are wi thin .01 of each other." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "f:= x -> x^2:" }{TEXT -1 47 " Just as in newton's method you need f and f'." }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 15 "f_prime:= D(f);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6# >%(f_primeGf*6#%\"xG6\"6$%)operatorG%&arrowGF(,$*&\"\"#\"\"\"9$F/F/F(F (F(" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "p := 2.1:" }{TEXT -1 32 " We want to appoximate (2.1)^2." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "IV:= 2: " }{TEXT -1 68 "An initial value, Similiar to the initial guess for Newton's method." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 41 "Now I generate a couple of approxima tions" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "approx1:= f(IV); \+ " }{TEXT -1 33 "This is just f at a nearby point." }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%(approx1G\"\"%" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 32 "approx2:= f(IV) + f_prime(p-IV);" }{TEXT -1 38 "This is the di fferential approximation" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%(approx2 G$\"#U!\"\"" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 102 "Here is a loop wh ich uses points closer and closer to 2.1 to get improved differential \+ approximations." }}{PARA 0 "" 0 "" {TEXT -1 74 "The loop stops when su ccessive approximations are within .01 of each other" }}{PARA 0 "" 0 " " {TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 127 "while abs(approx 2 - approx1) > .01 do IV := IV + (p - IV)/2:\n approx1 := approx2:\n approx2 := f(IV) + f_prime(p-IV):\nend do:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 10 "approx2; " }{TEXT -1 24 "This is our final resu lt" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#$\"+mZ8.W!\"*" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "actual:= f(p);" }{TEXT -1 37 " This is t he actual value of (2.1)^2" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%'actua lG$\"$T%!\"#" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{MARK "10 0 0" 0 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }