Consider the following Matlab code, which was written to reproduce a telescoping series
Mo=-1;
Mn=0;
n=1;
while (Mn-Mo)>0.00001
Mo=Mn;
Mn=Mn+1/n*(n+1);
n=n+1;
end
The code, as it appears above, does not yield the desired result. Identify what is wrong with the code, correct it, and report the resulting sum to four significant figures

Respuestas (1)

KSSV
KSSV el 14 de Ag. de 2020
n = 10000 ;
thesum = 0 ;
for i = 1:n
thesum = thesum+1/(n*(n+1)) ;
end

Categorías

Más información sobre MATLAB en Centro de ayuda y File Exchange.

Productos

Versión

R2019b

Etiquetas

Preguntada:

el 14 de Ag. de 2020

Respondida:

el 14 de Ag. de 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by