

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Deadline: March 18(Fri) in class. The problems will be graded selectively. Problems marked with (*) are more challanging, extra points will be awarded for them.
If a = 0 and b = 1, how many steps of the bisection method are needed to determine the root, if the absolute error is ≤ 10 −^8?
Given a function f (x) = e−x^ − cos(x). We want to find a root r such that f (r) = 0.
(a). First, show that there is a root in the interval [1. 1 , 1 .6].
(b). Now we try to locate this root by fixed point iteration. First, we observe that f (x) = 0 is equivalent to x = g(x) = f (x) + x. What is your iteration scheme? Let x 0 = 1.6, and do 4 iterations to compute x 1 , x 2 , x 3 , x 4. What is your result? Does the method converge? Why?
(c). We observe that f (x) = 0 is also equivalent to x = g(x) = x − f (x). What is your iteration scheme? Let x 0 = 1.6, and do 4 iterations to compute x 1 , x 2 , x 3 x 4. What is your result? Does the method converge? Why?
(d). Consider the iteration scheme: xn+1 = 12 xn + (^) x^1 n with initial value x 0 = 1. What is limn→∞ xn if it converges? Does the method converge? Why?
As you have seen at the lecture, the computation of
R can be done by finding the root of f (x) = x^2 − R = 0 with Newton’s method.
a). Verify that the iteration scheme would be
xn+1 =
( xn +
xn
) .
Show that the sequence {xn} satisfies the following
x^2 n+1 − R =
[ x^2 n − R 2 xn
] 2 .
Interpret this equation in terms of quadratic convergence.
b). Now we test the iterations for R = 10. Choose x 0 = 3, and compute x 1 , x 2 x 3 and x 4. Use 8 digit in your computation. What is your result?
It is clear that f (x) = (x − 1)m^ has a root at r = 1 for any positive integer m. Compute this root by Newton’s method for m = 8, use x 0 = 1.1(which is very close to the root). Do 4 iterations to get x 1 , x 2 , x 3 , x 4. Does the method work well here? Can you explain why?
If we use secant method on f (x) = x^3 − 2 x + 1 with x 0 = 4 and x 1 = 2, what is x 2 , x 3 and x 4? Does the method converge? (You can easily check that x = 1 is a root.)
Preparation: Use “help sprintf” and “help disp” in Matlab to understand how to use “sprintf” and “disp” to display the data. Here is an example:
disp(sprintf(’I have n=%d and x=%g but f=%f.\n’,2,1.22, 1.22))
This will give the following result in Matlab:
I have n=2 and x=1.22 but f=1.220000.
The problem: Write a Matlab function for Newton’s method. Your file newton.m should start with:
function x=newton(f,df,x0,tol,nmax)
where f,df are the function f and its derivative f ′, x0 is the initial guess, tol is the error tolerance, nmax is the maximum number of iterations, and x is the result. Use sprintf and “disp” to display your result in each iteration so you can check the convergence along the way. Test your function with the example 7 on page 37 in text book. Find a root of f (x) = e−x^ − cos(x) in the interval [1. 1 , 1 .6] with your Matlab function. Use tol=1e-12 and nmax=10. What is your answer?
What to hand in: Print out your files newton.m, files for functions f (x) and f ′(x), test results for the example in the book, and the result for f (x) = e−x^ − cos(x).