ECIV 301
Programming & Graphics
Numerical Methods for Engineers
Lecture 10
Roots of Polynomials
Objective
nnn xaxaxaaxf 2
210
Calculate Roots of a polynomial
• There are n complex or real roots
• If n odd, at least one real root
• Complex roots exist in conjugate pairs
Polynomial Evaluation
33
2210 xaxaxaaxfn
xaaxxaaxfn 322
10
xaaxaxaxfn 3210
Nested Form
Polynomial Evaluation
33
2210 xaxaxaaxfn
xaaxaxaxfn 3210
6 Multiplications 4 additions
3 Multiplications 3 additions
Polynomial EvaluationIn general
nnn xaxaxaaxf 2
210
xaaxaxaxf nnn 110
n(n+1)/2 Multiplications n Additions
n Multiplications n Additions
Evaluating the Derivative
xaaxaxaxfn 3210
dx
xaaxadx
xaaxadx
xd
dx
xdfn
321
321
dx
xaadxxaa
dx
xdx
xaaxadx
xd
dx
xdfn
3232
321
332
321
adx
xdxxaa
dx
xdx
xaaxadx
xd
dx
xdfn
Algorithm
xaaxaxaxf nnn 110
nn aaaaa 110 Store Coefficients in Vector Form
Evaluate starting from Most Inner Parenthesis
xaaxf nnnn 1
Algorithm
xaaxaxaxf nnn 110
Continue by adding terms
xxfaxf nnnn
21
xxfaxfn 212
xxfaxfn 101
Pseudo Codep=0df=0
DO j=n,0,-1
df = df * x + p
p = p * x + a(j)
ENDDO
Must be evaluated First
Polynomial Deflation
54325 xx7x3x79x46120xf
2x3x5x4x1xxf5
Can also be expressed in factored form
Polynomial Deflation
2x5x4x1xxf4
Divide by any of the factors, e.g. (x+3)
432 xx10x27x240
2x3x5x4x1xxf5
Deflation – Division by monomial (x-t)
tx/xfn
nn aaaaa 110 Store Coefficients in Vector Form
Deflation – Division by monomial (x-t)
nar
0a n Do i=n-1, 0, -1
iasra i
t*rsr EndDo
Polynomial Division
Muller’s - Algorithm
Define Initial Guesses xo, x1, x2
01o xxh
121 xxh
(1)
(2)
For Each Iteration
Muller’s - Algorithm
0
01o h
xfxf
1
121 h
xfxf
(3)
(4)
Muller’s - Algorithm
01
01
hha
(5)
11ahb (6) 11ahb
(7) 2xfc
Muller’s - Algorithm
(8)
ac4bb
c2xx
223
Compute New Estimate
Two Roots: Choose sign that agrees with sign of b
Muller’s - Algorithm
%100x
xx
3
23a
(9) Compute Error
If converged FINISH
Muller’s - Algorithm
(10) Assign new guesses
(A) For Real Roots ONLYChoose the two points that are closest to x3
(B) For ALL Roots
322110 xxxxxx
NEXT ITERATION(11)