Help me to make a function of while loop

How to use while loop to numerically sum the infinite series given as
(1/1^4)-(1/2^4)+(1/3^4)-(1/4^4)+(...)
and the program should stop when the last term becomes smaller than 0.0001
please somebody help me, I'm desperate to make this project all of my friends doesn't know how to solve this problem and i have no one to ask for..

2 件のコメント

per isakson
per isakson 2019 年 6 月 14 日
Homework? Done anything so far?
derrick li
derrick li 2019 年 6 月 15 日
Yeah, ur right this is my homework, the problem is I litteraly doesnt know where to start, so im looking for someone that atleast give me an example that can help me solve the problem, I know I was wrong but i have no choice

サインインしてコメントする。

 採用された回答

Raj
Raj 2019 年 6 月 14 日

0 投票

ii=1;
A(1,1)=1/(1^4);
while abs(A(ii,1))>=0.0001
A(ii+1,1)=((-1)^(ii))*(1/((ii+1)^4));
ii=ii+1;
end
RequiredSum=sum(A)

3 件のコメント

madhan ravi
madhan ravi 2019 年 6 月 14 日
Raj this is a homework , please let the OP show the efforts.
Raj
Raj 2019 年 6 月 14 日
Maybe I should have given hints instead of posting full answer. Sorry about that.
derrick li
derrick li 2019 年 6 月 15 日
Im sorry to post something like this, but i have no other choice.
btw thank you very much, without your help i wont be able to finish my homework. actually im not exactly copy the code that you make i've modified it a little bit..

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

質問済み:

2019 年 6 月 14 日

コメント済み:

2019 年 6 月 15 日

Community Treasure Hunt

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

Start Hunting!

Translated by