{VERSION 6 0 "IBM INTEL NT" "6.0" } {USTYLETAB {PSTYLE "Left Justified Maple Output" -1 12 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 0 0 0 1 }1 3 0 0 0 0 2 0 2 0 2 2 -1 1 }{PSTYLE "Warning" -1 7 1 {CSTYLE "" -1 -1 "Courier" 1 10 0 0 255 1 0 0 0 2 2 1 0 0 0 1 }1 0 0 -1 -1 -1 1 0 1 0 2 2 -1 1 }{PSTYLE "D ash Item" -1 16 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 0 0 0 1 }1 1 0 0 3 3 2 0 2 0 2 2 -1 3 }{PSTYLE "Heading 4" -1 20 1 {CSTYLE "" -1 -1 "Times" 1 10 0 0 0 1 1 1 2 2 2 2 0 0 0 1 }1 1 0 0 0 0 2 0 2 0 2 2 -1 1 }{PSTYLE "Heading 3" -1 5 1 {CSTYLE "" -1 -1 "Times " 1 12 0 0 0 1 1 1 2 2 2 2 0 0 0 1 }1 1 0 0 0 0 2 0 2 0 2 2 -1 1 } {PSTYLE "Error" -1 8 1 {CSTYLE "" -1 -1 "Courier" 1 10 255 0 255 1 0 0 0 2 2 1 0 0 0 1 }1 0 0 -1 -1 -1 1 0 1 0 2 2 -1 1 }{PSTYLE "Author" -1 19 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 0 0 0 1 }3 1 0 0 8 8 2 0 2 0 2 2 -1 1 }{PSTYLE "Heading 2" -1 4 1 {CSTYLE "" -1 -1 "Times" 1 14 0 0 0 1 2 1 2 2 2 2 0 0 0 1 }1 1 0 0 8 2 2 0 2 0 2 2 -1 1 }{PSTYLE "Help" -1 10 1 {CSTYLE "" -1 -1 "Courier" 1 9 0 0 255 1 0 0 0 2 2 1 0 0 0 1 }1 0 0 -1 -1 -1 1 0 1 0 2 2 -1 1 }{PSTYLE "Text Ou tput" -1 2 1 {CSTYLE "" -1 -1 "Courier" 1 10 0 0 255 1 0 0 0 2 2 1 0 0 0 1 }1 0 0 -1 -1 -1 1 0 1 0 2 2 -1 1 }{PSTYLE "Heading 1" -1 3 1 {CSTYLE "" -1 -1 "Times" 1 18 0 0 0 1 2 1 2 2 2 2 0 0 0 1 }1 1 0 0 8 4 2 0 2 0 2 2 -1 1 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 0 0 0 1 }1 1 0 0 0 0 2 0 2 0 2 2 -1 1 } {PSTYLE "Maple Plot" -1 13 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 0 0 0 1 }3 1 0 0 0 0 2 0 2 0 2 2 -1 1 }{PSTYLE "Line Printed Output" -1 6 1 {CSTYLE "" -1 -1 "Courier" 1 10 0 0 255 1 0 0 0 2 2 1 0 0 0 1 }1 0 0 -1 -1 -1 1 0 1 0 2 2 -1 1 }{PSTYLE "Normal256" -1 200 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 1 2 2 2 2 0 0 0 1 }3 1 0 0 0 0 2 0 2 0 2 2 -1 1 }{PSTYLE "Title" -1 18 1 {CSTYLE "" -1 -1 "Times" 1 18 0 0 0 1 2 1 1 2 2 2 0 0 0 1 }3 1 0 0 12 12 2 0 2 0 2 2 -1 1 } {PSTYLE "Diagnostic" -1 9 1 {CSTYLE "" -1 -1 "Courier" 1 10 64 128 64 1 0 0 0 2 2 1 0 0 0 1 }1 0 0 -1 -1 -1 1 0 1 0 2 2 -1 1 }{PSTYLE "Maple Output" -1 11 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 0 0 0 1 }3 3 0 0 0 0 2 0 2 0 2 2 -1 1 }{PSTYLE "List Item" -1 14 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 0 0 0 1 }1 1 0 0 3 3 2 0 2 0 2 2 -1 5 }{PSTYLE "Bullet Item" -1 15 1 {CSTYLE "" -1 -1 "Ti mes" 1 12 0 0 0 1 2 2 2 2 2 2 0 0 0 1 }1 1 0 0 3 3 2 0 2 0 2 2 -1 2 } {PSTYLE "Fixed Width" -1 17 1 {CSTYLE "" -1 -1 "Courier" 1 10 0 0 0 1 2 2 2 2 2 2 0 0 0 1 }3 1 0 0 0 0 2 0 2 0 2 2 -1 1 }{CSTYLE "LaTeX" -1 32 "" 0 1 0 0 0 0 0 0 0 2 2 2 0 0 0 1 }{CSTYLE "Maple Comment" -1 21 " Courier" 0 1 0 0 0 1 0 0 0 2 2 2 0 0 0 1 }{CSTYLE "2D Math Bold" -1 5 "Times" 0 1 0 0 0 0 0 1 2 2 2 2 0 0 0 1 }{CSTYLE "Help Underlined" -1 44 "Times" 1 12 0 0 0 0 0 0 1 2 2 2 0 0 0 1 }{CSTYLE "Output Labels" -1 29 "Times" 1 8 0 0 0 1 0 0 0 2 2 2 0 0 0 1 }{CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 2 1 2 0 0 0 1 }{CSTYLE "Page Number " -1 33 "Times" 0 1 0 0 0 0 0 0 2 2 2 2 0 0 0 1 }{CSTYLE "Text" -1 200 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 0 0 0 1 }{CSTYLE "2D Math Italic \+ Small" -1 201 "Times" 0 1 0 0 0 0 1 0 2 2 2 2 0 0 0 1 }{CSTYLE "Help H eading" -1 26 "" 1 14 0 0 0 0 0 1 0 2 2 2 0 0 0 1 }{CSTYLE "Help Itali c Bold" -1 40 "Times" 1 12 0 0 0 0 1 1 0 2 2 2 0 0 0 1 }{CSTYLE "Help \+ Normal" -1 30 "Times" 1 12 0 0 0 0 0 0 0 2 2 2 0 0 0 1 }{CSTYLE "Help \+ Nonterminal" -1 24 "Courier" 0 1 0 0 0 1 0 1 0 2 2 2 0 0 0 1 }{CSTYLE "2D Math Small" -1 7 "Times" 0 1 0 0 0 0 0 0 2 2 2 2 0 0 0 1 }{CSTYLE "_cstyle277" -1 202 "" 0 1 0 0 0 0 0 0 0 2 2 2 0 0 0 1 }{CSTYLE "_csty le276" -1 203 "" 0 1 0 0 0 0 0 1 0 2 2 2 0 0 0 1 }{CSTYLE "_cstyle273" -1 204 "" 0 1 0 0 0 0 0 1 0 2 2 2 0 0 0 1 }{CSTYLE "_cstyle272" -1 205 "" 0 1 0 0 0 0 0 1 0 2 2 2 0 0 0 1 }{CSTYLE "_cstyle271" -1 206 "" 0 1 0 0 0 0 0 1 0 2 2 2 0 0 0 1 }{CSTYLE "Help Underlined Italic" -1 43 "Times" 1 12 0 0 0 0 1 0 1 2 2 2 0 0 0 1 }{CSTYLE "_cstyle270" -1 207 "" 0 1 0 0 0 0 0 1 0 2 2 2 0 0 0 1 }{CSTYLE "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 2 2 2 0 0 0 1 }{CSTYLE "Copyright" -1 34 "Times" 1 10 0 0 0 0 2 2 2 2 2 2 0 0 0 1 }{CSTYLE "Hyperlink" -1 17 "" 0 1 0 128 128 1 2 0 1 2 2 2 0 0 0 1 }{CSTYLE "Plot Title" -1 27 "" 1 10 0 0 0 0 0 1 0 2 2 2 0 0 0 1 }{CSTYLE "2D Input" -1 19 "Times" 0 1 255 0 0 1 0 0 2 2 2 2 0 0 0 1 }{CSTYLE "Help Maple Name" -1 35 "" 0 1 104 64 92 1 0 1 0 2 2 2 0 0 0 1 }{CSTYLE "Help Italic" -1 42 "Times" 1 12 0 0 0 0 1 0 0 2 2 2 0 0 0 1 }{CSTYLE "Help Underlined Bold" -1 41 "Times " 1 12 0 0 0 0 0 1 1 2 2 2 0 0 0 1 }{CSTYLE "_cstyle269" -1 208 "" 0 1 0 0 0 0 0 1 0 2 2 2 0 0 0 1 }{CSTYLE "_cstyle268" -1 209 "" 0 1 0 0 0 0 0 1 0 2 2 2 0 0 0 1 }{CSTYLE "_cstyle267" -1 210 "" 1 18 0 0 0 0 0 0 0 2 2 2 0 0 0 1 }{CSTYLE "Default" -1 38 "" 0 1 0 0 0 0 0 0 0 2 2 2 0 0 0 1 }{CSTYLE "Help Fixed" -1 23 "Courier" 1 10 0 0 0 0 0 0 0 2 2 2 0 0 0 1 }{CSTYLE "_cstyle266" -1 211 "" 0 1 0 0 0 0 0 1 0 2 2 2 0 0 0 1 }{CSTYLE "_cstyle265" -1 212 "" 0 1 0 0 0 0 0 1 0 2 2 2 0 0 0 1 }{CSTYLE "_cstyle264" -1 213 "" 0 1 0 0 0 0 0 1 0 2 2 2 0 0 0 1 } {CSTYLE "_cstyle263" -1 214 "" 0 1 0 0 0 0 0 1 0 2 2 2 0 0 0 1 } {CSTYLE "_cstyle262" -1 215 "" 0 1 0 0 0 0 0 1 0 2 2 2 0 0 0 1 } {CSTYLE "_cstyle261" -1 216 "" 0 1 0 0 0 0 0 1 0 2 2 2 0 0 0 1 } {CSTYLE "2D Output" -1 20 "Times" 0 1 0 0 255 1 0 0 2 2 2 2 0 0 0 1 } {CSTYLE "_cstyle260" -1 217 "" 0 1 0 0 0 0 0 1 0 2 2 2 0 0 0 1 } {CSTYLE "2D Math Italic" -1 3 "Times" 0 1 0 0 0 0 1 0 2 2 2 2 0 0 0 1 }{CSTYLE "Popup" -1 31 "" 0 1 0 128 128 1 1 0 1 2 2 2 0 0 0 1 } {CSTYLE "2D Math Symbol 2" -1 218 "Times" 0 1 0 0 0 0 2 2 2 2 2 2 0 0 0 1 }{CSTYLE "Plot Text" -1 28 "" 1 8 0 0 0 0 0 0 0 2 2 2 0 0 0 1 } {CSTYLE "Help Notes" -1 37 "" 0 1 0 0 0 1 0 1 0 2 2 2 0 0 0 1 } {CSTYLE "Help Bold" -1 39 "Times" 1 12 0 0 0 0 0 1 0 2 2 2 0 0 0 1 } {CSTYLE "Help Menus" -1 36 "" 0 1 0 0 0 1 0 1 0 2 2 2 0 0 0 1 } {CSTYLE "_cstyle259" -1 219 "" 0 1 0 0 0 0 0 1 0 2 2 2 0 0 0 1 } {CSTYLE "_cstyle258" -1 220 "" 0 1 0 0 0 0 0 1 0 2 2 2 0 0 0 1 } {CSTYLE "_cstyle256" -1 221 "" 0 1 0 0 0 0 0 1 0 2 2 2 0 0 0 1 } {CSTYLE "2D Comment" -1 18 "Times" 0 1 0 0 0 0 0 0 2 2 2 2 0 0 0 1 } {CSTYLE "Help Variable" -1 25 "Courier" 0 1 0 0 0 1 2 2 0 2 2 2 0 0 0 1 }{CSTYLE "2D Math Bold Small" -1 10 "Times" 0 1 0 0 0 0 0 1 2 2 2 2 0 0 0 1 }{CSTYLE "Help Emphasized" -1 222 "" 0 1 0 0 0 0 1 2 0 2 2 2 0 0 0 1 }{CSTYLE "Prompt" -1 1 "Courier" 0 1 0 0 0 1 0 0 0 2 2 2 0 0 0 1 }{PSTYLE "_pstyle1" -1 201 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 1 2 2 2 2 1 0 0 1 }3 1 0 0 0 0 2 0 2 0 2 2 -1 1 }{CSTYLE "_cstyle1 " -1 223 "Times" 1 18 0 0 0 1 2 1 2 2 2 2 0 0 0 1 }{PSTYLE "_pstyle2" -1 202 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 0 0 1 }1 1 0 0 0 0 2 0 2 0 2 2 -1 1 }{CSTYLE "_cstyle2" -1 224 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 0 0 0 1 }{PSTYLE "_pstyle3" -1 203 1 {CSTYLE "" -1 -1 "Times" 1 18 0 0 0 1 2 1 2 2 2 2 1 0 0 1 }1 1 0 0 8 4 2 0 2 0 2 2 -1 1 }{CSTYLE "_cstyle3" -1 225 "Times" 1 18 0 0 0 1 2 1 2 2 2 2 0 0 0 1 }{CSTYLE "_cstyle4" -1 226 "Times" 1 12 0 0 0 1 2 1 2 2 2 2 0 0 0 1 }{CSTYLE "_cstyle5" -1 227 "Courier" 1 12 255 0 0 1 2 1 2 2 1 2 0 0 0 1 }{PSTYLE "_pstyle4" -1 204 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 0 0 1 }3 3 0 0 0 0 2 0 2 0 2 2 -1 1 }{CSTYLE "_cstyle6 " -1 228 "Times" 0 1 0 0 255 1 0 0 2 2 2 2 0 0 0 1 }{PSTYLE "_pstyle5" -1 205 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 0 0 1 } 3 1 0 0 0 0 2 0 2 0 2 2 -1 1 }{PSTYLE "_pstyle6" -1 206 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 2 2 2 0 0 0 1 }0 0 0 -1 -1 -1 1 0 1 0 2 2 -1 1 }} {SECT 0 {PARA 201 "" 0 "" {TEXT 223 15 "Newton's Method" }}{PARA 202 " " 0 "" {TEXT 224 559 "As discussed in class, Newton's method provides \+ an iterative process to find the solutions of equations that cannot be solved analytically. It gets a little cumbersome repeating the proces s with your calculator but a computer and software packages such as Ma ple, allow you to repeat these calculations and arrive at an approxima te solution very quickly. This is one topic in a branch of mathematics called Numerical Analysis. In fact, when you type in a command like \+ \"fsolve\" in Maple, it uses a routine based on the very process we wi ll explore in this lab." }}{SECT 1 {PARA 203 "" 0 "" {TEXT 225 58 "New ton's Method For Approximating The Roots of Polynomials" }}{EXCHG {PARA 202 "" 0 "" {TEXT 226 10 "Defintion:" }{TEXT 224 12 " a number \+ " }{XPPEDIT 18 0 "x[o];" "6#&%\"xG6#%\"oG" }{TEXT 224 1 " " }{TEXT 224 13 " is called a " }{TEXT 226 6 "root " }{TEXT 224 27 "of a func tion f(x) if f(" }{XPPEDIT 18 0 "x[o];" "6#&%\"xG6#%\"oG" }{TEXT 224 1 " " }{TEXT 224 7 ") = 0. " }}{PARA 202 "" 0 "" {TEXT 224 107 "Wh en we are seeking the root of a function, we are trying to find a valu e where the function equals zero. " }}{PARA 202 "" 0 "" {TEXT 224 12 "Let f(t) = " }{XPPEDIT 18 0 "t^3+t-1;" "6#,(*$%\"tG\"\"$\"\"\"F%F'F' !\"\"" }{TEXT 224 1 " " }{TEXT 224 232 " . From the graph below we se e that f(t) = 0 at only one place: near x = 0.7. We will approximate the exact value of this root using Newton's method. First, define th e function and plot it to obtain a first guess at the root. " }}} {EXCHG {PARA 202 "> " 0 "" {MPLTEXT 1 227 22 "f := t -> t^3 + t - 1;" }}{PARA 204 "" 1 "" {XPPMATH 20 "6#>I\"fG6\"f*6#I\"tGF%F%6$I)operatorG F%I&arrowGF%F%,(*$9$\"\"$\"\"\"F.F0!\"\"F0F%F%F%" }{TEXT 228 1 " " }}} {EXCHG {PARA 202 "> " 0 "" {MPLTEXT 1 227 22 "plot(f(t), t = -1..1);" }}{PARA 205 "" 1 "" {GLPLOT2D 400 300 300 {PLOTDATA 2 "6&-%'CURVESG6$7 S7$$!\"\"\"\"!$!\"$F*7$$!3ommm;p0k&*!#=$!3a1DU38CJG!#<7$$!3wKL$3F37$$!3[++](y$pZiF0$!3GUW=W)R'o=F37$$!33LLL$yaE\"eF0$!3CK:f( Qdwx\"F37$$!3hmmm\">s%HaF0$!3/KodVN+.I/WnY i\"F37$$!39+++]_&\\c%F0$!3%)ok[*yB;b\"F37$$!31+++]1aZTF0$!3#*4;#oW+h[ \"F37$$!3umm;/#)[oPF0$!33>ND=qOI9F37$$!3hLLL$=exJ$F0$!3ow$yd5'Ho8F37$$ !3*RLLLtIf$HF0$!3%QkvR))**)=8F37$$!3]++]PYx\"\\#F0$!33P52X([YE\"F37$$! 3EMLLL7i)4#F0$!3\"o*RA%*[5>7F37$$!3c****\\P'psm\"F0$!3OiY&*>;Or6F37$$! 3')****\\74_c7F0$!3I_KwUfjF6F37$$!3)3LLL3x%z#)!#>$!3UN6%oKiL3\"F37$$!3 KMLL3s$QM%Fer$!3FiugN._V5F37$$!3]^omm;zr)*!#@$!39&pG,=()4+\"F37$$\"3%p JL$ezw5VFer$!3!RG5i9A\"o&*F07$$\"3s*)***\\PQ#\\\")Fer$!3Ou#ziCk'z\"*F0 7$$\"3GKLLe\"*[H7F0$!3gI$4wMD>v)F07$$\"3I*******pvxl\"F0$!3iDk:s\\m'H) F07$$\"3#z****\\_qn2#F0$!3UtYbk)eO$yF07$$\"3U)***\\i&p@[#F0$!3;t4)o&)* *[O(F07$$\"3B)****\\2'HKHF0$!3\\4cCWXd:oF07$$\"3ElmmmZvOLF0$!3QhS;9Kt \"H'F07$$\"3i******\\2goPF0$!3/$f)f?$php&F07$$\"3UKL$eR<*fTF0$!3-2^vGD @?^F07$$\"3m******\\)Hxe%F0$!3'yL&)G[ymW%F07$$\"3ckm;H!o-*\\F0$!3Ijr[^ n,nPF07$$\"3y)***\\7k.6aF0$!3IYMT)=\\Y+$F07$$\"3#emmmT9C#eF0$!3K!)\\wA uv.AF07$$\"33****\\i!*3`iF0$!3;ga!H!H)=I\"F07$$\"3%QLLL$*zym'F0$!3;Rv$ R?\"RvOFer7$$\"3wKLL3N1#4(F0$\"3!Q)\\4Mc%=f'Fer7$$\"3Nmm;HYt7vF0$\"3Gm F'\\#3,` " 0 "" {MPLTEXT 1 227 9 "t1 := .7:" }}}{EXCHG {PARA 202 "" 0 "" {TEXT 224 38 "Now we define the iteration \+ function, " }}}{EXCHG {PARA 202 "> " 0 "" {MPLTEXT 1 227 45 "newton := t -> t - (t^3 + t - 1)/(3*t^2 + 1):" }}}{EXCHG {PARA 202 "" 0 "" {TEXT 224 62 "and plug in our first guess. The result is our second gu ess. " }}}{EXCHG {PARA 202 "> " 0 "" {MPLTEXT 1 227 17 "t2 := newton( t1);" }}{PARA 204 "" 1 "" {XPPMATH 20 "6#>I#t2G6\"$\"+J4\"f#o!#5" } {TEXT 228 1 " " }}}{EXCHG {PARA 202 "" 0 "" {TEXT 224 16 "Now keep goi ng. " }}}{EXCHG {PARA 202 "> " 0 "" {MPLTEXT 1 227 17 "t3 := newton(t2 );" }}{PARA 204 "" 1 "" {XPPMATH 20 "6#>I#t3G6\"$\"+I'yK#o!#5" }{TEXT 228 1 " " }}}{EXCHG {PARA 202 "> " 0 "" {MPLTEXT 1 227 17 "t4 := newto n(t3);" }}{PARA 204 "" 1 "" {XPPMATH 20 "6#>I#t4G6\"$\"+Q!yK#o!#5" } {TEXT 228 1 " " }}}{EXCHG {PARA 202 "> " 0 "" {MPLTEXT 1 227 17 "t5 := newton(t4);" }}{PARA 204 "" 1 "" {XPPMATH 20 "6#>I#t5G6\"$\"+Q!yK#o!# 5" }{TEXT 228 1 " " }}}{EXCHG {PARA 202 "" 0 "" {TEXT 224 367 "Notice \+ we have had no change in the first 10 decimal places between t4 and t5 so this is our approximation to the solution. It can be assumed then that the error in this appoximation is less than 10^(-9) or 0.0000000 01. That's pretty close. As a check, you can plug your approximation into the original equation and this should result in a number close t o zero. " }}}{EXCHG {PARA 202 "> " 0 "" {MPLTEXT 1 227 6 "f(t5);" }} {PARA 204 "" 1 "" {XPPMATH 20 "6#$!\"\"!#5" }{TEXT 228 1 " " }}} {EXCHG {PARA 202 "" 0 "" {TEXT 224 81 "This is pretty close to zero. L et's see what Maple gives us for this solution. " }}}{EXCHG {PARA 202 "> " 0 "" {MPLTEXT 1 227 27 "sol := fsolve(f(t) = 0, t);" }}{PARA 204 "" 1 "" {XPPMATH 20 "6#>I$solG6\"$\"+Q!yK#o!#5" }{TEXT 228 1 " " } }}{EXCHG {PARA 202 "" 0 "" {TEXT 224 195 "This is the same number we f ound. Maple basically does the same sequence of calculations performe d above in a program called \"fsolve\". A sequence of calculations li ke this is referred to as an " }{TEXT 226 9 "algorithm" }{TEXT 224 29 " and every step is called an " }{TEXT 226 11 "iteration. " }{TEXT 224 141 " If we want a better approximation using Newton's method, we \+ need to increase the accuracy of our calculuations as shown in the nex t example." }}}}{SECT 1 {PARA 203 "" 0 "" {TEXT 225 28 "Newton's Metho d to Evaluate " }{XPPEDIT 18 0 "Pi;" "6#%#PiG" }{TEXT 225 1 " " } {TEXT 225 3 " " }}{EXCHG {PARA 202 "" 0 "" {TEXT 224 57 "This little program finds the numerical approximation to " }{XPPEDIT 18 0 "Pi;" " 6#%#PiG" }{TEXT 224 1 " " }{TEXT 224 78 " by solving the equation sin \+ x = 0, by Newton's method near the solution x = " }{XPPEDIT 18 0 "Pi; " "6#%#PiG" }{TEXT 224 1 " " }{TEXT 224 64 ". This may seem redundant as we can request Maple to do this by" }}}{EXCHG {PARA 202 "> " 0 "" {MPLTEXT 1 227 13 "evalf(Pi,16);" }}{PARA 204 "" 1 "" {XPPMATH 20 "6#$ \"1$z*e`EfTJ!#:" }{TEXT 228 1 " " }}}{EXCHG {PARA 202 "" 0 "" {TEXT 224 177 "This is Maple's numerical estimation to 16 digits, and we'll \+ see if we can recreate this calculation using Newton's Method. I will define some of the parameters in the program:" }}}{EXCHG {PARA 202 "" 0 "" {TEXT 224 1 "\"" }{TEXT 226 1 "N" }{TEXT 224 26 "\" defines the \+ Newton step " }{XPPEDIT 18 0 "x[n+1];" "6#&%\"xG6#,&%\"nG\"\"\"F(F(" } {TEXT 224 1 " " }{TEXT 224 5 " = N(" }{XPPEDIT 18 0 "x[n];" "6#&%\"xG6 #%\"nG" }{TEXT 224 1 " " }{TEXT 224 72 "), by N(x) = x - f(x)/f'(x). \+ With f(x) = sin x and f'(x) = cos(x). " }}}{EXCHG {PARA 202 "" 0 " " {TEXT 224 1 "\"" }{TEXT 226 9 "tolerance" }{TEXT 224 32 "\" is how c lose to the solution (" }{XPPEDIT 18 0 "Pi;" "6#%#PiG" }{TEXT 224 1 " \+ " }{TEXT 224 89 ") we want to get. It should be noted that we can't re ally measure the difference between " }{XPPEDIT 18 0 "x[n];" "6#&%\"xG 6#%\"nG" }{TEXT 224 1 " " }{TEXT 224 5 " and " }{XPPEDIT 18 0 "Pi;" "6 #%#PiG" }{TEXT 224 1 " " }{TEXT 224 84 " because this would be cheatin g. Recall, it is our goal to numerically approximate " }{XPPEDIT 18 0 "Pi;" "6#%#PiG" }{TEXT 224 1 " " }{TEXT 224 82 " by the solution of \+ our equation sin(x) = 0. So to compare our approximations to " } {XPPEDIT 18 0 "Pi;" "6#%#PiG" }{TEXT 224 1 " " }{TEXT 224 407 " is rea lly using the answer to find out how close to the answer we are. Do y ou get the contradiction here? Therefore we will measure the differe nce between consecutive approximations and make sure this is less than the tolerance. In this case we set \"tolerance\" to 10^(-16) = .0000 000000000001. Using this tolerance, we can assume our resulting approx imation is withing 10^(-15) of the exact solution. " }}}{EXCHG {PARA 202 "" 0 "" {TEXT 224 87 "In the program we will calculate the differe nce between consecutive approximations by \"" }{TEXT 226 10 "differenc e" }{TEXT 224 119 "\" and compare it to \"tolerance\". But to start w e must assign an unacceptable value to \"difference\" by difference = \+ 1. " }}}{EXCHG {PARA 202 "" 0 "" {TEXT 224 152 "In case the iterations fail to converge, we want a safeguard against an infinite loop. We d o this by setting a maximum on the number of iterations by \"" }{TEXT 226 13 "maxiterations" }{TEXT 224 87 "\". If we iterate more than 20 t imes we will set \"tolerance\" = 0 which exits the loop. " }}}{EXCHG {PARA 202 "" 0 "" {TEXT 224 35 "We will count the iterations with \"" }{TEXT 226 1 "n" }{TEXT 224 73 "\". We initialize the value to one and increase it by one with each step. " }}}{EXCHG {PARA 202 "" 0 "" {TEXT 224 115 "Finally, before starting the iterations, we make an ini tial guess at our solution. Since we want the solution near " } {XPPEDIT 18 0 "Pi;" "6#%#PiG" }{TEXT 224 1 " " }{TEXT 224 28 " we make an intial guess of " }{XPPEDIT 18 0 "x[1];" "6#&%\"xG6#\"\"\"" } {TEXT 224 1 " " }{TEXT 224 7 " = 3. " }}}{EXCHG {PARA 202 "" 0 "" {TEXT 224 55 "Now we run the iterations until the difference between " }{XPPEDIT 18 0 "x[n+1];" "6#&%\"xG6#,&%\"nG\"\"\"F(F(" }{TEXT 224 1 " " }{TEXT 224 5 " and " }{XPPEDIT 18 0 "x[n];" "6#&%\"xG6#%\"nG" } {TEXT 224 1 " " }{TEXT 224 164 " is less than \"tolerance\" or \"n\" i s greater than \"maxiterations\". In the former case we have a soluti on in the latter we have avoided a potential runaway program. " }}} {EXCHG {PARA 202 "" 0 "" {TEXT 224 1 "\"" }{TEXT 226 5 "tempx" }{TEXT 224 14 "\" is actually " }{XPPEDIT 18 0 "x[n+1];" "6#&%\"xG6#,&%\"nG\" \"\"F(F(" }{TEXT 224 1 " " }{TEXT 224 283 ". We save it as a temporar y x value to check the difference between x and tempx, if we are not c lose enough we then assign x the value of tempx, contiunuing until dif ference is less than tolerance or iterations is greater than 20. The \+ final value of x is then our approximation to " }{XPPEDIT 18 0 "Pi;" " 6#%#PiG" }{TEXT 224 1 " " }{TEXT 224 1 "." }}}{EXCHG {PARA 202 "" 0 "" {TEXT 224 205 "If you type this in yourself you should press \"shift \" and \"enter\" at the same time to avoid evaluating the current inpu t. Also, the colon's (as opposed to semicolons) prevent the printing o f each result. " }}}{EXCHG {PARA 202 "> " 0 "" {MPLTEXT 1 227 35 "N : = x -> x - sin(x)/cos(x): # " }{MPLTEXT 1 224 25 "Defines the Newt on step " }{MPLTEXT 1 227 36 "\ntolerance := 10^(-16): # " }{MPLTEXT 1 224 24 "Sets the tolerance level" }{MPLTEXT 1 227 36 "\ndi fference := 1: # " }{MPLTEXT 1 224 36 "Initializes the value for difference" }{MPLTEXT 1 227 36 "\nmaxiterations := 20: \+ # " }{MPLTEXT 1 224 23 "Maximum number of steps" }{MPLTEXT 1 227 36 "\nn := 1: # " }{MPLTEXT 1 224 12 "ste p number " }{MPLTEXT 1 227 36 "\nx := 3: # " }{MPLTEXT 1 224 13 "initial guess" }{MPLTEXT 1 227 2 " " }{MPLTEXT 1 227 35 "\nwhile difference > tolerance #" }{MPLTEXT 1 224 51 " ke ep doing the below while difference > tolerance" }{MPLTEXT 1 227 35 " \ndo #" }{MPLTEXT 1 224 32 " what to do in the \"while\" loop" }{MPLTEXT 1 227 35 "\n tempx := evalf(N(x),16 ): #" }{MPLTEXT 1 224 20 " Newton's step for " }{XPPEDIT 18 0 " x[n+1];" "6#&%\"xG6#,&%\"nG\"\"\"F(F(" }{MPLTEXT 1 224 1 " " } {MPLTEXT 1 224 1 " " }{MPLTEXT 1 227 45 "\n difference := evalf(abs(t empx - x),16): #" }{MPLTEXT 1 224 20 " difference between " } {XPPEDIT 18 0 "x[n];" "6#&%\"xG6#%\"nG" }{MPLTEXT 1 224 1 " " } {MPLTEXT 1 224 5 " and " }{XPPEDIT 18 0 "x[n+1];" "6#&%\"xG6#,&%\"nG\" \"\"F(F(" }{MPLTEXT 1 224 1 " " }{MPLTEXT 1 227 35 "\n n := n + 1: \+ #" }{MPLTEXT 1 224 14 " add one to n" }{MPLTEXT 1 227 35 "\n if (n < maxiterations) #" }{MPLTEXT 1 224 48 " ch eck to see if we've done too many iterations" }{MPLTEXT 1 227 35 "\n \+ then x := tempx: #" }{MPLTEXT 1 224 14 " If not, set " }{XPPEDIT 18 0 "x[n+1];" "6#&%\"xG6#,&%\"nG\"\"\"F(F(" }{MPLTEXT 1 224 1 " " }{MPLTEXT 1 224 3 " = " }{XPPEDIT 18 0 "x[n];" "6#&%\"xG6#% \"nG" }{MPLTEXT 1 224 1 " " }{MPLTEXT 1 224 1 " " }{MPLTEXT 1 227 35 " \n else difference = 0: #" }{MPLTEXT 1 224 52 " If so, set difference = 0 (which exits while loop)" }{MPLTEXT 1 227 35 "\n \+ print('Failed'): #" }{MPLTEXT 1 224 22 " and print a messag e " }{MPLTEXT 1 227 35 "\n fi: #" } {MPLTEXT 1 224 25 " ends the \"if\" statement" }{MPLTEXT 1 227 1 " " }{MPLTEXT 1 227 35 "\n print(n): #" }{MPLTEXT 1 224 23 " print the step number" }{MPLTEXT 1 227 35 "\n print(evalf(x ,16)): #" }{MPLTEXT 1 224 8 " print " }{XPPEDIT 18 0 "x[n] ;" "6#&%\"xG6#%\"nG" }{MPLTEXT 1 224 1 " " }{MPLTEXT 1 227 35 "\nod: \+ #" }{MPLTEXT 1 224 23 " ends the \"while \" loop" }}{PARA 204 "" 1 "" {XPPMATH 20 "6#\"\"#" }{TEXT 228 1 " " }} {PARA 204 "" 1 "" {XPPMATH 20 "6#$\"1yU2VlaUJ!#:" }{TEXT 228 1 " " }} {PARA 204 "" 1 "" {XPPMATH 20 "6#\"\"$" }{TEXT 228 1 " " }}{PARA 204 " " 1 "" {XPPMATH 20 "6#$\"1x/I`EfTJ!#:" }{TEXT 228 1 " " }}{PARA 204 "" 1 "" {XPPMATH 20 "6#\"\"%" }{TEXT 228 1 " " }}{PARA 204 "" 1 "" {XPPMATH 20 "6#$\"1$z*e`EfTJ!#:" }{TEXT 228 1 " " }}{PARA 204 "" 1 "" {XPPMATH 20 "6#\"\"&" }{TEXT 228 1 " " }}{PARA 204 "" 1 "" {XPPMATH 20 "6#$\"1$z*e`EfTJ!#:" }{TEXT 228 1 " " }}}{EXCHG {PARA 202 "" 0 "" {TEXT 224 146 "Notice it only took 5 iterations until the difference b etween approximations was less than 10^(-15) and this agrees with Mapl e's approximation to " }{XPPEDIT 18 0 "Pi;" "6#%#PiG" }{TEXT 224 1 " " }{TEXT 224 51 " for 16 digits. As a further check, evaluate f(x):" } }}{EXCHG {PARA 202 "> " 0 "" {MPLTEXT 1 227 7 "sin(x);" }}{PARA 204 "" 1 "" {XPPMATH 20 "6#$\"+Mki%Q#!#D" }{TEXT 228 1 " " }}}{EXCHG {PARA 202 "" 0 "" {TEXT 224 58 "That's pretty close to zero, but not exactly . Why not? " }}}}{SECT 1 {PARA 203 "" 0 "" {TEXT 225 13 "Assignment . " }}{PARA 202 "" 0 "" {TEXT 224 101 "There are no graphs necessary \+ for this problem. However a graph might be useful to answer # 2.b(iii) ." }}{EXCHG {PARA 202 "" 0 "" {TEXT 226 13 "Problem #1: " }{TEXT 224 176 "Use the intermediate value thereom to prove there is a number tha t is exactly one more than it's cube and use Newton's method to find t his number correct to 9 decimal places. " }}{PARA 202 "" 0 "" }} {EXCHG {PARA 202 "" 0 "" {TEXT 226 14 "Problem #2: " }{TEXT 224 115 "Use Newton's method to find the solution to sin(x) given the followin g initial guesses. Then answer the questions. " }}{PARA 202 "" 0 "" {TEXT 226 2 "a)" }{TEXT 224 25 " initial guess = 0.2 " }}{PARA 202 "" 0 "" {TEXT 224 64 " (i) What solution to sin(x) = 0 is the \+ algorithm finding. " }}{PARA 202 "" 0 "" {TEXT 224 117 " (ii) How many iterations does it take before there is no change in the approx imations' first 15 decimal places?" }}{PARA 202 "" 0 "" }{PARA 202 "" 0 "" {TEXT 226 1 "b" }{TEXT 224 26 ") initial guess = 1.58079" }} {PARA 202 "" 0 "" {TEXT 224 93 " (i) What solution to sin(x) = 0 i s the algorithm finding. Give this answer in terms of " }{XPPEDIT 18 0 "Pi" "6#%#PiG" }{TEXT 224 1 " " }{TEXT 224 4 ". " }}{PARA 202 "" 0 "" {TEXT 224 117 " (ii) How many iterations does it take before \+ there is no change in the approximations' first 15 decimal places?" }} {PARA 202 "" 0 "" {TEXT 224 39 " (iii) Why is this number so large? " }}}}{PARA 206 "" 0 "" }}{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 } {PAGENUMBERS 0 1 2 33 1 1 }