CISE3: Numercal Methods Topc : Soluton o Nonlnear Equatons Dr. Amar Khoukh Term Read Chapters 5 and 6 o the tetbook CISE3_Topc c Khoukh_
Lecture 5 Soluton o Nonlnear Equatons Root ndng Problems Dentons Classcaton o methods Convergence Notatons CISE3_Topc c Khoukh_
Classcaton o methods CISE3_Topc c Khoukh_ 3
Root ndng Problems Many problems n Scence and Engneerng are epressed as Gven a contnuousuncton, nd thevalue r such that r These problems are called root ndng problems CISE3_Topc c Khoukh_ 4
Roots o Equatons A number r that satses an equaton s called a root o the equaton. Theequaton has our roots 4 3, 3, 3 7 3 and 5 8 So, one has 4 3 3 7 5 8 3 Theequaton has twosmpleroots and and a repeatedroot 3 wth multplcty CISE3_Topc c Khoukh_ 5
Zeros o a uncton 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 CISE3_Topc c Khoukh_ 6
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 CISE3_Topc c Khoukh_ 7
Smple Zeros has two smple zeros one at and one at CISE3_Topc c Khoukh_ 8
Multple Roots 3 has three zeros at - has zeros at two - s a zero o wth Multplcty = CISE3_Topc c Khoukh_ 9
Roots o Equatons & Zeros o uncton Gven theequaton 4 3 M oveall terms toone sde o theequaton 4 3 Dene as 4 3 3 3 3 7 7 7 5 8 5 5 8 8 The zeroso are thesame as the rootso theequaton Whch are, 3, 3 and zeros o the uncton are the roots o the equaton = CISE3_Topc c Khoukh_
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 CISE3_Topc c Khoukh_
Soluton Methods: Analytcal Solutons Analytcal Solutons are avalable or specal equatons only. Analytcalsolutono a b c roots b b a 4ac Noanalytcalsoluton s avalable or e CISE3_Topc c Khoukh_
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 CISE3_Topc c Khoukh_ 3
Graphcal Interpretaton o zeros Plot =sn.+cos3. over [ 5] More detaled pcture over [, 5] Several roots wth a possble double root at 4. appearng as tangent to the -as. More narrowed scale over [4.3, 4.6] CISE3_Topc c Khoukh_ 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 SE3 CISE3_Topc c Khoukh_ 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 CISE3_Topc c Khoukh_ 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 the a root. CISE3_Topc c Khoukh_ 7
Convergence Notaton A sequence,,..., n,... s sad toconverge to to every there est N such that n n N CISE3_Topc c Khoukh_ 8
CISE3_Topc c Khoukh_ 9 Convergence Notaton C C C p n n n n n n order p Convergence o QuadratcConvergence Lnear Convergence to converges,...,, 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. A Method o convergence order p> are sad to have super lnear convergence. CISE3_Topc c Khoukh_
Bsecton Method The Bsecton Algorthm Convergence Analyss o Bsecton Method Eamples Readng Assgnment: Sectons 5. and 5. CISE3_Topc c Khoukh_
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. Ths method needs an ntal nterval that s known to contan a zero o the uncton. Then ths nterval s systematcally reduced by dvdng t nto two equal parts. Based on a test on the product o the values o the uncton at nterval lmts, a hal o the nterval s thrown away. The procedure s repeated untl the desred nterval sze s obtaned. CISE3_Topc c Khoukh_
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 CISE3_Topc c Khoukh_ 3
Eamples I a and b have the same sgn, the uncton may have an even number o real zeros or no real zero 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 CISE3_Topc c Khoukh_ 4
Two more Eamples I a and b have derent sgns, the uncton has at least one real zero Bsecton method can be used to nd one o the zeros. a The uncton has one real zero b a b The uncton has three real zeros CISE3_Topc c Khoukh_ 5
Bsecton Method Assumptons: Gven an nterval [a,b] s contnuous on [a,b] a and b have opposte sgns. These assumptons ensures 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. CISE3_Topc c Khoukh_ 6
Bsecton Algorthm Assumptons: s contnuous on [a,b] a b < a 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 c b b CISE3_Topc c Khoukh_ 7
Bsecton Method b a a a CISE3_Topc c Khoukh_ 8
Eample + + - + - - + + - CISE3_Topc c Khoukh_ 9
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 CISE3_Topc c Khoukh_ 3
Eample Can youuse Bsectonmethod tonda zeroo 3 Answer: 3 n thenterval[,]? s * contnuouson [,] 3 Assumptons are not satsed Bsecton method can not be used 3 CISE3_Topc c Khoukh_ 3
Eample: Can youuse Bsectonmethod tonda zeroo 3 3 n thenterval[,]? Answer: s * contnuouson [,] Assumptons are - satsed Bsecton method can be used CISE3_Topc c Khoukh_ 3
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? CISE3_Topc c Khoukh_ 33
Best Estmate and error level The best estmate o the zero o the uncton s the md pont o the last nterval generated by the Bsecton method. Estmate o the zero r b a Error b a CISE3_Topc c Khoukh_ 34
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 these crtera are related? CISE3_Topc c Khoukh_ 35
Stoppng Crtera c r n s themdpont o thentervalat then th teraton c n s usually used as the estmateo theroot. s thezeroo the uncton Ater n teratons error r -c n b a n CISE3_Topc c Khoukh_ 36
Convergence Analyss Gven, a, b and How many teratonsare needed such that where r s thezeroo and s the bsecton estmate.e. c k - r log b a log n log CISE3_Topc c Khoukh_ 37
Convergence Analyss Alternatve orm Gven How many where r, s a, b thezeroo bsecton estmate and teratonsare needed such that.e. and s c k the - r n wdth o ntal nterval log log wdth o desred nterval b a CISE3_Topc c Khoukh_ 38
Eample a 6, b 7,.5 How many teratons are needed such that - r CISE3_Topc c Khoukh_ 39
Eample a 6, b 7,.5 How many teratonsare needed such that - r n log b a log log log log. log 9.9658 n CISE3_Topc c Khoukh_ 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? CISE3_Topc c Khoukh_ 4
CISE3_Topc c Khoukh_ 4
Bsecton Method Intal Interval a=-.3776 b =.784 a =.5 c=.7 b=.9 CISE3_Topc c Khoukh_ 43
Bsecton Method -.3776 -.648.784.5.7.9 Error <. -.648.33.784.7.8.9 Error <.5 CISE3_Topc c Khoukh_ 44
Bsecton Method -.648.83.33.7.75.8 Error <.5 -.648 -.35.83.7.75.75 Error <.5 CISE3_Topc c Khoukh_ 45
Summary Intal nterval contanng the root [.5,.9] Ater 4 teratons Interval contanng the root [.75,.75] Best estmate o the root s.7375 Error <.5 CISE3_Topc c Khoukh_ 46
Programmng 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 CISE3_Topc c Khoukh_ 47
Eample Fnd the root o 3 3 n thenterval[,] * * * s contnuous, a b Bsecton method can be used to nd the root CISE3_Topc c Khoukh_ 48
Eample Iteraton a b c= a+b c b-a.5 -.375.5.5.5.66.5.5.5.375-7.3E-3.5 3.5.375.35 9.3E-.65 4.35.375.34375 9.37E-3.35 CISE3_Topc c Khoukh_ 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 CISE3_Topc c Khoukh_ 5
Lecture 8-9 Newton-Raphson Method Assumptons Interpretaton Eamples Convergence Analyss CISE3_Topc c Khoukh_ 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 rst dervatve s known An ntal guess such that s gven CISE3_Topc c Khoukh_ 5
CISE3_Topc c Khoukh_ 53 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
CISE3_Topc c Khoukh_ 54 Newton s Method end n or Assumputon Gven ' : ', ', end X FP X F X X or X MATLAB PROGRAM / :5 4 % X X FP X FP FP uncton X X F X F F uncton 6* ^ 3* ] [ ^ 3* ^3 ] [ F.m FP.m
Dervaton o Newton s Method Gven: Queston : Taylor Therorem: Fnd a h h new guess an ntal How do weobtan a better estmate? such that ' o guess theroot o h h theroot ' CISE3_Topc c Khoukh_ 55. o ' h
Eample 3 Fnd a zero o the uncton 3, 4 CISE3_Topc c Khoukh_ 56
CISE3_Topc c Khoukh_ 57 Eample.3 9.74.369.4375 ' 3: Iteraton.4375 6 9 3 ' : Iteraton 3 33 33 4 ' : Iteraton 4 3 ' 4, 3 theuncton zeroo Fnd a 3 3
Eample 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. CISE3_Topc c Khoukh_ 58
Convergence Analyss Theorem: Let where, such that C r ma -r mn ' and -r -r. I '' ' '' 'r k k -r be contnuous at -r then thereest C r CISE3_Topc c Khoukh_ 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. CISE3_Topc c Khoukh_ 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. CISE3_Topc c Khoukh_ 6
Problems wth Newton s Method Runaway The estmates o the root s gong away rom the root. CISE3_Topc c Khoukh_ 6
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. CISE3_Topc c Khoukh_ 63
Problems wth Newton s Method Cycle = 3 = 5 = = 4 The algorthm cycles between two values and CISE3_Topc c Khoukh_ 64
CISE3_Topc c Khoukh_ 65 Newton s Method or Systems o Non Lnear Equatons ',,...,,..., ' ' o theroot o guess an ntal : X F X F X F X F X X Iteraton s Newton F X Gven k k k k
CISE3_Topc c Khoukh_ 66 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
CISE3_Topc c Khoukh_ 67 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
CISE3_Topc c Khoukh_ 68 Eample Try ths Solve the ollowng system o equatons, guess Intal y y y y, 4 ', X y F y y y F
CISE3_Topc c Khoukh_ 69 Eample Soluton.98.557.98.557.969.587..6 5 4 3 X k Iteraton
Lectures Secant Method Secant Method Eamples Convergence Analyss CISE3_Topc c Khoukh_ 7
Newton s Method Revew Assumptons :, ', Newton' s Method newestmate Problem: ' ' s not avalable ' or dcult toobtan analytcally CISE3_Topc c Khoukh_ 7 are avalable,
CISE3_Topc c Khoukh_ 7 Secant Method ' ponts are twontal ' and h h
CISE3_Topc c Khoukh_ 73 Secant Method NewestmateSecant M ethod: ponts Two ntal s : Assumpton that such and
CISE3_Topc c Khoukh_ 74 Secant Method.5
CISE3_Topc c Khoukh_ 75 Secant Method ;,, Stop NO Yes
CISE3_Topc c Khoukh_ 76 Moded Secant Method dverge themethod may selected properly, not I? Problem: How toselect ' needed s guess onental ths moded Secant methodonly In
Eample 5 nd therootso ntal ponts 5 and 3 3. 4 3 - wth error. - -3-4 - -.5 - -.5.5.5 CISE3_Topc c Khoukh_ 77
Eample + +- -.. -..585 -.6. 6 -.6. -.5.9 -.5. -.5. CISE3_Topc c Khoukh_ 78
Convergence Analyss The rate o convergence o the Secant method s super lnear r r r : root C,.6 : estmateo theroot at the teraton It s better than Bsecton method but not as good as Newton s method th CISE3_Topc c Khoukh_ 79
Lectures Comparson o Root ndng methods Advantages/dsadvantages Eamples CISE3_Topc c Khoukh_ 8
Summary Bsecton Newton Secant Relable, Slow One uncton evaluaton per teraton Needs an nterval [a,b] contanng the root, a b< No knowledge o dervatve s needed Fast near the root but may dverge Two uncton evaluaton per teraton Needs dervatve and an ntal guess, s nonzero Fast slower than Newton but may dverge one uncton evaluaton per teraton Needs two ntal ponts guess, such that - s nonzero. No knowledge o dervatve s needed CISE3_Topc c Khoukh_ 8
CISE3_Topc c Khoukh_ 8 Eample.5 ponts Two ntal theroot o UseSecant method to nd 6 and
Soluton k k k. -..5 8.896.56 -.76 3.836 -.4645 4.47.3 5.33 -.65 6.347 -.5 CISE3_Topc c Khoukh_ 83
Eample Use Newton' s M ethodto nd a root o 3 Use the Stop ater ntal ponts threeteratons or k k. or k. CISE3_Topc c Khoukh_ 84
Fve teratons 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. CISE3_Topc c Khoukh_ 85
Eample Use Newton' s M ethodto nd a root o e Use the Stop ater ntal ponts threeteratons or k k. or k. CISE3_Topc c Khoukh_ 86
Eample Use Newton' s e, M ethodto ' nd e a root o k. k -.63 ' k -.3679 ' k k.46.5379.46 -.584 -.9.567. -.567 -..567. -.567 -. CISE3_Topc c Khoukh_ 87
Eample In estmatng the root o -cos= To get more than 3 correct dgts 4 teratons o Newton =.6 43 teratons o Bsecton method ntal nterval [.6,.8] 5 teratons o Secant method =.6, =.8 CISE3_Topc c Khoukh_ 88
Homework Assgnment Check the webct or the HW and due date CISE3_Topc c Khoukh_ 89