03. root finding methods

21
Root finding

Upload: ponsepoy

Post on 14-May-2017

228 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 03. Root Finding Methods

Root finding

Page 2: 03. Root Finding Methods

Roots of Equations• Formulation f(x)=0• Solution (root)– existence– uniqueness–multiplicity

• Bracketing vs open methods• Polynomial vs general (transcendent)

Page 3: 03. Root Finding Methods
Page 4: 03. Root Finding Methods

Bracketing Methods• 1. Bisection (interval halving)– finding an initial bracket– number of steps needed (known)

• 2. False position– finding an initial bracket (is the same)– number of steps needed (basically not

known)

Page 5: 03. Root Finding Methods

1. Bisection method• 1. Bracket the root (find values of x that are too

high and too low)• 2. Choose the next x in the middle of the bracket,

xk+1 = (xlow + xhigh) / 2

• 3. Evaluate f(xk+1) and adjust the bracket• 4. Estimate maximum error from each bracket

Page 6: 03. Root Finding Methods

2. False-Position method

• Combines of two concepts: –bracketing–straight line approximation of f(x)

Page 7: 03. Root Finding Methods

2. False Position method

• 1. Bracket the root (find values of x that are too high and too low)

• 2. Assume a straight line between the points to find xk+1

• 3. Evaluate f(xk+1) and adjust the bracket• 4. Estimate maximum error from each bracket

lowhigh

lowhighlow

klow

k

xxxfxf

xfx

)()(/)(x 1

Page 8: 03. Root Finding Methods

First order Taylor polynomial - Straight line

• Equation of a straight line though the two points of the bracket:

y = b + mx• Find the location where the line

crosses the x-axis

Page 9: 03. Root Finding Methods

• Equation of a straight line y = mx + b

• Slope and intercept m and b

• Finding the location where the line crosses the x-axis

0 = m xroot + b

Page 10: 03. Root Finding Methods

• Equation of a straight line passing through one given point, with known slope

y - y1 = m (x-x1)• Equation of a straight line passing through

two given points is the same, but with

• (Note: y-y2 = m (x-x2)is also good!)

• Finding the step necessary to take to cross the x-axis: 0- y1 = m (x-x1) = m x

12

12

xxyym

m)(f

myΔx 11 x

Page 11: 03. Root Finding Methods

False Position method

12

12

xxyym

m)(f

myΔx 11 x

.,x 1 etcxx klow

k

1

2

Page 12: 03. Root Finding Methods

Open Methods• 3. Newton (Newton-Raphson)– Evaluate f’(x) at last point– Extrapolate tangent to x-axis

4. Direct (Simple) Substitution – Use a simple function, g(x)– Estimate xk+1 from g(x)

Page 13: 03. Root Finding Methods

3. Newton method

• 1. Evaluate f '(xk) • 2. Extrapolate tangent to x-axis, assuming a straight

line

• 3. Evaluate f’(xk+1) 4. Estimate maximum error from each bracket

)(/)(x 1 kkkk xfxfx

Page 14: 03. Root Finding Methods

3. Newton method

)(x'f)f(x

m)f(xΔx

1

11

.,x 11 etcxx kk

Page 15: 03. Root Finding Methods

3. Newton method

• 1. Requires that f '(xk) can be evaluated• 2. Can converge rapidly, depending on f(x)

and the starting value of x• 3. May not converge in some cases

Page 16: 03. Root Finding Methods

Newtonunfavorable

Newtonfavorable

Bisection is always safe

Page 17: 03. Root Finding Methods

Problems with Newton method

Page 18: 03. Root Finding Methods

4. Direct (Simple) Substitution method

• 1. From f(x), manipulate to the form:x= g(x)

• 2. Calculate the next x with xk+1 = g(xk)• 3. May not converge in some cases

Page 19: 03. Root Finding Methods

4. Direct (Simple) Substitution method

)(ˆ xgx

0)( xf

Page 20: 03. Root Finding Methods

Four basic cases

Graphical representation

)(' xgThe role of

Page 21: 03. Root Finding Methods

Characteristics of the methods1. Bisection 2. False

position3. Newton’s 4. Direct

substitution

Method type Bracketing Bracketing Open Open

Reliable X X

Can be unstable

X X

Estimate error

X X

Fast, when works

X

Simple to code

X