Question: Please complete using MATLAB: The Bisection Method mentioned is the following: function [m k] = bisection(f,a,b,tol,kmax) % function [m k] = bisection(f,a,b,tol,kmax) % Given an

Please complete using MATLAB:

Please complete using MATLAB: The Bisection Method mentioned is the following: function

The Bisection Method mentioned is the following:

function [m k] = bisection(f,a,b,tol,kmax)

% function [m k] = bisection(f,a,b,tol,kmax)

% Given an interval [a,b] which brackets at least one root of

% a continuous function f, routine returns an approximate root

% m obtained via bisection algorithm. Other user inputs are an

% error tolerance tol and the maximum number kmax of allowed

% steps (total function evaluations then capped at kmax + 2).

% |m-r|

% on [a,b] and tol2 = tol + (machine epsilon)*max(|a|,|b|).

% Using tol2 instead of tol prevents loss of convergence if

% tol is smaller than the spacing of the floating point numbers

% between a and b (tol2 is adjusted with a and b). See Van

% Loan's textbook, p.280. tol=1e-8 and kmax = 1e5 are defaults,

% if left unspecified. Also returns the number k of bisections.

switch nargin

case 4,

kmax = 1e5;

case 3,

tol = 1e-8; kmax = 1e5;

case 5,

% Fall through.

otherwise,

error('bisection called with incorrect number of arguments')

end

if b

error('b > a not satisfied');

end

%

2. Consider f(x)=8x(x21)3. (a) What is the multiplicity of the root r=21 ? Theoretically, find the backward and relative forward errors associated with the approximate root rA=501/1000. What is the error magnification? (b) Run the Bisection Method with starting interval [41,2] to find an approximate root with as many correct digits as possible. Numerically, what are the backward and relative forward errors? The error magnification? (c) Repeat part (b), but now use the expanded form 8x412x3+6x2x of the function. How many correct digits can be achieved now? Can you explain the results

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!