Es272 ch3b


Published on

  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Es272 ch3b

  1. 1. CHAPTER 3: ROOT FINDING-b – Roots of Polynomials: – Müller’s Method – Bairstow’s Method – Packages and Libraries
  2. 2. Roots of Polynomials: An order-n polynomial f n ( x) a0 a1 x a2 x 2 ... an x n The roots of the polynomial follow these rules: > For nth-order polynomial there are n real/complex roots. > The roots are not necessarily distinct. > If n is odd, there is at least one real root. > If complex roots exist they are in conjugate pairs (a±bi). Computing with Polynomials: Consider a 3rd order polynomial: f 3 ( x) a3 x 3 a2 x 2 f 3 ( x) (( a3 x a2 ) x a1 ) x a0 (Nested form; 3 multiplications + 3 additions) a1 x a0 (Open form; 6 multiplications + 3 additions) Nested form is preferred as it requires fewer operations: > Lower cost of computation. > Lower round-off errors.
  3. 3. Polynomial deflation:  Once you computed a root of a polynomial, you need to remove this root from the polynomial before proceeding to the next root (so as not to trap at the same root again).  This process is done by a process called polynomial deflation.  Consider a third order polynomial. This polynomail can always be written as f 3 ( x) ( x r1 )( x r2 )( x r3 ) (factored form) where r1, r2 and r3 are the roots. To remove the root x=r1, divide the polynomail by (x-r1). The remaining polynomial will be a second order polynomial: f 2 ( x) ( x r2 )( x r3 ) The remainder of this divison will be zero (R=0) since you divide by its root. If it was not a root, R=consant (a 0th order polynomial).
  4. 4.  In general, if an n-th order polyomial (dividend) is divided by an m-th order polynomail (divisor), the resulting polynomial (quotient) is an (n-m)th order polynomail. The reminder will be an (m-1)th order polynomial. dividend Reminder (R) x 2 2 x 24 x 4 x 6 0 divisor quotient  In computer the polynomial deflation is done by a process called synthetic divison. Synthetic division by a linear factor (x-t): bn an bi ai an .. a0 : coefficients of the dividend bi 1t for i n 1 to 0 bn .. b1 : coefficients of the quotient b0 : coefficient of the reminder For example above: a1=1, a2=2, a3=-24, t=4 > b2=1, b1=6, b0=0
  5. 5. dividend divisor x 4 2 x3 2 x 24 x2 2x 3 x2 3 Reminder (R) quotient 6x 9 Synthetic division by a quadratic factor (x2-rx-s): bn bn bi an an 1 ai an .. a0 : coefficients of the dividend 1 rbn rbi 1 sbi 2 for i n 2 to 0 bn .. b2 : coefficients of the quotient b1 ,b0 : coefficients of the reminder  Synthetic division is subject to round-off errors. To minimize this effect some strategies are used: > root polishing: use root estimates as initial guess for successive estimates. > start from the root with smallest absolute value.
  6. 6. Conventional methods for finding roots of polynomials:  Generally speaking, previously mentioned bracketing and open methods can be used for finding the real roots of polynomials. However, > Bracketing methods are difficult for finding good initial guesses. > Open methods are problematic due to divergence problems.  Special methods have been developed to locate both real and complex roots of polynomials. Two conventional methods: - Müller’s method: Fitting a parabola to the function - Bairstow’s method: Dividing the polynomial by a guess factor  There are other methods too,e.g.: - Jenkins-Traub method - Laguerre’s method - ...  Plenty of software library is available for locating roots of polynomials.
  7. 7. Müller’s Method  This method is similar to Secant method. The difference is that instead of drawing a straight line for two initial guesses, a parabola is drawn with three initial guesses. Secant Müller xr xr x x0 x1 two initial guesses x1 2 x0 three initial guesses  Parabolic fit function facilitates finding both real and complex roots.  Define the parabola as f 2 ( x) a( x x2 ) 2 b( x x2 ) c  We need to find the coefficients (a,b,c) such that the parabola passes from three initial guesses: [x0, f(x0)] , [x1, f(x1)] , [x2, f(x2)] .
  8. 8. We get these three equations with there unknowns (a,b,c): f ( x0 ) a ( x0 x2 ) 2 b( x0 x2 ) c f ( x1 ) a( x1 x2 ) 2 b( x1 x2 ) c f ( x2 ) a ( x2 x2 ) 2 b ( x2 x2 ) c From the third equation => f ( x2 ) c Then, we get two equations with two unknowns: f ( x0 ) f ( x2 ) a ( x0 x2 ) 2 b( x0 x2 ) f ( x1 ) f ( x2 ) a( x1 x2 ) 2 b( x1 x2 ) Define h0 x1 x0 h1 Then (h0 h1 )b (h0 x2 x1 h1 ) 2 a 2 h1b h1 a h1 0 h0 1 0 f ( x1 ) f ( x0 ) x1 x0 h1 1 1 f ( x2 ) f ( x1 ) x2 x1
  9. 9.  The coefficients a,b,c are determined as a 1 0 h0 h1 h0 b ah1 c x1 h1 x0 f ( x1 ) f ( x0 ) x1 x0 x2 x1 f ( x2 ) f ( x1 ) x2 x1 f ( x2 ) 1 0 1  To calculate the root, calculate the point where the parabola intersects the x-axis, i.e. f (x) 0 . Then, the roots (xr) are xr xr x2 x2 2c b2 b 4ac 2c b b 2 4ac (alternative formula for roots of quadratic polyn.) (both real and complex roots are facilitated.)
  10. 10.  Root is estimated iteratively (i.e., xr x3)  Error can be defined as the difference between the current (x3) and the previous (x2) solution: x3 a x2 x3 2c 100% b b2 1 100% 4ac x3  A problem arises as which of the two estimated roots (xr) will be used for the next iteration. > choose the one that makes the error smaller.  Once x3 is determined the process is repeated. For the three points of the next iteration, suggested strategy: > choose other two points that are nearest to the estimated root (If estimated roots are real). > just follow the method sequentially, i.e., drop x0, and take x1 , x2 , x3 (if a complex root is located).  Once a root is located, it is removed from the polynomial, and the same procedure is applied to locate other roots.
  11. 11. EX: Use Muller’s method to determine a root of the equation f ( x) x 3 13 x 12 With initial guesses x0=4.5 , x1=5.5 , x2=5.0. First iteration: f (5) 48 f (4.5) 20.625 f (5.5) 82.875 h0 0 5.5 4.5 h1 82.875 20.625 5.5 4.5 5 5.5 62.25 1 48 82.875 5 5.5 69.75 Then, a 69.75 62.25 15 b 15( 0.5) 69.75 62.25 0.5 1 c 48
  12. 12. To determine the estimated root: b 2 4ac since 62.252 4(15)48 31.54 62.25 31.54 62.25 31.54 The estimated root is: 2(48) 62.25 31.54 3.976 Error: a 3.976 5 100 % 3.976 25 .74 % For the next iteration, assign new guesses (sequential replacement): x0=5.5 x1=5 x2=3.976 Xr 0 5 1 5 i 3.976 25.74 2 x3 4.001 0.6139 3 4 0.0262 4 4 < 10-5 a(%) method rapidly converges to the root xr=4.
  13. 13. Bairstow’s Method  We know that dividing a polynomial by its root result in a reminder of zero. If the divisor is not a root then the reminder will not be zero.  The basic approach of Bairstow’s method is starting a guess value for root and dividing the polynomial by this value. Then the estimated root is changed until the reminder of the division get sufficiently small. Consider the polynomial: f n ( x) a0 a1 x a2 x 2 ... an x n If you divide the polynomial by its factor (x-t), you get a new polynomial of the form f n 1 ( x) b1 b2 x b3 x 2 ... bn x n 1 and a reminder R b0
  14. 14. This process can be done by using synthetic division: bn an bi ai bi 1t for i n 1 to 0  In order to facilitate the complex root Bairstow’s method divides the polynomial by a quadratic factor: (x2-rx-s). Then the result will be in the form of f n 2 ( x) b2 b3 x ... bn 1 x n with a reminder R 3 bn x n 2 b1 ( x r ) b0 The process can be done by synthetic division by a quadratic factor: bn bn an an 1 1 rbn for i n 2 to 0 Then, the problem is to find (r,s) values that make the reminder term zero (i.e. b1=b0=0). bi ai rbi 1 sbi 2
  15. 15.  We need a systematic way to modify (r,s) values to reach the correct root. In order to this, we use an approach that is similar to Newton-Raphson method. Consider ing b0 and b1 are both functions of (r,s), and expand them using Taylor series: b1 (r b0 (r r, s r, s s) b1 b1 r r s) b0 b0 r r b1 s s b0 s s (no higher order terms)  We force b0 and b1 to be zero to reach the root; then we get b1 r r b1 s s b0 r r b0 s s b1 b0 Need to solve these two equations for two unknowns: r and s
  16. 16. Define b0 r c1 b1 r c2 b0 s c3 b1 s Then, we have the following simultaneous equations: c2 r c3 s b1 c1 r c2 s b0  We previously applied synthetic division to derive values of “b” from values of ”a”. Bairstow showed that we can evaluate values of “c” from values of “b” in a way similar to synthetic division: cn cn ci bn bn 1 bi 1 rc n rci 1 sci 2 for i n 2 to 1 Once r and s are calculated using the simultaneous equations, Then, for the next iteration (r,s) values are improved as: r r r s s s
  17. 17.  Error at each iteration can be calculated for r and s seperately: a ,r r 100 % r and s 100 % s a ,s  When both values fall below a stopping criterion, the roots can be determined as the roots of x 2 rx s : x1, 2 r r2 2 4s  Both real and complex roots are obtained.  Once the roots are located, these roots are removed, and the same procedure is applied to locate other roots. EX: Use Bairstow’s method to determine the roots of the equation f 5 ( x) x 5 3.5 x 4 2.75 x 3 2.125 x 2 3.875 x 1.25 using initial guess of r=s=-1, and stopping criterion s=1%
  18. 18. First iteration: Apply synthetic division to obtain b values: b5=1 ; b4=-4.5 ; b3=6.25 ; b2=0.375 ; b1=-10.5 ; b0=11.375 Apply synthetic division to obtain c values: c5=1 ; c4=-5.5 ; c3=10.75 ; c2=-4.875 ; c1=-16.375 Solve the simultaneous equations: r=0.3558 and s=1.1381. Revise (r, s) values: r+ r=-0.6442 and s+ s=0.1381 Error: a,r=55.23% and a,s=824.1% Second iteration: b5=1 ; b4=-4.1442 ; b3=5.5578 ; b2=-2.0276 ; b1=-1.8013 ; b0=2.1304 c5=1 ; c4=-4.7884 ; c3=8.7806 ; c2=-8.3454 ; c1=4.7874 Solution of the simultaneous equations: r=0.1331 and s=0.3316. Revise (r, s) values: r+ r=-0.5111 and s+ s=0.4697 Error : a,r=26.0% and a,s=70.6% Third iteration: ……
  19. 19. Forth iteration: r=-0.5 with s=0.5 with a,r=0.063% a,s=0.040% Errors satisfy the error criterion. Then, we obtain first two roots as: r1, 2 0.5 ( 0.5) 2 4(0.5) 2 0.5 1.0 For the other roots, we use the deflated polynomial: f ( x) x 3 4 x 2 5.25 x 2.5 Apply Bairstow’s method with starting guesses r=-0.5 and s=0.5 (solution of the previous step) . After five iterations, we get r=2 and s=-1.249. Then, the roots are r3, 4 2 22 4( 1.249) 2 1 0.499i We can easily obtain the fifth root by deflating the polynomial into the first order. The fifth root will be r5=2.
  20. 20. Libraries and Packages Matlab function Method fzero initial guesses fzero(function, x0) fzero(function [x0 x1]) sign change finds the real root of a single non-linear equation  A combination of bisection method + secant (Müller’s) methods  It first search for sign change, then applies secant algorithm.  If the root falls outside the interval, bisection method is applied until an acceptable result is obtained with fatser methods.  Usually it starts with bisection, and as the root is appraoched it shifts to faster methods roots roots(c) vector containing coefficients  determines all real and complex roots of polynomials.  uses the method of eigenvalues.
  21. 21. IMSL: routine method ZREAL Finds real zeros of real function using Müller’s method. ZBREN Finds a zero of a real function in a given interval with sign change ZANLY Find zeros of a univariate complex function using Müller’s method roots of functions ZPORC Finds zeros of a polynomial with real coefficients using Jenkins-Traub algorithm ZPLRC Finds zeros of a polynomial with real coefficients using Laguerre method ZPOCC roots of polynomials Finds zeros of polynomials with complex coefficients using Jenkins-Traub algorithm.