How can I compute the partial sums of a series in the opposite direction?

1 view (last 30 days)
Computing the partial sums for Sum of (1/i4) was quite easy I used the code:
exact = (pi4) /90;
N = 20000
p = 0
for i = 1:N
t = 1/i^4;
p = p + t;
y(i) = p;
end
Now what I have to compute now is the partial sums in the opposite direction and I have no idea how to even begin manipulating the current code in order to find the partial sums. Any help would be great. Thanks

Accepted Answer

Matt J
Matt J on 25 Oct 2012
Edited: Matt J on 25 Oct 2012
t=1./(1:N).^4;
yforward = cumsum(t) %forward
yback = cumsum(t(end:-1:1))%backward

More Answers (0)

Community Treasure Hunt

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

Start Hunting!