[Math] Special rational approximations to $e^x$ (exponential function)

approximation-theorynumerical methods

I've come across several reference that purport the following special rational approximations to the $e^x$ function

Case 1:
In one reference they use the following (Pade) approximation
$$
e^r = 1 + 2r\frac{ P(r^2)}{ Q(r^2) -r P(r^2) },
$$
with $P$ and $Q$ being polynomials.

Case 2: In another source they use the following approximation
$$
R(r^2) = r\frac{e^r+1}{e^r-1} = 2+ r^2/6 – r^4/360 + \cdots
$$
A Remez algorithm is used to generate a polynomial to approximate $R$:
$$
R(z)\approx 2.0 + P_1 z + P_2 z^2 + P_3 z^3 + P_4 z^4 + P_5 z^5
$$

Therefore we can write
$$
e^r = 1 + \frac{2r}{R(r^2) – r}
$$
From the notes a Remez algorithm is used to find the coefficients for $R$; I presume the same is the case for $P$ and $Q$ for the first approximation (it's not clear how to obtain them in the first case).

In any case, approximation two is supposedly more accurate.

Question: How have these rational approximations been derived? Case 1 can be generalized to $10^x$, $2^x$ etc (with different coefficients for $Q$ and $P$). For case 2 this doesn't seem to be the case, i.e. is there a similar rational approximation to $2^x$ and $10^x$ without relying on the fact $2^x = e^{\log_e 2 x}$. Aso, how would one go about finding the coefficients for $P$ and $Q$ in case 1.

Best Answer

There is nothing special about $e$ here. For any $a \ne 1$ you could use the Remez algorithm to find a polynomial $R(x)$ that approximates $$ \sqrt{x} \dfrac{a^\sqrt{x} + 1}{a^\sqrt{x} - 1}$$ on some interval $0 < x \le X$ (giving the best uniform approximation of this for polynomials of degree $\le d$). Then $a^x \approx 1 + 2x/(R(x^2)-x)$ for $-\sqrt{X} \le x \le \sqrt{X}$

For example, with $a=10$, $X = 5$ and $d = 9$ I get $$ \eqalign{R(x) &= 0.8685889669638705+ 0.3837640483652787\,x- 0.03391037227227374\,{x}^{ 2} \cr & + 0.004278250903723814\,{x}^{3} - 0.0005637985646020767\,{x}^{4}+ 0.00007298075602694236\,{x}^{5}\cr &- 0.000008631124974263940\,{x}^{6}+ 0.0000008256832839671144\,{x}^{7}\cr & - 0.00000005329698642479952\,{x}^{8} + 0.000000001658928529960004\,{x}^{9}} $$

EDIT: There must be a typo in your Case 1.

$$ e^r = 1 + 2 r \dfrac{P(r^2)}{Q(r^2) - P(r^2)}$$ would be equivalent to $$ \dfrac{P(r^2)}{Q(r^2)} = \dfrac{e^r-1}{e^r + 2 r - 1} $$ But this won't work: the right side is not an even function of $r$. I guess it must be instead

$$ e^r = 1 + 2 r \dfrac{P(r^2)}{Q(r^2) - r P(r^2)}$$ which becomes $$ \dfrac{P(r^2)}{Q(r^2)} = \dfrac{e^r-1}{r(e^r+1)} = \dfrac{\tanh(r/2)}{r} $$ as that is an even function.

Related Question