764: Numercal Analyss Topc : Soluton o Nonlnear Equatons Lectures 5-: UIN Malang Read Chapters 5 and 6 o the tetbook 764_Topc
Lecture 5 Soluton o Nonlnear Equatons Root Fndng Problems Dentons Classcaton o Methods Analytcal Solutons Graphcal Methods Numercal Methods Bracketng Methods Open Methods Convergence Notatons Readng Assgnment: Sectons 5. and 5. 764_Topc
Root Fndng Problems Many problems n Scence and Engneerng are epressed as: Gven a nd the value contnuous r uncton such that r, These problems are called root ndng problems. 764_Topc 3
Roots o Equatons A number r that satses an equaton s called a root o the equaton. The has our.e., equaton : 4 roots:, 3 3 7 4 3 3, 3 5 7 3, and 8 5. 8 3 The equaton has twosmple roots and and a repeated root 3 wth multplcty. 764_Topc 4
Zeros o a Functon Let be a real-valued uncton o a real varable. Any number r or whch r= s called a zero o the uncton. Eamples: and 3 are zeros o the uncton = --3. 764_Topc 5
Graphcal Interpretaton o Zeros The real zeros o a uncton are the values o at whch the graph o the uncton crosses or touches the -as. Real zeros o 764_Topc 6
Smple Zeros has twosmple zeros one at and one at 764_Topc 7
Multple Zeros has double zeros zero wth mulplcty at 764_Topc 8
Multple Zeros 3 3 has a zero wth mulplcty 3 at 764_Topc 9
Facts Any n th order polynomal has eactly n zeros countng real and comple zeros wth ther multplctes. Any polynomal wth an odd order has at least one real zero. I a uncton has a zero at =r wth multplcty m then the uncton and ts rst m- dervatves are zero at =r and the m th dervatve at r s not zero. 764_Topc
Roots o Equatons & Zeros o Functon Gven theequaton : 3 Moveall terms to one sde o the equaton : 3 Dene as : 4 4 3 3 7 7 4 3 5 5 8 3 7 8 5 8 The zeros o are thesame as the rootso theequaton Whch are, 3, 3, and 764_Topc
Soluton Methods Several ways to solve nonlnear equatons are possble: Analytcal Solutons Possble or specal equatons only Graphcal Solutons Useul or provdng ntal guesses or other methods Numercal Solutons Open methods Bracketng methods 764_Topc
Analytcal Methods Analytcal Solutons are avalable or specal equatons only. Analytcal soluton o : a b c roots b b a 4ac No analytcal soluton s avalable or : e 764_Topc 3
Graphcal Methods Graphcal methods are useul to provde an ntal guess to be used by other methods. Solve e The root [,] e Root root.6 764_Topc 4
Numercal Methods Many methods are avalable to solve nonlnear equatons: Bsecton Method Newton s Method Secant Method False poston Method Muller s Method Barstow s Method Fed pont teratons. These wll be covered n 764 764_Topc 5
Bracketng Methods In bracketng methods, the method starts wth an nterval that contans the root and a procedure s used to obtan a smaller nterval contanng the root. Eamples o bracketng methods: Bsecton method False poston method 764_Topc 6
Open Methods In the open methods, the method starts wth one or more ntal guess ponts. In each teraton, a new guess o the root s obtaned. Open methods are usually more ecent than bracketng methods. They may not converge to a root. 764_Topc 7
Convergence Notaton A sequence,,..., n,... s sad toconverge to every there ests N such that : to n n N 764_Topc 8
764_Topc 9 Convergence Notaton C P C C p n n n n n n : order Convergenc e o Quadratc Convergenc e : Lnear Convergenc e :. to converge,...,, Let
Speed o Convergence We can compare derent methods n terms o ther convergence rate. Quadratc convergence s aster than lnear convergence. A method wth convergence order q converges aster than a method wth convergence order p q>p. Methods o convergence order p> are sad to have super lnear convergence. 764_Topc
Lectures 6-7 Bsecton Method The Bsecton Algorthm Convergence Analyss o Bsecton Method Eamples Readng Assgnment: Sectons 5. and 5. 764_Topc
Introducton The Bsecton method s one o the smplest methods to nd a zero o a nonlnear uncton. It s also called nterval halvng method. To use the Bsecton method, one needs an ntal nterval that s known to contan a zero o the uncton. The method systematcally reduces the nterval. It does ths by dvdng the nterval nto two equal parts, perorms a smple test and based on the result o the test, hal o the nterval s thrown away. The procedure s repeated untl the desred nterval sze s obtaned. 764_Topc
Intermedate Value Theorem Let be dened on the nterval [a,b]. Intermedate value theorem: a uncton s contnuous and a and b have derent sgns then the uncton has at least one zero n the nterval [a,b]. a a b b 764_Topc 3
Eamples I a and b have the same sgn, the uncton may have an even number o real zeros or no real zeros n the nterval [a, b]. Bsecton method can not be used n these cases. a The uncton has our real zeros b a The uncton has no real zeros b 764_Topc 4
Two More Eamples I a and b have derent sgns, the uncton has at least one real zero. a b Bsecton method can be used to nd one o the zeros. The uncton has one real zero a b The uncton has three real zeros 764_Topc 5
Bsecton Method I the uncton s contnuous on [a,b] and a and b have derent sgns, Bsecton method obtans a new nterval that s hal o the current nterval and the sgn o the uncton at the end ponts o the nterval are derent. Ths allows us to repeat the Bsecton procedure to urther reduce the sze o the nterval. 764_Topc 6
Bsecton Method Assumptons: Gven an nterval [a,b] s contnuous on [a,b] a and b have opposte sgns. These assumptons ensure the estence o at least one zero n the nterval [a,b] and the bsecton method can be used to obtan a smaller nterval that contans the zero. 764_Topc 7
Bsecton Algorthm Assumptons: s contnuous on [a,b] a b < Algorthm: Loop. Compute the md pont c=a+b/. Evaluate c 3. I a c < then new nterval [a, c] I a c > then new nterval [c, b] End loop a a c b b 764_Topc 8
Bsecton Method b a a a 764_Topc 9
Eample + + - + - - + + - 764_Topc 3
Flow Chart o Bsecton Method Start: Gven a,b and ε u = a ; v = b c = a+b / ; w = c no yes s u w < no s b-a /<ε yes Stop b=c; v= w a=c; u= w 764_Topc 3
764_Topc 3 Eample Answer: [,]? nterval n the 3 : o zero a nd to method Bsecton you use Can 3 used be not can method Bsecton satsed not are Assumptons 3 3 and * [,] on contnuous s
764_Topc 33 Eample Answer: [,]? nterval n the 3 : o zero a nd to method Bsecton you use Can 3 used be can method Bsecton satsed are Assumptons - * and [,] on contnuous s
Best Estmate and Error Level Bsecton method obtans an nterval that s guaranteed to contan a zero o the uncton. Questons: What s the best estmate o the zero o? What s the error level n the obtaned estmate? 764_Topc 34
Best Estmate and Error Level The best estmate o the zero o the uncton ater the rst teraton o the Bsecton method s the md pont o the ntal nterval: Estmate o the zero : r b a Error b a 764_Topc 35
Stoppng Crtera Two common stoppng crtera. Stop ater a ed number o teratons. Stop when the absolute error s less than a speced value How are these crtera related? 764_Topc 36
Stoppng Crtera c n : s the mdpont o the nterval at the n th teraton c n s usually used as the estmate o the root. r : s the zero o the uncton. Ater n teratons : error r -c n E n a b a n n 764_Topc 37
Convergence Analyss Gven, a, b, and How many teratons are needed such that : - r where r s the zero o and s the bsecton estmate.e., c k? log b a log n log 764_Topc 38
Convergence Analyss Alternatve Form log b a log n log wdth o ntal nterval n log log desred error b a 764_Topc 39
Eample a 6, b 7,.5 How many teratons are needed such that : - r? n log b a log log log log.5 log.9658 n 764_Topc 4
Eample Use Bsecton method to nd a root o the equaton = cos wth absolute error <. assume the ntal nterval [.5,.9] Queston : What s? Queston : Are the assumptons satsed? Queston 3: How many teratons are needed? Queston 4: How to compute the new estmate? 764_Topc 4
764_Topc 4
Bsecton Method Intal Interval a=-.3776 b =.784 a =.5 c=.7 b=.9 Error <. 764_Topc 43
Bsecton Method -.3776 -.648.784.5.7.9 Error <. -.648.33.784.7.8.9 Error <.5 764_Topc 44
Bsecton Method -.648.83.33.7.75.8 Error <.5 -.648 -.35.83.7.75.75 Error <.5 764_Topc 45
Summary Intal nterval contanng the root: [.5,.9] Ater 5 teratons: Interval contanng the root: [.75,.75] Best estmate o the root s.7375 Error <.5 764_Topc 46
A Matlab Program o Bsecton Method a=.5; b=.9; u=a-cosa; v=b-cosb; or =:5 c=a+b/ c=c-cosc u*c< b=c ; v=c; else a=c; u=c; end end c =.7 c = -.648 c =.8 c =.33 c =.75 c =.83 c =.75 c = -.35 764_Topc 47
Eample Fnd the root o: 3 3 n the nterval :[,] * s contnuous *, a b Bsecton method can be used to nd the root 764_Topc 48
Eample Iteraton a b c= a+b c b-a.5 -.375.5.5.5.66.5 3.5.5.375-7.3E-3.5 4.5.375.35 9.3E-.65 5.35.375.34375 9.37E-3.35 764_Topc 49
Bsecton Method Advantages Smple and easy to mplement One uncton evaluaton per teraton The sze o the nterval contanng the zero s reduced by 5% ater each teraton The number o teratons can be determned a pror No knowledge o the dervatve s needed The uncton does not have to be derentable Dsadvantage Slow to converge Good ntermedate appromatons may be dscarded 764_Topc 5
Lecture 8-9 Newton-Raphson Method Assumptons Interpretaton Eamples Convergence Analyss 764_Topc 5
Newton-Raphson Method Also known as Newton s Method Gven an ntal guess o the root, Newton-Raphson method uses normaton about the uncton and ts dervatve at that pont to nd a better guess o the root. Assumptons: s contnuous and the rst dervatve s known An ntal guess such that s gven 764_Topc 5
Newton Raphson Method - Graphcal Depcton - I the ntal guess at the root s, then a tangent to the uncton o that s s etrapolated down to the -as to provde an estmate o the root at +. 764_Topc 53
Dervaton o Newton s Method Gven: Queston Taylor Therorem : Fnd h h : ' A new guess an ntal How do we obtan a such that o guess the root : o h h the root o. better estmate ' h ' Newton Raphson Formula? 764_Topc 54
764_Topc 55 Newton s Method end :n or Assumputon Gven ' ', ', END STOP CONTINUE X PRINT X FP X F X X I DO X X X X FP X X X F PROGRAM FORTRAN C *, /,5 4 6* ** 3* ** 3* **3
764_Topc 56 Newton s Method end n or Assumputon Gven ' : ', ', end X FP X F X X or X PROGRAM MATLAB / :5 4 % X X FP X FP FP uncton X X F X F F uncton 6* ^ 3* ] [ ^ 3* ^3 ] [ F.m FP.m
764_Topc 57 Eample.3 9.74.369.4375 ' Iteraton 3:.4375 6 9 3 ' Iteraton : 3 33 33 4 ' : Iteraton 4 3 ' 4, 3 the uncton zero o Fnd a 3 3
Eample k Iteraton k k k k+ k+ k 4 33 33 3 3 9 6.4375.565.4375.369 9.74.3.45 3.3.564 6.844.756.384 4.756.65 6.4969.746. 764_Topc 58
Convergence Analyss Theorem : Let where, such that C r ma ' and -r mn -r -r. I '' ' '' 'r k k -r be contnuous at r -r then thereests C 764_Topc 59
Convergence Analyss Remarks When the guess s close enough to a smple root o the uncton then Newton s method s guaranteed to converge quadratcally. Quadratc convergence means that the number o correct dgts s nearly doubled at each teraton. 764_Topc 6
Problems wth Newton s Method I the ntal guess o the root s ar rom the root the method may not converge. Newton s method converges lnearly near multple zeros { r = r = }. In such a case, moded algorthms can be used to regan the quadratc convergence. 764_Topc 6
Multple Roots 3 has three zeros at has zeros at two - 764_Topc 6
Problems wth Newton s Method - Runaway - The estmates o the root s gong away rom the root. 764_Topc 63
Problems wth Newton s Method - Flat Spot - The value o s zero, the algorthm als. I s very small then wll be very ar rom. 764_Topc 64
Problems wth Newton s Method - Cycle - = 3 = 5 = = 4 The algorthm cycles between two values and 764_Topc 65
764_Topc 66 Newton s Method or Systems o Non Lnear Equatons ',,...,,..., ' ' the root o o guess an ntal : X F X F X F X F X X Iteraton s Newton F X Gven k k k k
764_Topc 67 Eample Solve the ollowng system o equatons:, guess Intal 5 5 y y y. y, 5 5 ', 5 5 X y F y y. y F
764_Topc 68 Soluton Usng Newton s Method.6.33 -.5.65 7.5.5.5.5.5 7.5.5.5 ', -.5.65 : Iteraton.5.5 5 6 6 5 5 ', 5 5 5 : Iteraton X F F. X y F. y y. y F
764_Topc 69 Eample Try ths Solve the ollowng system o equatons:, guess Intal y y y y, 4 ', X y F y y y F
764_Topc 7 Eample Soluton.98.557.98.557.969.587..6 5 4 3 X k Iteraton
Lectures Secant Method Secant Method Eamples Convergence Analyss 764_Topc 7
Newton s Method Revew Assumptons :, ', Newton' s Method new estmate : Problem : ' ' s not avalable, or dcult toobtan analytcally. ' are avalable, 764_Topc 7
764_Topc 73 Secant Method ' ponts: twontal are ' and h h
764_Topc 74 Secant Method New estmate Secant Method: ponts ntal Two Assumptons : that such and
764_Topc 75 Secant Method.5
764_Topc 76 Secant Method - Flowchart ;,, Stop NO Yes
764_Topc 77 Moded Secant Method the method may dverge. not selected properly, I? How to select Problem : ' needed : s guess only one ntal moded Secant method, ths In
Eample 5 Fnd the roots o : Intal ponts 5 and 3 3. 4 3 - wth error. - -3-4 - -.5 - -.5.5.5 764_Topc 78
Eample + +- -.. -.. -..585 -.6. 6 -.6. -.5.9 -.5. -.5. 764_Topc 79
Convergence Analyss The rate o convergence o the Secant method s super lnear: r r C,.6 r : root : estmate o the root at the th teraton. It s better than Bsecton method but not as good as Newton s method. 764_Topc 8
Lectures Comparson o Root Fndng Methods Advantages/dsadvantages Eamples 764_Topc 8
Summary Method Pros Cons Bsecton Newton Secant - Easy, Relable, Convergent - One uncton evaluaton per teraton - No knowledge o dervatve s needed - Fast near the root - Two uncton evaluatons per teraton - Fast slower than Newton - One uncton evaluaton per teraton - No knowledge o dervatve s needed - Slow - Needs an nterval [a,b] contanng the root,.e., ab< - May dverge - Needs dervatve and an ntal guess such that s nonzero - May dverge - Needs two ntal ponts guess, such that - s nonzero 764_Topc 8
764_Topc 83 Eample.5 ponts ntal Two : o root the nd to method Secant Use 6 and
Soluton k k k. -..5 8.896.56 -.76 3.836 -.4645 4.47.3 5.33 -.65 6.347 -.5 764_Topc 84
764_Topc 85 Eample.. or., or teratons, three ater Stop. pont : ntal the Use : o root a nd to Method Newton's Use 3 k k k
Fve Iteratons o the Soluton k k k k ERROR. -...5.875 5.75.5.3478.7 4.4499.6 3.35. 4.685.5 4.347. 4.646. 5.347. 4.646. 764_Topc 86
764_Topc 87 Eample.. or., or teratons, three ater Stop. pont : ntal Use the : o root a nd to Method Newton's Use k k k e
764_Topc 88 Eample -. -.567..567 -. -.567..567 -.9 -.584.46.5379.46 -.3679 -.63. ' ' ', : o root a nd to Method Newton's Use k k k k k e e
Eample Estmates o the root o: -cos=..6 Intal guess.74473944598 correct dgt.73994768864 4 correct dgts.739853347 correct dgts.739853356 4 correct dgts 764_Topc 89
Eample In estmatng the root o: -cos=, to get more than 3 correct dgts: 4 teratons o Newton =.8 43 teratons o Bsecton method ntal nterval [.6,.8] 5 teratons o Secant method =.6, =.8 764_Topc 9