Top Banner
42

- + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)

Dec 22, 2015

Download

Documents

Marilyn Black
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)
Page 2: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)

ab

f(b)

f(a)

f(x)

xp

0

-

+

Page 3: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)

Suppose f(x) is a continuous function of x within interval [a, b].

f(a) = - ive and f(b) = + ive

There exist at least a number p in [a, b] with f(p) = 0.

Meaning, p is a root of the equation f(x) = 0

Page 4: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)

ab

f(b)

f(a)

f(x)

xp

0

-

+

Page 5: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)

The Bisection Method calls for a repeated halving of subintervals of [a, b]

each time locating the half containing p.

Bisection Method

(Binary Search)

Page 6: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)

a = a1

b = b1

a1b1p1

f(b1)

f(a1)

f(p1)

a2 b2p2

f(p2)

a3 b3p3

f(x)

x

Bisection Algorithm

Page 7: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)

Set a1 = a and b1 = b.

Find the midpoint between a1 and b1.

Midpoint,

2

bap 11

1

Page 8: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)

If f(p1) = 0, then p1 is the root of the equation within [a, b].

If f(p1) 0, then what?

Then find if f(p1) has the same sign as either f(a1) or f(b1).

Page 9: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)

a = a1

b = b1

a1b1p1

f(b1)

f(a1)

f(p1)

a2 b2p2

f(p2)

a3 b3p3

f(x)

x

Bisection Algorithm

Page 10: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)

IF f(p1) has the same sign as f(a1) , then the root is in [p1, b1]. Set a2 = p1 and b2 = b1.

IF f(p1) has the same sign as f(b1) , then the root is in [a1, p1]. Set a2 = a1 and b2 = p1.

Page 11: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)

The root is in the interval [a2, b2]. Divide the interval in two halves and repeat the process.

Page 12: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)

When do we stop?

εpp 1NN

εp

pp

N

1NN

εpf N

Page 13: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)

0104 23 xx)x(f hasa root in [1, 2].

n an pn bn1 1.0 (-) 1.5 (+) 2.0 (+)

2 1.0 (-) 1.25 (-) 1.5 (+)

3 1.25 (-) 1.375 (+) 1.5 (+)

4 1.25 (-) 1.3125 (-) 1.375 (+)

5 1.3125 (-) 1.34375 (-) 1.375 (+)

Page 14: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)

The Method of False Position

The method is based on bracketing the root between two points.

At the beginning choose two points, 0 1 and p p

so that 0 1 0f p f p

Now draw a line joining 0 0 1 1 and p , f p p , f p

The x-intercept of the line is 2p

Page 15: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)
Page 16: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)
Page 17: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)
Page 18: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)

Now bracket the root between either 0 2 1 2 or p , p p , p

Which pair to choose?

0 2If 0 then choosef p f p 0 2p , p

1 2if 0 then choosef p f p On the other hand

1 2p , p

Let us assume that 0 2 0f p f p

This means that the root is between 0 2p , p

Page 19: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)

Now draw a line joining 0 0 2 2 and p , f p p , f p

The x-intercept of the line is 3p

and the process continues …

Page 20: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)
Page 21: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)
Page 22: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)
Page 23: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)
Page 24: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)
Page 25: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)
Page 26: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)
Page 27: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)
Page 28: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)

0104 23 xx)x(f hasa root in [1, 2].

n1 1.26316

2 1.33883

3 1.35855

4 1.36355

5 1.36481

np

Page 29: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)

Fixed-Point Iteration

Rewrite f(x) = 0 in the form of x = g(x) and iterate.

0104 23 xx)x(f has

a root in [1, 2].

Page 30: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)

We can rewrite f(x) in the form of x = g(x) in the following ways.

2

1

4

2

13

3

2

1

2

231

410(d)

102

1(c)

410(b)

104(a)

x/)x(gx

x)x(gx

xx/)x(gx

xxx)x(gx

Page 31: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)

104(a) 231 xxx)x(gx

Start with x = 1.5

8750

10514515151 231

.

...).(gx

7326

108750487508750

875023

1

.

...

).(gx

Page 32: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)

Results of the Fixed-point Iteration

n (a) (b) (c) (d)

1 1.5 1.5 1.5 1.5

2 -0.875 0.8165 1.2869537 1.3483997

3 6.732 2.9969 1.4025408 1.3673763

4 -469.7 1.3454583 1.3649570

5 1.3751702 1.3652647

6 1.3600941 1.3652255

7 1.3678469 1.3652305

8 1.3638870 1.3652299

9 1.3659167 1.3652300

810031 . 21658.

Page 33: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)

Why some expressions failed to deliver the root?

To deliver the root, g(x) for all x in [a, b] must stay within [a, b].

b g a a

b g b a

Page 34: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)

p0

p

(p0, f(p0))

p2

p1

0pf slope

1pf slope f(x)

x

f(x)

(p1, f(p1))

Newton’s Method

Page 35: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)

Consider the triangle (p2, 0), (p1, 0) and (p1, f(p1)).

Page 36: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)

Newton’s Method

p0

p

(p0, f(p0))

p2

p1

0pf slope

1pf slope f(x)

x

f(x)

(p1, f(p1))

Page 37: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)

Consider the triangle (p2, 0), (p1, 0) and (p1, f(p1)).

(p2, 0) (p1, 0)

(p1, f(p1))

1pf slope

Page 38: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)

(p2, 0) (p1, 0)

(p1, f(p1))

1pf slope

The slope,

21

11 pp

pfpf

Page 39: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)

11 2

1

or, f p

p pf p

12 1

1

or, f p

p pf p

Page 40: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)

A sequence can be generated as:

-1n

-1n-1nn pf

pfpp

Page 41: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)

Example:

8x3xxf

104xxxf2

23

11pf5pf1p 111

4551

11

51

pf

pfpp

1

112 .

Page 42: - + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)

17.991pf1.548pf1.455p 222

3691

99117

54814551

pf

pfpp

2

223 .

.

..

3651

57416

06203691

pf

pfpp

3

334 .

.

..