Summation Using For Loop
9 次查看(过去 30 天)
显示 更早的评论
I am having a hard time solving the following problem:

Here is what I have (for n=10) and I cannot for the life of me get the correct output, which should be 3.14 with a bunch of numbers after it.
clc,clear
format long
ESpi=0;
for k=0:10
ESpi=ESpi+[(-1)^k/(2*k+1)^3];
end
ESpi
0 个评论
采纳的回答
David Goodmanson
2017-3-11
Hi vaninea, Don't forget that you are calculating pi^3/32, not pi! Espi equals (appoximately) pi^3/32, so you need to work back from that in order to get to(approximately) pi.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!