


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
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
1 / 4
This page cannot be seen from the preview
Don't miss anything!



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.
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 =
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 =
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
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 +
4 x^2 n
(xn −
R)^2 (xn +
and xn+1 −
4 x^2 n
(xn +
xn+1 +
(xn −
where (xn +
xn+1 +
(xn +
(x^2 n + R + 2xn
R)/ 2 xn
= 2xn,
and xn+1 −
2 xn (xn −
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.