hello can anyone help me with an infinite series problem? i've tried it but i'm kinda stuck

1 visualización (últimos 30 días)
function T = sum(n = 1 to infty)((-1)^{n-1}(n^2+1))/(2^n)
x=input('enter the x value: ');
epsilon_s=(0.5*10^(2-n));
epsilon=100;
iteration=1;
eps_array(1) = 0;
while epsilon>epsilon_s
(i'm stuck on this step)

Respuestas (1)

Ameer Hamza
Ameer Hamza el 21 de Abr. de 2020
Editada: Ameer Hamza el 21 de Abr. de 2020
Try this. It finds the sum symbolically.
syms n
term = (-1)^(n-1)*(n^2+1)/2^n;
y = symsum(term, n, 1, inf);
  9 comentarios
Walter Roberson
Walter Roberson el 22 de Abr. de 2020
That is what is expected from the code. Your code does not ask to display any results.
disp(y)

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by