Write an application that calculates the value of e^x by using the following formula:e^x=1+(x/1!)+(x^2/2!)+(x^3/3!)...

Allow the user to enter the number of terms to calculate

4 answers

Are you writing it in C++, java or VB.net?

I suppose you have just finished control statements, and should be capable of writing the required application.

Have you started coding. Post your code if you have difficulties.
I don't understand the formula :/
I don't understand the formula :/ im writing in java
The formula for
ex can be approximated by the infinite series:
ex
= 1 + x + x²/2! + x³/3! + ... (ad infinitum)
where 2! = factorial 2 = 1*2, and
3! = factorial 3 = 1*2*3, etc.

So for a given value of x, say 0.2,
to approximate e0.2, we calculate
e0.2
=1+0.2+0.2²/(1*2)+0.2³/(1*2*3)+0.24/(1*2*3*4)+...
=1+0.20000+0.020000+0.001333+0.000067+0.000003+....
=1.221403

The actual value from a calculator would be 1.221402758...

Notice that each term can be calculated from the preceding one by multiplying by x and dividing by a successively higher integer, 1,2,3...
You could try the following pseudocode:

term=1 // first term
sum=term // accumulator
counter=1 // term counter
eps=0.000001 // accuracy required
input x // value of x for which e^x required
while(abs(term)>eps)
term <- term * x/counter
counter ++
sum <- sum + term
loop

Post your code if you have questions.
Similar Questions
  1. I need to create a pseudocode for the follwing application:Write Java-like pseudocode to specify the logic for the following
    1. answers icon 0 answers
  2. Write an objective for the following:This is an RTOS based application. That is developing an embedded application in real time
    1. answers icon 1 answer
    1. answers icon 1 answer
  3. FormulaF=1.8 * C + 32 Create an application that displays a table of the Celsius temperature 0 through 20 and their fahrenheit
    1. answers icon 0 answers
more similar questions