# Thread: Calculate e^x without calculator

1. ## Calculate e^x without calculator

Hey guy is there a possible way to calculate e^x without calculator

I tried to do so using Taylor Series " 1 + x + (x^2)/2! + (x^3)/3! + (x^3)/3! + (x^3)/3! + ...

I tried to calculate series up to 30 terms but it works for 1 but as I try 2, 3, 4 ..... the precision keeps on loosing

What am I doing wrong??????????????

2. ## Re: Calculate e^x without calculator

I don't know why you're repeating (x^3)/3!

It's supposed to go 1 + x + (x^2)/2! + (x^3)/3! + (x^4)/4! + (x^5)/5! + ...

Go on in this pattern...

3. ## Re: Calculate e^x without calculator

I tried to do so using Taylor Series " 1 + x + (x^2)/2! + (x^3)/3! + (x^3)/3! + (x^3)/3! + ...
it has to be,

$\displaystyle e^x=1+x+\frac{x^2}{2!}+\frac{x^3}{3!}+\frac{x^4}{4 !}+\frac{x^5}{5!}+\dots$

4. ## Re: Calculate e^x without calculator

I tried to calculate series up to 30 terms but it works for 1 but as I try 2, 3, 4 ..... the precision keeps on loosing
Others have provided the correct series for e^x, but keep in mind that the larger the value of x the more terms you need to reach the desired level of accuracy. For example for accuracy of 0.001 you need 8 terms for x=1, 11 terms for x = 2, 14 for x = 3, 16 terms for x =4, etc.

5. ## Re: Calculate e^x without calculator

Sorry I made a terrible mistake I did it right but wrote it here wrong (cause I wrote it in a hurry)

I did it in java and calculated " 1 + x + (x^2)/2! + (x^3)/3! + (x^4)/4! + (x^5)/5! + ... "

I wrote the method if any of you is ok with java you can see what I did

__________________________________________________ ____________________________________________

public double euler(int x){

int facpow = 2;
double result = 1 + x;

for(int counter = 1; counter <= 30; counter++){
long reqfac = fact(facpow);
double xpow = Math.pow(x, facpow);

result = result + (xpow/reqfac);
System.out.println(counter+" "+result);
facpow++;

}

return result;
}
__________________________________________________ ____________________________________________
And for calculating factorial I used this method
__________________________________________________ ____________________________________________
__________________________________________________ ____________________________________________

public long fact(long input){
long result = 1;

for(int counter = 1; counter <= input; counter++ ){

result *= counter;

}
return result;
}
__________________________________________________ ____________________________________________

I don't know what is wrong
alright if it is not something good then please can someone link me to an algorithm used by calculator like Texas Instruments or Casio etc to calculate e^x

7. ## Re: Calculate e^x without calculator

It would be interesting to see what results you're getting for, say, x = 3. One issue could be that you're trying to calculate terms like 3^30 and 30!, and truncation may be a culprit. I would suggest limiting the number of cycles in the variable "counter" to perhaps 18 and see if that helps. Also, I am not a Java expert but I wonder if using the variable "counter" in both the main routine and subroutine could be an issue?

8. ## Re: Calculate e^x without calculator

The error in using a finite polynomial to caculate x will depend upon both the degree of the polynomial and x. In particular, using the nth degree polynomial to approximate $\displaystyle e^x$ will be less than $\displaystyle (M/n!)|x|^n$ where M is an upper bound on the exponential between 0 and x. Of course, if you go from x= 1 to 2, 3, and 4, both M and |x| will increase so your error will increase.

9. ## Re: Calculate e^x without calculator

Jeeeeeeeeeeeeeezzzzz caught it; Once again I made a horrible mistake used long instead of double
Well thanks guy
if you want to play with the program I've attached it
Once again thanks

10. ## Re: Calculate e^x without calculator

I will try to improve it as i has a very little domain [0,16]

,

,

,

,

,

,

,

,

,

,

,

,

,

,

# how to calculate e^-5.569

Click on a term to search for related topics.