# Calculate e^x without calculator

• Jul 16th 2012, 06:40 AM
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??????????????
• Jul 16th 2012, 07:22 AM
Prove It
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...
• Jul 16th 2012, 07:40 AM
Re: Calculate e^x without calculator
Quote:

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$
• Jul 16th 2012, 08:12 AM
ebaines
Re: Calculate e^x without calculator
Quote:

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.
• Jul 16th 2012, 08:36 AM
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
• Jul 16th 2012, 09:01 AM
Re: Calculate e^x without calculator
• Jul 16th 2012, 10:15 AM
ebaines
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?
• Jul 16th 2012, 10:16 AM
HallsofIvy
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.
• Jul 17th 2012, 01:28 AM