Effacer les filtres
Effacer les filtres

Calculate the result and absolute error for each partial sum: N = 10, 160, and 640. You should use for-loops and not commands like symsum. (b) Find the smallest value of N for which the absolute error is smaller than 10−4 (1e − 4). You should use a w

1 vue (au cours des 30 derniers jours)
My question is:
Calculate the result and absolute error for each partial sum: N = 10, 160, and 640. You should use for-loops and not commands like symsum.
was wondering if my code was missing something:
%(a) Calculate the result and absolute error for each partial sum: N = 10, 160, and 640.
sum=0;
for N=[10 160 640]
for n=1:1:N
y=1/n^2
end
sum=sum+1
error=((pi^2)/6)-sum
end
disp(sum)
  1 commentaire
KALYAN ACHARJYA
KALYAN ACHARJYA le 12 Jan 2020
Find the smallest value of N for which the absolute error is smaller than 10−4 (1e − 4). You should use a w
while loop

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by