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

Here is the question.. A mathematics student has determined that the following a

ID: 1862733 • Letter: H

Question

Here is the question..

A mathematics student has determined that the following alternating series of terms summed to infinity produces the numerical value of In (2) 1-1/2+1/3-1/4+1/5-1/6+.... Use the approach we discussed in class to develop a MATLAB script for generating an algorithm an estimation of ln(2), and compares it to the 'exact' value of ln(2) computed with MATLAB's built-in function. Submit your script. Comment on the convergence rate About how many terms do you need to compute In (2) to within an absolute error (tolerance) of 0.005?

Explanation / Answer

a)


clear all

clc

format long

n=56;

x=2;

fex=1;

for i=2:n

fex=fex+(-1)^(i-1)/i;

end

fex


b) the soloution is not convergent , it keeps on oscillating about a value but the amount of oscillation goes on decreasing

c) About 101 terms

Here is a code to estimate that

clear all

clc

format long

error=0.01;

n=10;

while(error > 0.005)


x=2;

fex=1;

for i=2:n

fex=fex+(-1)^(i-1)/i;

end

error=abs(fex - log(2));

n=n+1

end

fex

n