Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Problems for chapter 5

5.1 Bisection method

we consider the bisection method to ind a root for f (①) = o where f is a continuous function.  If f (o)  < o and f (1) 持 o, then there is a root on the interval [o, 1], and we take [o, 1] as the initial interval. How many steps of the bisection method are needed to obtain an approximation to the root, if the absolute error is guaranteed to be 三 1o-8? (Note that your answer does not depend on the actual function!)

5.2    Bisection in Matlab

(a). write a Matlab function that ind a root of a function on an interval [a, b] using bisection method. Your function should begin with

function r=bi网ectionf,a,b,tol,nmax)

X function r=bi网ectionf,a,b,tol,nmax)

X  input: f: function handle  or tring

X                        a,b:   the  interval where there  i网  a root

X                     tol:   error tolerance

X                         nmax:  max  number  of  iteration网

X  output:   r:  a root

please check the Matlab tutorial to ind out how to use a function handle @.

The function should check if f (a) . f (b)  三 o.  otherwise, an error message should be displayed. You are free to choose the stop criteria.

(b). consider the equation

9①4  + 18①3  + 38①2  — 57① + 14 = o

use the function bi网ection to ind a root on [o, 1]. what does your program give?

Find a root in the interval [o, o.5], and another one on [o.5, 1].  You may use an error tolerance of 1e — 6, and max 1oo iterations.

(c). use the function bi网ection to inda root of the equation tan ① = ① on the interval [1,2].  (Does the answer seems strange? can you explain why?)

(d). use your function bi网ection to determine the point of intersection of the curves given by g = ①3  — 2① + 1 and g = ①2 .

5.3    Fixed point iteration

Given a function f (①) = e-- cos(①). we want to ind a root T such that f (T) = O.

(a).  First show that there is a root inside the interval [1.1)1.6].

(b). Next, we try to locate this root by aixed point iteration. we observe that f (①) = O is equivalent to

① = g1 (①))     where       g1 (①) = f (①) + ①.

set up the corresponding ixed point iteration scheme. Then, choose the starting point ①0  = 1.6, and perform 4 iterations to compute the values ① 1234 .  what do you observe?Does the method converge why?

(c). we now observe that f (①) = O is also equivalent to

① = g2 (①))     where       g2 (①) = ① - f (①).

Based on this new function, setup the corresponding ixed point iteration.  choose again ①0  = 1.6 as your starting point , and perform 4 iterations to compute the values ① 1234. what is your result? How diferent is it from part (b)? Does the method converge? why?

5.4 More on ixed point iteration.

consider the iteration scheme:

n+1  = n + 0 = 1

(a). If the iteration converges, what is  limny…n

(b).  Does the method converge? why?

5.5 Newton,s method

As you have seen in Example 5.7 in section 5.4, the computation of ^R can be carried out by inding the root of f (①) = ①2  - R using Newton,s method.

(a).  check that in this case Newton,s iteration scheme is

n+1  = n + .

(b).  show that the sequence (①)Σ1 satisies

”(2)+1 - R = 2 .

Interpret this equation in terms of quadratic convergence.

Remark:  The quantity ”(2) - R  =  f (①)  is also called the  Tesidual.   It  gives  a

measure of the error in the approximation ①.

(c).  Now we test the iterations for R = 10.  choose 0 = 3, and compute 1 , 2 3  and 4. use 8 digits in your computation. comment on your result.

5.6    on Newton,s Method

Each of the following function has ^3R as a zero for any positive real number R. Deter- mine the formulas for Newton,s method for each and any necessary restrictions on the choice for 0 .

(a). a(①) = ①3  - R

(b).  b(①) = ①2  - R/①

(c). c(①) = 1 - R/①3

(d). d(①) = 1/①2  - ①/R

5.7 Newton,s Method in Matlab

preparation: use“help fprintf”in Matlab to understand how to use“fprintf” to display the data. Here is an example:

fprintf(,Ⅰ have n=xd  and  x=xg    but  f=xf.\n,,2,1.22,  1.22)

This will give the following result in Matlab:

Ⅰ  have  n=2  and  x=1.22    but  f=1.220000 .

The problem: write a Matlab function for Newton,s method. your ile mynewton.m should start with:

function x=mynewtonf,df,x0,tol,nmax)

Among the input variables, f,df are the function f and its derivative f , x0 is the initial guess, tol is the error tolerance, and nmax is the maximum number of iterations.  The output variable x is the result of the Newton iterations.  use  sprintf and“disp”to display your result in each iteration so you can check the convergence along the way.

First, test your function with Example 5.7 in section 5.4, computing^2.

Then, use your Matlab function to ind a root of f (①) = e-π  - cos(①) on the interval [1.1)1.6].  use tol=1e-12 and nmax=10.  You  should choose an initial guess 0   on the interval [1.1)1.6]. what is your answer?

what to hand in: submit your iles mynewton.m, iles for functions f (①) and f (①), script ile, test result for the example of ^2 and for the root off (①) = e-π  - cos(①).

5.8 when Newton,s Method Does not work well.

(i). Let m be a positive integer and consider the function

f (①) = (① - 1)m.

It is clear that T = 1 is a root (indeed, it is a root with multiplicity m). we now try to ind this root by Newton,s iteration, for m = 8.

(a).  set up the iteration scheme.

(b).  use ①0  = 1.1 as your initial guess (note that this is very close to the root T = 1). complete 4 iterations to compute the values ① 1234 .

(c).  How does the method work for this problem? Do we still have quadratic conver- gence? can you explain what is causing this?

(d). If m = 2o (or with any large value of m), can you predict the behavior of Newton,s iteration? what type of convergence will you get? Explain in detail.

(ii). use Newton,s method to solve the equation

o = + ①2  - ① sin(①) - cos(2①))with 0  = .

Iterate using Newton,s method until an accuracy of 1o-3  is obtained. Explain why the result seems unusual for Newton,s method.

5.9    some Modiied Newton,s Methods; Bonus

(a) To avoid computing the derivative at each step in Newton,s method, it has been proposed to replace f\ (①n) by f\ (0), i.e.,

f (①n)

n+1 = ①n - f\ (0) .

Derive the rate of convergence for this method.

(b) If the root  T of f (①)  =  O is  a double root,  i.e.,  f (T)  =  O  and  f\ (T)  =  O,  but

f\\ (T) O, the Newton,s method can be accelerated by using

n+1 = ①n - 2 .

show that this method is quadratically convergent. If the general case is hard to prove, the prove it for the example f (①) = ① (① - 1)2  where T = 1 is a double root.

Run a Matlab simulation with this method for a test case of your choice.  observe the convergence and comment on your results.

5.10    The secant method

a).  calculate an approximate value for 43/5  using the secant method with ①0 = 3 and ① 1  = 2.  Make 3 steps, and compute the values ①234. comment on your result.

b).  use secant method to ind the root for f (①) = ①3 - 2①+ 1 with ①0  = 4 and ① 1 = 2. compute the values 23  and 4 .  Does the method converge? (you can easily check that ① = 1 is a root.)

c).  consider the iteration scheme

n+1  = ①n + (2 - eπ )(①n - ①n-1 )/(eπ - eπ - 1 )) 0  = O) 1 = 1.

If the iteration converges, what is limn一凯n

5.11 The secant Method in Matlab

write a Matlab function to locate a root by the secant method.  your function should

be put in the ile mysecant.m, and should be called as

x=mysecantf,xo,x1,tol,nmax)

Here f is the function f , x0,x1 are the initial guesses, tol is the error tolerance, nmax is the maximum number of iterations, and x is the output of your function.

Test your function to ind the value ^2, as the root for f (①) = 2 - 2, to see if it works. use fprintf and“di网p”to display your result in each iteration, so you can check the convergence.  Then, use it to ind a root for the function f (①) = e-①  - cos(①) in the interval [1.1)1.6].  use tol=1e-12 and nmax=10.  your two initial guesses should be on the interval  [1.1)1.6].  How does the result compare to those with Newton,s method? comment in detail.

what to hand in: your ile my网ecant.m, test result for f (①) = ①2  - 2, and the result for f (①) = e-①  - cos(①).

5.12    some cubically convergent Methods

(a). using functions of your choice, verify numerically that the iterative method

f (①n)

n+1 = ①n - [f (①n)]2  - f (①n)f地地 (①n)

is cubically convergent at a simple root but only linearly convergent at a triple root.

(b). using functions of your choice, test numerically whether olver,s method

n+1  = n  - f(f)①(①)n(n) - f(f)地(地地)①(①)n(n) [ f(f)①(①)n(n)]2

is cubically convergent to a root of f. Try to establish that it is.

(c). Repeat (b) for Halley,s method

n+1  = ①n - where   an  = f(f)①(①)n(n) - f(f)地(地地)①(①)n(n)]