03. root finding methods

Post on 14-May-2017

229 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Root finding

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

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

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)

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

2. False-Position method

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

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

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

• 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

• 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

False Position method

12

12

xxyym

m)(f

myΔx 11 x

.,x 1 etcxx klow

k

1

2

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)

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

3. Newton method

)(x'f)f(x

m)f(xΔx

1

11

.,x 11 etcxx kk

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

Newtonunfavorable

Newtonfavorable

Bisection is always safe

Problems with Newton method

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

4. Direct (Simple) Substitution method

)(ˆ xgx

0)( xf

Four basic cases

Graphical representation

)(' xgThe role of

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

top related