Results 1 to 10 of 10

Math Help - Calculate e^x without calculator

  1. #1
    Newbie
    Joined
    Apr 2012
    From
    Vehari
    Posts
    21

    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??????????????
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor
    Prove It's Avatar
    Joined
    Aug 2008
    Posts
    11,408
    Thanks
    1294

    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...
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Senior Member BAdhi's Avatar
    Joined
    Oct 2010
    From
    Gampaha, Sri Lanka
    Posts
    252
    Thanks
    6

    Re: Calculate e^x without calculator

    Quote Originally Posted by maddymath View Post

    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,

    e^x=1+x+\frac{x^2}{2!}+\frac{x^3}{3!}+\frac{x^4}{4  !}+\frac{x^5}{5!}+\dots
    Follow Math Help Forum on Facebook and Google+

  4. #4
    MHF Contributor ebaines's Avatar
    Joined
    Jun 2008
    From
    Illinois
    Posts
    1,050
    Thanks
    288

    Re: Calculate e^x without calculator

    Quote Originally Posted by maddymath View Post
    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.
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Newbie
    Joined
    Apr 2012
    From
    Vehari
    Posts
    21

    Exclamation 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
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Senior Member BAdhi's Avatar
    Joined
    Oct 2010
    From
    Gampaha, Sri Lanka
    Posts
    252
    Thanks
    6

    Re: Calculate e^x without calculator

    Your code gives the correct answer in my computer
    Follow Math Help Forum on Facebook and Google+

  7. #7
    MHF Contributor ebaines's Avatar
    Joined
    Jun 2008
    From
    Illinois
    Posts
    1,050
    Thanks
    288

    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?
    Follow Math Help Forum on Facebook and Google+

  8. #8
    MHF Contributor

    Joined
    Apr 2005
    Posts
    15,412
    Thanks
    1328

    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 e^x will be less than (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.
    Follow Math Help Forum on Facebook and Google+

  9. #9
    Newbie
    Joined
    Apr 2012
    From
    Vehari
    Posts
    21

    Talking 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
    Attached Files Attached Files
    Follow Math Help Forum on Facebook and Google+

  10. #10
    Newbie
    Joined
    Apr 2012
    From
    Vehari
    Posts
    21

    Re: Calculate e^x without calculator

    I will try to improve it as i has a very little domain [0,16]
    Last edited by maddymath; July 17th 2012 at 01:31 AM.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Replies: 2
    Last Post: May 6th 2012, 02:16 PM
  2. Replies: 3
    Last Post: July 18th 2011, 07:04 AM
  3. 401(k) Calculator
    Posted in the Math Software Forum
    Replies: 0
    Last Post: July 4th 2011, 11:43 AM
  4. Replies: 2
    Last Post: April 20th 2011, 09:45 AM
  5. calculate without the calculator
    Posted in the Algebra Forum
    Replies: 4
    Last Post: May 3rd 2009, 03:17 AM

Search Tags


/mathhelpforum @mathhelpforum