please help me with this calculus question
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
this is the question:
Consider the sum A inferred by the following:
A = 1 -1/4 + 1/9 - 1/16 + 1/25...
If the 1st term is t1 = 1 and the 2nd term is t2 = -1/4, use MATLAB to determine the sum
of terms at the 57th term (i.e. including the 57th term). Give answer to 4 decimal places. Also, provide MATLAB code.
this is my Matlab code but its not giving me the answer i expect. please help me with this. thank you
syms n x
F(x)=symsum((-1)^(n-1)/n^2,n,1,57)
1 comentario
Respuestas (1)
David Hill
el 9 de Oct. de 2021
Editada: David Hill
el 9 de Oct. de 2021
No reason to use symbolics.
round(sum((-1).^(2:58)./(1:57).^2),4);
4 comentarios
David Hill
el 9 de Oct. de 2021
Did you copy and past it into your command line? The above code works.
Star Strider
el 9 de Oct. de 2021
See the documentation section on Compatibility Considerations. (It always helps to use the Release window to post the release being used.)
It is easy to emulate the version introduced in R2014b —
roundn = @(x,n) round(x .* 10.^n)./10.^n;
.
Ver también
Categorías
Más información sobre Calculus en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!