You are on page 1of 38
4-Roots of Equations You learned to use the Guadratié formula -baV 2 = fac x= —- - - - -- - -- + Cd) 2a +o solve Ftxd= r+ bx4C 50 - ene ----@ The values colustated with eg) are called the yoots of eg. They represent the Values of 1 that make eg2) equal +o zero. Thus, we can define the root of an equation asthe value of x that makes fix)so . Although the guadrati: formula is handy for solving ea(2), there are many other functions for which the root Cannot be determined so easily - For these Cases , the numerical methode olescribed in the follovsing Sechons provide efficent meang to obtain the answer . 1. Graphical Methods A simple method for obtaining and estimate of the root of the equation FO)=0 1% to make a plot of the funchon and observe where it Crosses the X axis . This point, which represerite the x value for which faxzo , Provides a yough approximation of the vost . Graphical techniques are also aseful for visualizing the properties of the funchng and the behavior of the various numerical methods. 2- 83 EX? Use the graphical approach +o determine the drag coefficiewt C needed for a Parachutist of macs m=6R.1 keg to have a velocity of do mis after free ~ falling for time t= 10S . Nove : The acwelerahon due to gravity 1s 4.8 mfs®. ft) = 2:8 (68) C= e C-Di0 ~qo ~ 9.146843 C Fee) = SEF38 (lee )-40 Various values of C can be substituted info the Ruight~Hand side of this equation to compute FCc) as; co fcc) 4 Bd Fe) 8 17.653 do \ 12 6.067 30 * 16 - 2.269 20 \, Root 20 _3. 4ol 10 NX, J, . ° i 2 -°{ 4 B12 2 Cc These points ave ploHed above . The resulting Curve Crosses the ¢ aus between 12 and /6. Visual mnspection of the plot provides a vough estimate of the rast of /4.45, The validity of the graphical estimate can be checled by Substituting it into equation above . a- 84 2- The Bisection Method The bisection method 1s one type of incremental search method in which the interval is always olivided in half. Suppose we already Know that there ic a yoot between X= Xn, and X=Xey 5 cthat is , the function changes sign in this interval . The location oF the yoot is then determined as lying at the midpoint of the interval Within which the sign change occure, ce Xp,= res. In the chrawing below Ye function Cross He x axic at the right of the Xp, , So we replace the full previous interval by the vight half thterval (de replace Xp, by Xp, Where he new wirferval becomes behween Xp, and Xn.) . The process is repeated until We narrows th on the rect 4o Within some previously assigned AcCaracy . EX: See previous example Find the drag weffiuent, Cy of the Lanchon Jiven inthe previous Gramele by using Bisechion method . The equation is v= we G-e™ ~) & 40- 6438 a _ cotta Sy The first step is to rearrange the equahon to be th the flowin rm + foil ro se888 (. gree, a, The deag coefficient 5c, is the root of this equation - The function changes Sign between Cpai2 and Cyysio. 4& iteration ¢ The midpoint of He interval between 12 and 16 fe Cops BHO a14 4 where $04) 1 positive , there fore the Ce,zi2 is replaced by Casl4, and the relative ervor ic [ge] =| HE = ons 24 terahion : The midpoint of the new iirterval between Cpz=!I4 and Caz lb is Graz tll lye, where frys) is negative , therefore the Cnyz tbe is replaced by Cha =1s , and the velahve evror is | g= a = | S24 |- ccce The method can be repeated until the result is accurate enough +o sahsly the yeu accrracy « 2-86 2A- Termination Criteriea (Convergence) and Error Estimates We enclecl Previous example of bisection method with the Statement that +he methed Could be continued 1 orcler to obtain a vefind estimate of the root. In any iterative computahona method, we must lenow when +o ferninate the computing and how to estimate the ervor. This Can be achieved by the Following : Absohite Error and Convergence Criterion Absolute Error =|S] = | x7" _ x24 | eis the Carrent (Herahen value and xe x ne old iteration or previous iterahon value . where x When Evror|$] becomes fess than a prespecified terminating Criterion 5 € , the Computation fs terminated . Therefore , IF [x xl © © THEN terminate the Computing Note ¢ Using this criteria depends an the magnitude of the estimated value. EXt Suppose you specify E=o.0l , and you get KE 2 3582346 S xed 358234.6 In this Case pxrew — xed | 2 on) This meons that the Camputing will be iterated and would Q- &F not be terminated eventhough “t is close to o realishe purpose But if xe 01002 x eo. 006 then [xm _ xold | = 0.003 In Such Case the computing will be terminated although the difference ig large and not vealishe Sor stopping Comeutation . Relative Error and Convergence critevion new Relative Error =1$] = | xnen The Same as before ce yold te | x | < € THEN x Ferminatte the computing The relative Convergence Criterion Overcomes the liffiealties of the Pprevieus criterion, S2083 = 01006 | 4.0 hich is not leas than ool, there fore 91003 the computing is continued Recommendation : A relative convergence ceiterion is recommended for the voot finding Computations . 2- RE Algorithm Steps of The Bisechon Method] Saoritim Steps of The Bisechon Method! 4. Chose a pair of Values of X=X, thet gives $n) co ond X= Xe thet gives £exp) po 2. Put the no. of iteraheon , € =1 3. Glenlate Xney as Knew = “apke 4. Evaluate £¢xneu) + Checle for Linen) 90,04 FX new) <0,0r Fiinew)=0, as Follows + a.IF £CXneu) | a [.< otf U converges , you have found the yoot, Xnew , $2 Stop Computing . e 1f it clees rot Convarge 5 Increace He no. of eration by 1, Cae+l , then go back tu step 3 4 perform anctler Cterahun » be IF £0%neu) po, THEN 4. put Xp=Xnew 2. Check for convergence ‘ aa old Ixe-Xrl |H S increase + no of iterahion by 1 5 b=C41, Then ge back te step 3 to perform another iteration . C. IF $é%pew) =0 , THEN Yeu have found exactly the roots so chop compuking Note + t- If here are several roots , several bisechons are needed. 2. The approximott behavior of the Luncheon can be determined Grom plothing the funchon. R- gO Comments + There is another way to checle whether fuxnen) Co, or FUpeu) do as follows + IF F$0xp)-Ftxnew) <0 re meant Loxpey) I negative, and the rest ic crossing between Xpand Xney «THEN . Put Xn = Xnew IF £0in) - Frew) <0 KH means Fixpew) Is postive, and the vost ic crossing between Xq and Xpew sTHEN Pot Xp = Xnew 2-4 Flowchart of The Bisechon algori ae OO ITI An 2 ives $n) £(6n) = - 262638 — 2.2688 (12-/6) 6.0664 -(-2.2638) negative, therefore Cry zie is replaced by Cn2=/443 . The relahve exvor is | Sep Ste] = | 4a 12 59S Cha 14.9113 Chg 26 - BIG-UIZ —, where £04,903) 1s 299 iteration + Ceaiz => F&p,) = 6.0664 25/443 => Flnz) = - 0.2543 _ ~ 002543 (12-/4-G113) ; Cng = 14.9113 = F0etq-(-0.3593) = 14.7942 , where £(14.7442) 'S negative , therefore Cro is replaced by Cys = 14-9442. The relative exror is Cng~ Corl _ | 3-Ger = 0.184 and So on. Note: Ht is approaching the rest (C2145) faster than the bisection metod . 2-44 Algorithm Steps of Regula Falsi Nethed 1. Chose a pare of values of x=X, that gives foxn)<0 and X= Xp thet gives fap) po 2. Put the no. of Zterahion gi = . 3. Calealete Lu,) and £txp) - 4. Calelate xXngy as Xnftxe) — XeF Gin) Xnew = new F0%p) - £%n) 5. Evalucte fines) 6. Check for Fexje0) 705 or FXnew) <0 9 or Ltnew) 20 5 as follows + OIE $F$Cxpeu) <0 5 THEN 1. put Xn=Xnew 2. put £0x,) = fnew) 3. Check for the Convergence + [rE ge ine pment oe olf U converges p you have found the root oXneus > $0 Stop Computing 0 Ib cloes not Converge » increase the no. of Cteratvon byt, cab+l, then 90 back to step 4 to perform another [teraton b. IF £l%new) 20 4 THEN 4, Put Xp =Xnew 2. put Fe%_)=fxnew) 3. Checie for the convergence + |Aerkn | ce Xp 2 IF i converges , you have found the root 5 xXnews So stop computing oe If & does not Converge 9 Increase the no. of iteration by {5 then g° back to step J to Perform another Cteratien CLI F0%new) © » THEN You have found exactly the rest , So stop Compuhing- Note 4. The method can be Converge more rapidly if the mterval canbe made to Cllapse fom both divechons. Such modifeahion i called “ The Modified Regula Fils’ Methad” R- You may also check whether Flin.) <0 20 FOinew) Do ast IF Ftp). $(xnee) <0 means Lemme) ic negahive sand he root fe cressing between xp and Knew: THEN Put Xn=Xneuy © TF $x) $0%peu) $9 He means £CKpe0) is pesihue and the reot is Crossing between x, and kneo- THEN put Xp=Xnew + 2-46 Flowchart of Regula Falsi Algorithna Ks gives Fin) o fax rheration, Cmrk #0Kp)- FOr) Xn $i) ~ XeF lan) You may clevelop another Flowchart using DO loop Instead of IF 6070 srudure| (see. Mewtop -Raphsen Nethod)| Xp= Xnew £0%9) = Foxes) Root=Xnw % Comments on the Modified Regula Falsi Method —————s eres meee Regula Beret Petre’ He prouides ~apich convergence by malcing the interval to be Collapsed from beth clivechons One manner of sccompli'shing his & shown in the figure above. The idea is as follows 1, Use Regula Falsi method to evaluate the first Herahion voot (Xnew) as discussed before'and shown above. a IF £Xnew) >° > THEN the interpofahion bine i drawn between tha points (Xn YF) ond (Knew $row)» xt Xn Fotis) — x25 - fon) en = ” Flies) — YoF( Xn) 2-06 3. ELSE IF $(x%nuu) <0 , THEN the interpolabon Une R drawn between the Pporrts ¢. (po Flap) and (x25, LOR) - wee Kpeo + WySOl—) —Xp £0025) News = VeF typ) - $C awe) Thus the slope of Yhe Line te artifrecally reduced . a- qa 4. Newton's Method (Newton — Raphsen Method ) Perhaps the most widely used of all root. Finding methods is the Newton -Raphion methed . Hs formula cn be clerived ar: If the initval guess x; which fe pot a veot of $x) but is “reasonably close” to a root, By expanding £00 In Taylor series about Xp fy evalucte F(Xi41) , the Following Pormula. ix obtainect , SOG) = £00) 4K, Ke Fe) + OK te I£ you suppose thet Xr4) is the root a thenF Ceca) shout equal to Zero as 0 = Fexe) + (Key -X,)F Ge) Solving this equation for Xisi z yield Keay = Xe ~ LE) $0) This formula represents Newton-Raphson formula which can be used to Gury on the eration toward Finding the root . Therefore 5 F¢xotd) $0Xid) (4) o_ £082) x fO_ TOR) FO?) Xnew = Xold - lie x 2. gf) _ Sex?) SR) Newton-Raphson formula also can be represented by the Bllawin Figure 8 slope =f 0x2) The method & clicadvantages : a- 1 needé to know the analytical expression tothe First clerivahue , Fx) . b- Although & is powerful method if has Some oliffiuulties with Certain +ype of funchons » Such ac oscillatory funchion below: Therefore, the right first guess is very wngortant in such famction - This guess must be close enough +o the root tn order to Converge . 2-lol Use Newton-Raphten method to eshimalé the root of. fog= ~E*% x, employing an initial guess of X20. The funchon ; Fo) 28% x The first clevivative : Fix) = ~e*) The formule + Keay = Xe - fee) aXe - Foxe) Stavting With Xcz0, this iterahion equation can be applied te tompute the following : Xcel 5X2 AGE" x10 i Xe 1 ° os 100 % 2 os 0.566311 UH 3 0. S663N OS6F143 0.M4F ZL The true root is O.S6HY24 ... 2-.lod Algorithm Steps of Newston’s Method (Newton -Raphson) 1. Chose a proper guess to the root, x. 2. Put the nov of Lteration ,i=t . + Calculate foxy and £'(x) «Glulate Xpey ac: a a fa) £&) + Check forthe Convergence : Xnew = X— w 1st =| Speen | <é olf it fonverges , you have founcl He root 5 Xnew» SO Stop Compubing olf it cloes not converge , then 4. put K= Xpew 2. Increase the number of fteratien by 1, cadas 3. then go back te step 5 Flowchart of New+ton-Raphson Algorithm oefauie Messages Flowchart of Newton -Raphsan Algorithm 3 usin. Do Loop instead of IF-Go 70 structure a _instead! of IF-G0 70 structure Guessing of X max, iteration No. ‘FFioatties of Newton —-Raphsons method Despite Vis vapid convergence, Newton- Raphson’s method has some oliffreuthes with Certain types of funchons at follows + 4. A poor initial guess « If te Inifiol guess Xo ie such at fbte) /s small Cslepe nearly horizontal) tha First fterahion may be thrown out of the region of interest, Also, if the initial guess i fn @ region where the function has a local minimum but ro root, the method will Hlely fail. 2s Infinite clerivahve The meted will not be able to find a root whenever the clerivahive ot He rect is inkinide . This situahion i's rarely encountered and usually ignored im Censtruching a FORTRAN Code. 3. Multiple roots The mettad may have oliffieuities with muthiple roots. At He position of a multiple root, both £01) and £G) are Zero and we would antieipabe het the algorithm would fail in attempting Je compute ax=-$/f'—-» ofo- 2-(06 5- The Secant Methoel His essenbalty a modiferhion of vhe Netwon — Raphion meted wth Yhe clerivehue replaced toy Kutmenrr end cheffrentioh'un ( Difference expression) . Thr K advantyeows the Punchion i Adele rey Cidgrentiaee « oP Fa Fed) ~ Fut") (ean z ; wee xe? é s 2 PD LO ri sos x fed Wn, Beaty £OR) EKO) se © Two int hal guesses are need - a-(e4 Ex: Use the Secant method +o estimate the rect of Lex) Start with inthe! guesses, o and 4.0 . 1% ierahon 5 é=1 Kee o » Fx) = to X(o) = 1.0 > FlXq)) = - 0.63212 & Kay = Xie — £0@) to = TBE gig F(X) - FX») ~0.63212 ~ 7 2X1) - Fn) 0163212 = 1 Xoy= X(-1) 1-0 SY. Xev-Xee}] xjo0 =| 2627 ate] 00 = . | Xap o-ciag | X00 = 6194 % ard iterahon 5 o=2 Xoq) = 1-0 > FCXeo))e = 0.63212 XC) 0.612% 5 $(Xe43) = - 0.07071 = 0.0081 Kea) = 0.602% | TO sg ceazy 0.07081 —(—0.63212 2-6129- lo S632Y ~ 0. 6/27 00 = 8. Y | O.S638Y [* 8.65 5% 3M jtevahion 5 Co3 Xqy 20.612? » FCKy) = ~ 0.0% 08} Xa) 5 2S6384 —-y F(Xz)) = 0.00579 Xap = 0-SCRF Sh = 054 4 2-108 Algorithm Steps of Secant Method 1, Chose two Proper guesses sXe and: X; 2. Put the no. of iteration 5 i=4 a. Calculate Lex.) 4, Caleulate £ex,) 5B. Calculate Xnoy ac: Xnow = X,— SX mee SM aE Ee) -Xo 6. Check for the Convergence -* st [eget « olf & converges , you have found the roots Xnew » Se step Computing olf 1 does not converge 5 then 1. Put Xo= Xx, 2. Put $txe) @F0x,) B. Put X= Xnew 4s Increase He no. of fterahion by 1, éac4! 5. then go bac step 4 Q- IoF Flowchart of Secant Algorithm Start a Gnagsing OF You may clevelop another flow chart using Do loop instead of IF60 70 structure (see: Newten- Raphson Methad) Imax. ieee eax fet £m) Xmeo =X,- mee EN Foxy = Fe) XeXnew X= Xo $0X0) =X) ~ Xnew -X oe Roots Xnew 6. Successive Substitution Methed In this method the nonbinear equaten /s expresseel as: X= fo) The iteration form is Xnew =F oid) Algorithm Steps 1, chose a proper guess +o te root x 2. put He no. of iteration 4 d= 1 3. Colenlete fox) 4. Check for the Convergence + Isl =[x-Co)] xKs3€ this form Guse diverge 2 => x * oy dnc $) = 2 b. Xe" L Xe z-e =o => ¢- > dol h)ex? > x= [ice this form Camce Converge For Case @ to perform iteration to €2tox10S, where x2 xesen® 3 fu23e~ 5 5 =| fox é x $oa 1 XP 4.0 (guess) $¢x!) = 1.10364 01094 2 1.10364 FOR) = 0.88795 on244 3 20.8824 FOP) 2 1636485 0.357 4 Me zeyes got = 0. 46S? 1-93 ¥ diverge 2-3 For case © fo perform jterahion to €=l.ox105, where _ xe Ldo (ZT 5 foo = [Laces 5+ Fst £ x Fa) ' x 1.0(18 guess) $q4 2.09815 2.046 2 Ret o9gis” FO) 5 ho2sy o.o2z 3 2. howsy $02) = 1.0361 010/03 4 21030 $004) = 1.03/04 2.0044 12 Recta $= 1.032641 < tox > 2- The clivergence Caused by the form of Case @ can be vesolued and make form @ Converge by using damping Successive substhton (why 2). The new iHerahin general form ts EP Oe (Fo8)- £9) Pe where, X= 30% 5 fecye ger? 5 § |fon=x é x FX) en) & 1 21.0 (1 Gues) $ocY2/.10364 x22 1.02073 0.0205) 2 2102093 fa) =h08836 x22 /,02826 0.00732 3 Phio226 fueloyai6 xt /.03/09 0100270 4 <2 103104 — $¢,N = .0362/ XSZ 1.03209 o.oo! s % 03203 fUxS)= /.0340/ x%2/,03246 0.00038 © $e nos246 fexbye/.033/8 xFz 0320 o.oaal4 converge . 3- Accordingly the type of method it alco mportant to Cause fonverge as wall ac the type of the functron « 2-14 x Molifed Successive Substihh'on I Successive Subshhuhion meted produces over oy. dame steps or: BH6 123, 36.8526, 3Y,--- Than we need to champ the successve Subshiichion, ‘Hen cam be chens by” Modifies! Successive Sabshthuhion’” xO" 5 x4 (fay — x?) whee Pt damping Suter (o-1) HE Pal then we gef Successine Sueshhatren HEP C1 thin damping Successive Swesh tote (2 PO1 then atelumhon Successive Sweshhehin for Hus Case Wegstein’s Method Vs on of the mast Commonly wed accelarmbion algorithms Fhe abgonth. ( madihed Successive Sushintion cs He Same ~( the Succession Subs htution Tmax 2 reset 9 to Bmax 4 THe 4 © Lmnin where Emin Ss and Emax = + O+S This step imposes Limit on the Size of the accelerahon Step and Jeads +o rhe designation of Yhie Procedure as He bounded Wegstein algorithm . a-Mé 6. Cleulate (4) BP co 4 (ig) Fee) F. Puk Essel ,and then go back to step 2. Note + Hf g=0 5 the algorithm reduces to Successive Subshtuhion 1£ 042 61g the algorithm ic mocdihed successive subst thon If Gis -ve 5 the algorithm involves accelerah'on If the procedure seems to be unsfable, raising th. value of Gin (ee malcing # less negubve ) if oO is fonverging very slowly ancl monoten’telly , you might lower Gmin and if i is Converging in an oscillatory manners try raising 4a. a- MF? i t t | * Comments on Multiple Roots i A muttiple rect corresponds to a point where a funchion lis tangentral 2 the x-axis. |Aclouble rests resutts from | FOR) = (X-3)(x-1) (x=1) por £) = x3 -sx2494x -3 The equation has a double root because one value of xX males twe terms im te Fiect eguahion + Graphically yas corresponds be He Curve touching the x aris tangentially at He olouble root. Double root x A triple root : Gorresponds othe Case where one x Value moles three terms cn an equation equ! te Zero,as in Pod = (x -3) (X= Cx ~1) Cx-1) cor $x) 2 X46 x34 /2 x%-10K 43 i Inthic case, the graphical presentahion inclicates tat the ifunchon is tangential tothe axis at the rect but that for thie Case He axis is Crossed. Triple rect i ¥ | Notes Multiple reots Pose a number of Aifhulties for imany of numerical methods . 2-8 %. Programing Recommendations Following are recommendlahens for Carrying ikeration Soluhons of algebraic equations by Computer : 4. Regardless of which method you uses You must first eshimate ‘the solution (by hard) y and then use the method to proceed -fo better estimate «The first guess can be critical in determining the success of the procedure . The closer the estimate ic tothe true Sofubion, the more Iikely the method is to fenverge and to do so rapidly. 2. You will often have a basis ra reasonable Cirst guess which ave 5 knowledge of the process system, physical constraints Previous experience with similar problems and Cemmon Sense + Wf you have absolutely no basis , however , ut is vecommende to clo the following = O- Calculate fod for several vandomly chosen value of % before begining the procedure «the magnitude of Fo) and the way i# varies for the Values of x you have chosen will often enable you te guess where a root is Likely te be found. This guess then serves as the first estimate from which the Systematve Search procedure can proceed, b- Plot the funchen fox) varsus x . The plot is very helpful to determine the nature of the variation of Fic) with 2. /é also may suggest on appropriate method and a peper First guess. 2- 1/9 2- Always impose an upper Limit on the number of iferaton purformed « If Was Limit is exceecled pterminge the procedure , Print out an appre p riake message 5 ond step He Calculation - There is always a chance that a procedure will not Converge , either because of an inherent hiffreulty with the Problem er because rhe Programer ptade a mistalee. It you fail dv achieve convergence in Yhe specifred number of iteration, clonit just raise the iterahion Limit and try again 3 instead , cletermine whether or het the pregrans it funchoning correctly and approaching a Cenversence Limit. B~ At Linst the Frst time yew ran a Program Perform oa trinfiondserrer Search 5 Print ou the Values of He Successive estimates (5 xf,...) ond He corres poncling function Values , and put a low Limit on the number of iteration allowed, @g.10. Han Calculate He value of £6x!) and verify Het your value it He Same as the one caleulatee! by the Computer. [fit is yuu Can have a reasonalele olegree of Confidence sr He Vale cle'ty of your Program. if Xare Gnverging ythen ether increase He number of allewed iteration ar relax your Convergence tolerance. (f not Try a new guess. If he metiod s4ili does not work , check your log tm Some thing 3 pro bably wrong « 2-Io

You might also like