25
Numerical Methods Numerical Methods Root Finding Root Finding 4

Numerical Methods Root Finding 4. Fixed-Point Iteration---- Successive Approximation Many problems also take on the specialized form: g(x)=x, where we

Embed Size (px)

Citation preview

Page 1: Numerical Methods Root Finding 4. Fixed-Point Iteration---- Successive Approximation Many problems also take on the specialized form: g(x)=x, where we

Numerical MethodsNumerical Methods

Root FindingRoot Finding

4

Page 2: Numerical Methods Root Finding 4. Fixed-Point Iteration---- Successive Approximation Many problems also take on the specialized form: g(x)=x, where we

Fixed-Point Iteration---- Successive Approximation

Many problems also take on the specialized

form: g(x)=x, where we seek, x, that satisfies

this equation.

In the limit, f(xk)=0, hence xk+1=xk

f(x)=x

g(x)

Page 3: Numerical Methods Root Finding 4. Fixed-Point Iteration---- Successive Approximation Many problems also take on the specialized form: g(x)=x, where we

Fractals

Images result when we deal with 2-dimensions.Such as complex numbers.Color indicates how quickly it converges or diverges.

Page 4: Numerical Methods Root Finding 4. Fixed-Point Iteration---- Successive Approximation Many problems also take on the specialized form: g(x)=x, where we

Simple Fixed-Point Iteration

Rearrange the function f(x)=0 so that x is on

the left-hand side of the equation: x=g(x)

Use the new function g to predict a new value

of x - that is, xi+1=g(xi)

The approximate error is given by:

a x i1 x ix i1

100%

Page 5: Numerical Methods Root Finding 4. Fixed-Point Iteration---- Successive Approximation Many problems also take on the specialized form: g(x)=x, where we

Fixed-point iterations

Page 6: Numerical Methods Root Finding 4. Fixed-Point Iteration---- Successive Approximation Many problems also take on the specialized form: g(x)=x, where we

xxg

or

xxg

or

xxg

xxxxf

21)(

2)(

2)(

02)(2

2

Example:

Page 7: Numerical Methods Root Finding 4. Fixed-Point Iteration---- Successive Approximation Many problems also take on the specialized form: g(x)=x, where we

Iterative Solution

1. Start with a guess say x1=1,

2. Generate a) x2=e-x1

= e-1= 0.368

b) x3=e-x2= e-0.368 = 0.692

c) x4=e-x3= e-0.692=0.500

In general:

After a few more iteration we will get

nxn

ex

1

56705670 .. e

Find the root of

f(x) = e-x – x

Page 8: Numerical Methods Root Finding 4. Fixed-Point Iteration---- Successive Approximation Many problems also take on the specialized form: g(x)=x, where we

Problem

Find a root near x=1.0 and x=2.0

Solution:

Starting at x=1, x=0.292893 at 15th iteration Starting at x=2, it will not converge Why? Relate to g'(x)=x. for convergence g'(x) < 1

Starting at x=1, x=1.707 at iteration 19 Starting at x=2, x=1.707 at iteration 12 Why? Relate to

142 2 xxxf

412

21 xxgx

212 xxgx

21

212 xxg

Page 9: Numerical Methods Root Finding 4. Fixed-Point Iteration---- Successive Approximation Many problems also take on the specialized form: g(x)=x, where we

Examples

Page 10: Numerical Methods Root Finding 4. Fixed-Point Iteration---- Successive Approximation Many problems also take on the specialized form: g(x)=x, where we

Fixed Point Iteration

The The equation f(x) = 0, where f(x) = x3 7x + 3, may be re-arranged

to give x = (x3 + 3)/7.

-4

-3

-2

-1

0

1

2

3

4

-5 -4 -3 -2 -1 0 1 2 3 4 5

x

y

y = x

y = (x3 + 3)/7

Intersection of the graphs of y = x and y = (x3 + 3)/7 represent roots of the original equation x3 7x + 3 = 0.

Page 11: Numerical Methods Root Finding 4. Fixed-Point Iteration---- Successive Approximation Many problems also take on the specialized form: g(x)=x, where we

The rearrangement x = (x3 + 3)/7 leads to the iteration

To find the middle root , let initial approximation x0 = 2.

Fixed Point Iteration

The iteration slowly converges to give = 0.441 (to 3 s.f.)

...,3,2,1,0,7

33

1

nx

x nn

57143.17

32

7

3 330

1

x

x

etc.etc.

98292.07

357143.1

7

3 331

2

x

x

56423.07

398292.0

7

3 332

3

x

x

45423.07

356423.0

7

3 333

4

x

x

Page 12: Numerical Methods Root Finding 4. Fixed-Point Iteration---- Successive Approximation Many problems also take on the specialized form: g(x)=x, where we

The rearrangement x = (x3 + 3)/7 leads to the iteration

For x0 = 2 the iteration will converge on the middle root , since g’()

< 1.

0

0.5

1

1.5

2

0 0.5 1 1.5 2x

y

Fixed Point Iteration

n x n

0 21 1.571432 0.982923 0.564234 0.454235 0.441966 0.44097 0.440828 0.44081

= 0.441 (to 3 s.f.)

x0x2 x1

...,3,2,1,0,7

33

1

nx

x nn

x3

y = (x3 + 3)/7

y = x

Page 13: Numerical Methods Root Finding 4. Fixed-Point Iteration---- Successive Approximation Many problems also take on the specialized form: g(x)=x, where we

Fixed Point Iteration - breakdown

The rearrangement x = (x3 + 3)/7 leads to the iteration

For x0 = 3 the iteration will diverge from the upper root .

n x n

0 31 4.285712 11.67393 227.7024 16865595 6.9E+17

0

2

4

6

8

10

0 2 4 6 8 10

x

y

The iteration diverges because g’() > 1.

x0 x1

...,3,2,1,0,7

33

1

nx

x nn

Page 14: Numerical Methods Root Finding 4. Fixed-Point Iteration---- Successive Approximation Many problems also take on the specialized form: g(x)=x, where we

Example: fixed point problems

Page 15: Numerical Methods Root Finding 4. Fixed-Point Iteration---- Successive Approximation Many problems also take on the specialized form: g(x)=x, where we

Examples: FPI

Page 16: Numerical Methods Root Finding 4. Fixed-Point Iteration---- Successive Approximation Many problems also take on the specialized form: g(x)=x, where we

Example: FPI

Page 17: Numerical Methods Root Finding 4. Fixed-Point Iteration---- Successive Approximation Many problems also take on the specialized form: g(x)=x, where we

Convergence of FPI

Page 18: Numerical Methods Root Finding 4. Fixed-Point Iteration---- Successive Approximation Many problems also take on the specialized form: g(x)=x, where we

Birge – Vieta Method

Used for finding roots of polynomial functions.

Uses “synthetic division” of polynomial to

extract factor of the given polynomial in the

form of (x – p).

Page 19: Numerical Methods Root Finding 4. Fixed-Point Iteration---- Successive Approximation Many problems also take on the specialized form: g(x)=x, where we

b1=a1+p0b0

Problem: Find roots of f (x) = 2x³ – 5x + 1 using Birge – Vieta Method.

Solution: Assume that x = 1 is root of the equation.

Hence initial approximation of the solution is p0 = 1.

Synthetic Division will be performed as below:

Let f (x) = a0x3 + a1x2 + a2x + a3

p0 a0 a1 a2 a3

b0 b1 b2 b3

c0 c1 c2 c3

p0b0 p1b1 p2b2

p0

s i m i l a r l y p1 = p0 – b3/c2

Repeat synthetic division using p1

Page 20: Numerical Methods Root Finding 4. Fixed-Point Iteration---- Successive Approximation Many problems also take on the specialized form: g(x)=x, where we

Birge-Vieta Method

NR method with f(x) and f'(x) evaluated using Horner’s method

Once a root is found, reduce order of polynomial

2 10 1 2 1 2 0 0

m mm mf x a a x a x a x x r b b x b x b x r h x b

1 1, 2, ,1,0m m

j j j

b a

b a rb j m m

f x h x x r h x

f r h r

1 21 2 2 3 1

m mm mh x b b x b x x r c c x c x c

1 1, 2, ,1m m

j j j

c b

c b rc j m m

0

1

f r b

f r h r c

Page 21: Numerical Methods Root Finding 4. Fixed-Point Iteration---- Successive Approximation Many problems also take on the specialized form: g(x)=x, where we

1 2 0 -5 1

2 2 -3 -2

2 4 1 -1

1

2 2 -3

2 4 1

Iteration No. 1:

3 2 0 -5 1

2 6 13 40

2 12 49 187

3

6 18 39

6 36 147

Iteration No. 2:

p1 = p0 – b3/c2 = 1 – (-2)/1 = 3

Not required

p2 = p1 – b3/c2 = 3 – 40/49 = 2.1837

Page 22: Numerical Methods Root Finding 4. Fixed-Point Iteration---- Successive Approximation Many problems also take on the specialized form: g(x)=x, where we

1.5185 2 0 -5 1

2 3.037 -0.3883 0.4104

2 6.074 8.8351

1.5185

3.037 4.6117 -0.5896

3.037 9.2234

Iteration No. 5:

1.4721 2 0 -5 1

2 2.9442 -0.6658 0.01986

2 5.8884 8.0025

1.4721

2.9442 4.3342 -0.9801

2.9442 8.6683

Iteration No. 6:

p5 = p4 – b3/c2 = 1.5185 – 0.4104/8.8351 = 1.4721

p6 = p5 – b3/c2 = 1.4721 – 0.01986/8.0025 = 1.469624

Page 23: Numerical Methods Root Finding 4. Fixed-Point Iteration---- Successive Approximation Many problems also take on the specialized form: g(x)=x, where we

the equation x3+x2-3x-3 using Birge-Vieta Method where x0 = 2.Using the synthetic division,2|1         1              -3            -3  |           2              6              6

  |1         3              3              3¬f(x0)  |           2              10

  |1         5              13¬f ’(x0)

Now, x1 = 2 – 3/13 = 1.7692

Page 24: Numerical Methods Root Finding 4. Fixed-Point Iteration---- Successive Approximation Many problems also take on the specialized form: g(x)=x, where we

Examples

Determine the lowest positive root of: f(x) = 8 e-x sin

(x) - 1 Using the Newton-Raphson method (three

iterations, x0 = 0.3) and Using the secant method

(four iterations, x-1 = 0.5 and x0 = 0.4). Using the

modified secant method (three iterations, x0 = 0.3,

d = 0.01).

Page 25: Numerical Methods Root Finding 4. Fixed-Point Iteration---- Successive Approximation Many problems also take on the specialized form: g(x)=x, where we

Summary

Method Pros ConsBisection - Easy, Reliable, Convergent

- One function evaluation per iteration- No knowledge of derivative is needed

- Slow- Needs an interval [a,b] containing the root, i.e., f(a)f(b)<0

Newton - Fast (if near the root)- Two function evaluations per iteration

- May diverge- Needs derivative and an initial guess x0 such that f’(x0) is nonzero

Secant - Fast (slower than Newton)- One function evaluation per iteration- No knowledge of derivative is needed

- May diverge- Needs two initial points guess x0, x1 such that f(x0)- f(x1) is nonzero