Numerical Computations: HW 5 Solutions - Bisection, Fixed Point, and Newton's Methods, Assignments of Mathematics

Solutions to homework 5 of the cse/math 451: numerical computations course, focusing on the bisection method, fixed point iteration, and newton's method. It includes the number of iterations required, the iteration schemes, and the convergence analysis for each method.

Typology: Assignments

Pre 2010

Uploaded on 09/24/2009

koofers-user-lu0
koofers-user-lu0 🇺🇸

9 documents

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CSE/MATH 451: Numerical Computations, spring 2005
Answers to home work 5
1 Bisection method
For the bisection method, if eis the error tolerance, the number of iteration must satisfy (see
text book)
nlog(ba)log(2e)
log(2)
In our case we have e= 108,a= 0 and b= 1, set these in we get n25.57. So we need at
least 26 iterations.
2 Fixed point iteration
a). One can easily check that there is a root in the interval [1.1,1.6], because f(1.1) =
0.1207 and f(1.6) = 0.2311. Since f(x) is continuous, then it must cross 0 at some
point between [1.1,1.6].
b). One can rewrite it as x=g(x) = f(x) + x=excos(x) + x. The iteration scheme
will then be:
xn+1 =g(xn) = exncos(xn) + xn.
Start with x0= 1.6, and do 4 iterations, and we get x1= 1.8311, x2= 2.2487, x3=
2.9814, x4= 4.0193. It is not converging to the root we are looking for, because
g0(x) = ex+ sin(x) + 1 is strictly bigger than 1 on the interval [1.1,1.6].
c). If one rewrite it as x=g(x) = f(x) + x=ex+ cos(x) + x. The iteration scheme
will then be:
xn+1 =g(xn) = exn+ cos(xn) + xn.
Start with x0= 1.6, and do 4 iterations, and we get x1= 1.3689, x2= 1.3150, x3=
1.2996, x4= 1.2948. It looks like it is converging. In fact, if we compute 5 more
steps, we will get x9=x8= 1.2927. The convergence is guaranteed because g0(x) =
exsin(x) + 1 satisfies 0 < g0(x)<1 on the interval [1.1,1.6]. Therefore by the
theorem it converges.
d). The limit value of the iteration is a fixed point for x=1
2x+1
x. By simply calculation
we find x=±2, if the method converges.
To see the convergence with x0= 1, we first write x=g(x) = 1
2x+1
x, and then we
have g0(x) = 1
21
x2. One easily see that |g0(x)|<1 on the interval [1,2] which contains
the root 2. Therefore the method converges.
1
pf3
pf4

Partial preview of the text

Download Numerical Computations: HW 5 Solutions - Bisection, Fixed Point, and Newton's Methods and more Assignments Mathematics in PDF only on Docsity!

CSE/MATH 451: Numerical Computations, spring 2005

Answers to home work 5

1 Bisection method

For the bisection method, if e is the error tolerance, the number of iteration must satisfy (see text book)

n ≥ log(b − a) − log(2e) log(2)

In our case we have e = 10−^8 , a = 0 and b = 1, set these in we get n ≥ 25 .57. So we need at least 26 iterations.

2 Fixed point iteration

a). One can easily check that there is a root in the interval [1. 1 , 1 .6], because f (1.1) = − 0 .1207 and f (1.6) = 0.2311. Since f (x) is continuous, then it must cross 0 at some point between [1. 1 , 1 .6].

b). One can rewrite it as x = g(x) = f (x) + x = e−x^ − cos(x) + x. The iteration scheme will then be: xn+1 = g(xn) = e−xn^ − cos(xn) + xn.

Start with x 0 = 1.6, and do 4 iterations, and we get x 1 = 1. 8311 , x 2 = 2. 2487 , x 3 =

  1. 9814 , x 4 = 4.0193. It is not converging to the root we are looking for, because g′(x) = −e−x^ + sin(x) + 1 is strictly bigger than 1 on the interval [1. 1 , 1 .6].

c). If one rewrite it as x = g(x) = −f (x) + x = −e−x^ + cos(x) + x. The iteration scheme will then be: xn+1 = g(xn) = −e−xn^ + cos(xn) + xn. Start with x 0 = 1.6, and do 4 iterations, and we get x 1 = 1. 3689 , x 2 = 1. 3150 , x 3 =

  1. 2996 , x 4 = 1.2948. It looks like it is converging. In fact, if we compute 5 more steps, we will get x 9 = x 8 = 1.2927. The convergence is guaranteed because g′(x) = e−x^ − sin(x) + 1 satisfies 0 < g′(x) < 1 on the interval [1. 1 , 1 .6]. Therefore by the theorem it converges.

d). The limit value of the iteration is a fixed point for x = 12 x + (^1) x. By simply calculation we find x = ±

2, if the method converges. To see the convergence with x 0 = 1, we first write x = g(x) = 12 x + (^1) x , and then we have g′(x) = 12 − (^) x^12. One easily see that |g′(x)| < 1 on the interval [1, 2] which contains the root

  1. Therefore the method converges.

3 Newton’s method

a). Using Newton’s method, with f (x) = x^2 − R og f ′(x) = 2x we get

xn+1 = xn − f (xn) f ′(xn)

= xn − x^2 n − R 2 xn

(xn + R/xn).

There we have

x^2 n+1 − R =

(xn + R/xn)^2 − R

4 x^2 n

[

x^4 n + 2x^2 nR + R^2 − 4 x^2 nR

]

4 x^2 n

[x^2 n − R]^2.

This means that the residual f (xn) = x^2 n − R has quadratic convergence.

f (xn+1) =

4 x^2 n

f (xn)^2. (1)

We want to show the same with the error, en := x − xn. From (1) we get

(xn+1 −

R)(xn+1 +

R) =

4 x^2 n

(xn −

R)^2 (xn +

R)^2

and xn+1 −

R =

4 x^2 n

(xn +

R)^2

xn+1 +

R

(xn −

R)^2

where (xn +

R)^2

xn+1 +

R

(xn +

R)^2

(x^2 n + R + 2xn

R)/ 2 xn

= 2xn,

and xn+1 −

R =

2 xn (xn −

(R))^2

which means that en+1 = −

2 xn

e^2 n

and therefore the mathod converges quadratically.

b). For R = 10, the iteration becomes:

xn+1 =

xn +

xn

With x 0 = 3, we get x 1 = 3. 1666667 , x 2 = 3. 1622807 , x 3 = 3. 1622776 , x 4 = 3.1622776. We see that it converges very quickly.

c). With f (x) = (x − 1)^8 and f ′(x) = 8(x − 1)^7 , Newton’s method becomes

xn+1 = xn −

f (xn) f ′(xn)

= xn −

(x − 1)^8 8(x − 1)^7

= xn − (xn − 1)/7 =

xn +

v=newton(’f’,’df’,3.0,1e-12,10) n xn f(xn) 0 3.000000 9.000000e+ 1 2.437500 2.036865e+ 2 2.213033 2.563634e- 3 2.175555 6.463361e- 4 2.174560 4.479068e- 5 2.174559 2.157385e- 6 2.174559 8.881784e- v =

In order to use Newton’s method on our function f , we need to define the files f1.m and df1.m. My f1.m looks like:

function y = f1(x) y=exp(-x)-cos(x);

and my df1.m looks like:

function y = df1(x) y=-exp(-x)+sin(x);

I get the following result:

v=newton(’f1’,’df1’,1.6,1e-12,10)

n xn f(xn) 0 1.600000 2.310960e- 1 1.310289 1.217111e- 2 1.292814 8.160649e- 3 1.292696 3.871718e- 4 1.292696 0.000000e+ v =

So after only 4 iteration the method got a very accurate approximation.