Question

In: Advanced Math

Determine the positive real root of ln(x^2)=0.8 by the following methods. (Note that you need to...

Determine the positive real root of ln(x^2)=0.8 by the following methods. (Note that you need to show the details of your derivations in MATLAB).

a) Graphically ( plot the function and copy your figure to word).

b) Using two iterations of the bisection method with initial guesses of xl=0.4 and xu=2 and populate the following table. What is the root after two iterations? Provide justification for the values you have obtained in your MATLAB code as comments.

i xl xu xr

1 0.4 2

2

c) Using two iterations of the false position method, with the same initial guesses as in b) and populate the table below. What is the root after two iterations? Provide justification for the values you have obtained in your MATLAB code as comments.

i xl xu xr

1 0.4 2

2   

d) Compute the actual root of the function (use a built in MATLAB function) and identify which method (bisection or false position) achieves a better estimate of the root after two iterations. Prove your answer by calculating the True Percentage Error ( Assume that your answer in part d, obtained using the MATLAB Built in Function is the true value ). ALL Calculations must be performed in MATLAB.

Solutions

Expert Solution

We have developed a MATLAB code (single code for all problem) for all the problems.

--------------------MATLAB code--------------------

f=@(x) log(x.^2)-0.8; % defining function;

% answer of (a)
x=0.4:0.001:2; % discretized value of x in [0.4,2];
y=f(x); % computing function values.
plot(x,y,'LineWidth',1.25);
set(gca,'XAxisLocation','origin');
set(gca,'YAxisLocation','origin');

% answer of (b): Bisection method.
n=5; % number of iterations;
  
xl=0.4; % lower value of the initial interval;
xu=2; % lower value of the initial interval;
xr=(xl+xu)/2; % new root % mid-point of the initial interval;
  
A_bisec(1,:)=[1 xl xu xr f(xr)]; % storing the the values;
it=1; % iteration number;
  
while it<n
it=it+1; % updating iteration number;
  
if f(xl)*f(xr)<0 % updating interval
xu=xr;
elseif f(xr)*f(xu)<0
xl=xr;
end
xr=(xl+xu)/2; % new root
A_bisec(it,:)=[it xl xu xr f(xr)];
end
  
VarNames = {'Iteration','xl','xu','xr','f_xr'}; % creating table to display all datails
TT=table(A_bisec(:,1),A_bisec(:,2),A_bisec(:,3),A_bisec(:,4),A_bisec(:,5), 'VariableNames',VarNames);
disp(TT);
xr_bisec=xr;
fprintf('\nRoot using Bisection method after %d iterations is: %g\n\n',n,xr_bisec);

% answer of (c): false position method;
n=5;
  
xl=0.4;
xu=2;
xr=(xl*f(xu)-xu*f(xl))/(f(xu)-f(xl)); % new root
  
A_false(1,:)=[1 xl xu xr f(xr)]; % storing the the values;
it=1; % iteration number;
  
while it<n
it=it+1; % updating iteration number;
  
if f(xl)*f(xr)<0 % updating interval
xu=xr;
elseif f(xr)*f(xu)<0
xl=xr;
end
xr=(xl*f(xu)-xu*f(xl))/(f(xu)-f(xl)); % new root
A_false(it,:)=[it xl xu xr f(xr)];
end
  
VarNames = {'Iteration','xl','xu','xr','f_xr'}; % creating table to display all datails
TT1=table(A_false(:,1),A_false(:,2),A_false(:,3),A_false(:,4),A_false(:,5), 'VariableNames',VarNames);
disp(TT1);
xr_false=xr;
fprintf('\nRoot using False Position method after %d iterations is: %g\n\n',n,xr_false);
  
% answer of (d): MATLAB inbuilt function
xr = fzero(f,2);
fprintf('Root using MATLAB function is: %g\n\n',xr);
fprintf('Percentage error for Bisection method after %d iterations is=%g %%\n\n',n,100*abs(xr-xr_bisec)/xr);
fprintf('Percentage error for False Position method after %d iterations is=%g %%\n\n',n,100*abs(xr-xr_false)/xr);
  

Output for 5 iterations: (You can obtained the desired number of iterations by changing the value of n in the code)


Related Solutions

Determine the real root of f (x) = −25 + 82x − 90x2 + 44x3 −8x4...
Determine the real root of f (x) = −25 + 82x − 90x2 + 44x3 −8x4 + 0.7x5: Using python in bisection to determine the root to s = 10%. Employ initial guesses of xl = 0.5 and xu = 1.0; pls use python
The Polynomial f(x) = X^3 - X^2 - X -1 has one real root a, which...
The Polynomial f(x) = X^3 - X^2 - X -1 has one real root a, which happens to be positive. This real number a satisfies the following properties: - for i = 1,2,3,4,5,6,7,8,9,10, one has {a^i} not equal to zero - one has [a] = 1, [a^2] = 3, [a^3] = 6, [a^4] = 11, [a^5] = 21, [a^6] = 7, [a^7] = 71, [a^8] = 130 (for a real number x, [x] denotes the floor of x and {x}...
2. Evaluate the following limits. (a) lim x→1+ ln(x) /ln(x − 1) (b) limx→2π x sin(x)...
2. Evaluate the following limits. (a) lim x→1+ ln(x) /ln(x − 1) (b) limx→2π x sin(x) + x ^2 − 4π^2/x − 2π (c) limx→0 sin^2 (3x)/x^2
Using the definition of an anti-derivative, prove that x (ln x)3 – 3x (ln x)2 +...
Using the definition of an anti-derivative, prove that x (ln x)3 – 3x (ln x)2 + 6x (ln x) – 6x is an anti-derivative of (ln x)3 (must show all work)
1114) intg{ 2x ln(x^2) dx } = (Ax^B)*(ln(x^2)+F) + C. Determine A,B,F. ans:3 1130) Evaluate intg_9_17{...
1114) intg{ 2x ln(x^2) dx } = (Ax^B)*(ln(x^2)+F) + C. Determine A,B,F. ans:3 1130) Evaluate intg_9_17{ (x^2 - 4x + 7) dx }. ans:1 1132) Integrate from 3 to 7 the function: ( 1 / (x^2 + 9x) ). Calculate a floating-point value. ans:1
A positive number is added to the reciprocal of its square root. Use Calculus methods to...
A positive number is added to the reciprocal of its square root. Use Calculus methods to answer the following questions:what if anything, is the smallest such sum? What, if any, positive x-values will yield the smallest sum? Give exact answers as well as answers accurate to Five decimal place. Be sure to give a mathematical justification that you answer represents a minimum and not a maximum.
GIVEN: COS(x) +3xe^-x=0 USING NEWTON RAPHSON METHOD Find: 1.) The POSITIVE ROOT USING X0=2 2.) THE...
GIVEN: COS(x) +3xe^-x=0 USING NEWTON RAPHSON METHOD Find: 1.) The POSITIVE ROOT USING X0=2 2.) THE NEGATIVE ROOT USING X0=-0.5 *STOPPING CRITERION ≤ 0.01% use radian mode in calcu and i dont want a program answers pls i need the manual method.
prove that f(x)=x^2019 +x-1 has only one real root
prove that f(x)=x^2019 +x-1 has only one real root
show that the equation 2x+2 cos x+5=0 has exactlly one real root
show that the equation 2x+2 cos x+5=0 has exactlly one real root
Which of the following is sufficient for 2 methods to overload? Note: sub/super means the methods...
Which of the following is sufficient for 2 methods to overload? Note: sub/super means the methods are in two classes that are in an inheritance relationship. Select one: a. Same signature, same class b. Different signature but same name, same class c. Different signature including different name, same class d. Different signature but same name, sub/super class e. If you think more than one of the above are sufficient for 2 methods to overload, select this option [Java]
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT