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??????????????

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...

Re: Calculate e^x without calculator

Quote:

Originally Posted by

**maddymath**

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,

Re: Calculate e^x without calculator

Quote:

Originally Posted by

**maddymath** 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.

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

Re: Calculate e^x without calculator

Your code gives the correct answer in my computer :)

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?

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 will be less than 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.

1 Attachment(s)

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

Re: Calculate e^x without calculator

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