# can anyone help explain to me ?

1 visualización (últimos 30 días)
diadalina el 17 de Nov. de 2019
Respondida: Walter Roberson el 17 de Nov. de 2019
I want to calculate the sum value of sn, with different manner, using matlab ,
its exact value is equal ,
the first way is:
the second way is :
if we talk about how the machine calculates, it is clear that we are not going to find the same result in relation to the exact value, but matlab gives me the same result, can anyone help me to find the error, this is my code matlab
%n=9,
%n=99,
n=999;
i=1:n;
format long
s1=1+sum(1./(i.^2+i));
s2=sum(1./(i.^2+i))+1;
s3=2+(1/(n+1));
s3 =
2.001000000000000
s1 =
1.498999999999999
s2 =
1.498999999999999
##### 0 comentariosMostrar -1 comentarios más antiguosOcultar -1 comentarios más antiguos

Iniciar sesión para comentar.

Walter Roberson el 17 de Nov. de 2019
s2=sum(fliplr(1./(i.^2+i)))+1;
##### 0 comentariosMostrar -1 comentarios más antiguosOcultar -1 comentarios más antiguos

Iniciar sesión para comentar.

### Categorías

Más información sobre Logical en Help Center y File Exchange.

### Community Treasure Hunt

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

Start Hunting!

Translated by