[Math] How to calculate $e^x$ with a standard calculator

approximationcalculatorexponentiationnumerical methods

Is there a simple method for calculating the $e^x$ ($x\in\mathbb{R}$) with a basic add/subtract/multiply/divide calculator that converges in reasonable time, preferably without having to memorize coefficients as in the case of the power series?

I've found one for nth roots with Newton iteration that's pretty much dead simple and I'd really like to know what else can be done.

EDIT: I'm not really that excited about approximation unless the end result is completely accurate. There are some good ideas here, but this answer is the simplest option for a full-accuracy result using only a +/-/×/÷ calculator.

I also have a strong preference for algorithms which can be directly evaluated step-by-step on such a calculator. Otherwise pencil and paper or an excellent memory must be exercised.

Best Answer

This is what I would do to calculate $e^x$ with perfect 8-digit accuracy.

  1. Take $\lfloor x\rfloor$ and $b = x - \lfloor x\rfloor$, the whole and fractional parts respectively. ($e^x = e^{\lfloor x \rfloor + (x - \lfloor x\rfloor)} = e^{\lfloor x \rfloor} e^{x - \lfloor x \rfloor}$)

  2. Use the $(((b/4 + 1)b/3 + 1)b/2 + 1)b + 1$ pattern to calculate $e^{x - \lfloor x\rfloor}$. (If the fractional part of the exponent is .4 or less, only terms up to $b/7$ are needed for 8-digit accuracy. Worst-case scenario ($b \rightarrow 1$) terms up to $b/10$ are needed.) This method is easy to implement on a simple calculator, especially ones with a memory slot to quickly reinsert $b$.

  3. When that is finished, multiply by $e$ ($\approx 2.71828183$ by memorization) and press the equals button $\lfloor x\rfloor$ times to repeat multiply. The result is $e^x$.


I've analyzed the number of terms required for full accuracy. Here is the chart (click to view full image):

chart

Basically, if terms up to $b/t$ are needed to fully calculate $e^x$ up to 8-digit precision (7 digits after the decimal point), accounting for rounding (the $\frac{1}{2}$ term), the relation between $x$ and $t$ is given by $\sqrt[t]{\frac{1}{2}10^{-7}t!} = x$.

Related Question