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

This question related to Numerical Anlysis. Please solve this question step by s

ID: 3892436 • Letter: T

Question

This question related to Numerical Anlysis. Please solve this question step by step and make it clear to understand. Please send clear picture. Thanks!
#2. Modify the provided Matlab code for the bisection method to incorporate Inputs: f, a, b, TOL, itmax Stopping criterion: Relative error S TOL or k S itmax Consider the following equations defined on the given intervals: L. 3x-e 0, [1,2] II. 2x cos(2.x) (x +1)2-0, [-1,0] For each of the above equations, a. Use Maple to find the analytic solution p on the interval. b. Find the approximate root by using your Matlab with TOL-106, imax-10. , forn 2 1, in a table format. Report p«P-?Pa-pn-ll

Explanation / Answer

Due to the unclear meaning of variables p's, a matlab solution to the bisection method for both the functon is being provided here. Though, all the relevent values can be extracted from the steps provided. In case of any clarification, if required, please comment.

%================================================================

clear all;
clc;
% Declaration of first function in terms of variable x
f1=@(x) (3*x)-exp(x);         
% Declaration of second function in terms of variable x
f2=@(x) (2*x*cos(2*x) - (x+1)^2);

l1=[1 2];   % Limits for first function
l2=[-1 0]; % Limits for second function

itmax=10;       % Iteration value
tol=10^(-6);    % Tolerance value
%==== Calculation for f1 ====
ll=l1(1);
ul=l1(2);
i=1;
while(i<=10)
bisect=(ll+ul)/2;
if(abs(f1(bisect))<=tol)
    break;
else
if(f1(ll)*f1(bisect)<0)
ul=bisect;
else
ll=bisect;  
end
end
i=i+1;
end
sol_f1=bisect; % Final Solution variable for first function
%==== Calculation for f2 ====
ll=l2(1);
ul=l2(2);
i=1;
while(i<=10)
bisect=(ll+ul)/2;
if(abs(f2(bisect))<=tol)
    break;
else
if(f2(ll)*f2(bisect)<0)
ul=bisect;
else
ll=bisect;  
end
end
i=i+1;
end
sol_f2=bisect; % Final Solution variable for second function

%===========================================================================

Solution for f1 = 1.5127

Solution for f2 = -0.7979

NOTE: For the given number of iteration, it is not possible to get the roots within the given tolerance, though with increased number of iterations, it can be achieved.

Hope this helps!

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote