Question: Due to what error (round-off or truncation) does the result for N 40 no longer improve when increasing N? MY FUNCTION function [y,tre] = myLnx(x,N)

Due to what error (round-off or truncation) does the result for N 40 no longer improve when increasing N?

MY FUNCTION

function [y,tre] = myLnx(x,N) %Input: %x: argument of ln(x) %N: number of terms to use %Output: %y: value of ln(x) %tre: true relative error

%initialize running sum or lower bound of sum y = 0;

for n = 0:N y = y+(2.*(x-1).^(2*n+1))./((2*n+1).*(x+1).^(2*n+1)); end

%calculate true relative error tre = (Log(x)-y)./Log(x);

end

%save the above function and run the following code

x = 4.5; % given in the problem

for N= [10 20 30 40 50] [y,tre] = myLnx(x,N); fprintf('N=%i: estimate for Ln(x) = %+16.15e, true relative error = %+16.15e ',... N,y,tre); end

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!