Could someone explain what the code means?

3 views (last 30 days)
s = 0;
t = Inf;
n = 0;
while s ~= t
n = n+1;
t = s;
s = s + 1/n^4;
end
s

Accepted Answer

Walter Roberson
Walter Roberson on 29 Nov 2020
1/1^4 + 1/2^4 + 1/3^4 + 1/4^4 + 1/5^4 + 1/6^4 and keep going adding values until the number stops changing (which will happen because the values start getting too small to individually make a difference)

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!