MATLAB Answers

What code would I use for this question

조회 수: 1(최근 30일)
JEE
JEE 29 Oct 2015
답변: Manuel Espinoza 30 Oct 2015
develop a code that determines the following sum for an value of x>0. The program calculates the sum by adding the terms and stopping when either, the value of a term is less than or equal to 0.0001, or the number of terms exceeds zero. If the value of the function is calculated successfully, it displays the value(sum) and the number of terms used. If the looping stops because the 30th term is not smaller than 0.001 the program displays a message indicating "more than 30 terms are needed."
sum(x^n/n!)=x/1!+x^2/2!+x^3+3!

  댓글 수: 1

Star Strider
Star Strider 29 Oct 2015
‘...or the number of terms exceeds zero’
How do we interpret that?

댓글을 달려면 로그인하십시오.

답변(2개)

Muthu Annamalai
Muthu Annamalai 29 Oct 2015
The code depends on who gets the extra credit J
I would recommend using a while loop like another example in page 4 of Cleve Moler's book, http://www.mathworks.com/moler/zeros.pdf and keeping a running sum.
Goodluck!

  댓글 수: 0

댓글을 달려면 로그인하십시오.


Manuel Espinoza
Manuel Espinoza 30 Oct 2015
me and some people from class were able to find a sort of template to set up the problem. if you go on page 332 from the book, there is a set of code that is pretty similar to the problem that you can tweak to solve this problem. and this is 'definitely' not considered cheating.

  댓글 수: 0

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by