Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Problem 1: Obtain an estimate to the solution of this equation (Use Radian) x-0.

ID: 1885295 • Letter: P

Question

Problem 1: Obtain an estimate to the solution of this equation (Use Radian) x-0.8 0.2 sin(*) (a) Using Graphical solution (b) Using false positioning method Use [0.5, 1.0] as the initial interval and compute the (c) Using Bisection method. Use [0.5,1.0] as the initial interval and compute the solution (d) How many Bisection iterations are needed to get the solution correct to Three decimal (e) Using Newton-Raphson method. Start with x=0.9 as an initial guess and do four (f) Using Simple fixed point iteration. Start with x-0.9 as an initial guess and do four (g) using Secant method. Use the following an initial points x0 0.8: x0.9 and do four solution correct to two decimal digits correct to two decimal digits rounded digits rounded. iterations. Give an estimate of the absolute error. iterations. Give an estimate of the absolute error iterations. Give an estimate of the relative error. rounded.

Explanation / Answer

a)

x=[0:0.01:2];

y1=0.2*sin(x);

y2=x-0.8;

idx = find(y1 - y2 < eps, 1); %// Index of coordinate in array

px = x(idx);

py = y1(idx);

plot(x,y1,x,y2,px,py,'ro');

b)

xl=0.5;

xu=1;

e=0.001;

if (xl-0.8-0.2*sin(xl))<0

xn=xl;

xp=xu;

else

xn=xu;

xp=xl;

end

xm=xl;

while (abs(xm-0.8-0.2*sin(xm))>e)

xm=(xn*(xp-0.8-0.2*sin(xp))-xp*(xn-0.8-0.2*sin(xn)))/((xp-0.8-0.2*sin(xp))-(xn-0.8-0.2*sin(xn)));

if (xm-0.8-0.2*sin(xm))<0

xn=xm;

else

xp=xm;

end

end

Root=xm

function c = bisect(a, b, delta)

% Input: a the left endpoint of the interval

% b the right endpoint of the interval

% delta the tolerance/accuracy we desire

% Syntax: bisect(a, b, delta)

fa = f(a); %% compute initial values of f(a) and f(b)

fb = f(b);

if sign(fa) == sign(fb) %% sanity check: f(a) and f(b) must have different

%% signs

%%

%% the error function prints an error message and

%% exits

error('f must have different signs at the endpoints a and b. Aborting.')

end

fprintf('initial interval: a=%d, b=%d, fa=%d, fb=%d ',a,b,fa,fb)

  

%% main routine %%

  

while ( abs(b - a) > 2*delta ) %% While the size of the interval is

%% larger than the tolerance

c = (b + a)/2; %% Set c to be the midpoint of the interval

fc = f(c); %% Calculate the value of f at c

if sign(fc) ~= sign(fb) %% If f(c) and f(b) are of different sign, then

%% f must have a zero between c and b (by the

%% Intermediate Value Theorem).

a = c; fa = fc;

else %% This is the case where f(a) and f(c) are of

%% different sign.

%%  

b = c; fb = fc;

end

%% Repeat the algorithm on the new interval

fprintf(' a=%d, b=%d, fa=%d, fb=%d ',a,b,fa,fb)

end

function fx = f(x)

fx = x-0.8-0.2*sin(x); %% Enter your function here.

return;

Thank you, mention the doubts in the comments