Is there any linear or quadratic approximation of $\exp(-x)$ where $0<x<L$ ? $L$ is large, may be 40 (say) i.e. $x$ is not close to zero.
linear or quadratic approximation for $\exp(-x)$ for large $x$
9.6k Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail AtThere are 4 best solutions below
On
Make a table of $e^{-n}$ for integers $0 \leq n \leq 40.$ For any real $x$ in the same bounds, take the value $$ e^{-\left\lfloor x \right\rfloor} \; e^{\left\lfloor x \right\rfloor - x} $$ As the argument in the second factor is smaller then $1$ in absolute value, you get quite nice convergence for the Taylor series, given in the first comment to the question.
This same method gives the best accuracy for polynomials with integer coefficients as well. Given such a polynomial, its Taylor series around some integer $n$ is another polynomial with integer coefficients. So, for real $x,$ you evaluate the polynomial using its Taylor series around the nearest integer.
On
I am adding another answer, because this does not answer OP's question but gives my opinion on the problem.
If you want to approximate functions that have large variations in their value, ($e^{-x}$ has 18 orders of magnitude change for $0<x<40$) then Pade approximation may be more appropriate. A quick least square fit using Levenberg-Marquardt nonlinear regression gives $$ e^{-x} = \frac{1.1570762 -0.1746994 x + 0.0045234 x^2}{1-2.0289128 x}$$
with error $<0.16$ in the entire range
On
Combining what Will Jagy proposed and what user44197 gives in his second answer and willing to stay with minimum number of terms (as requested by the post), I propose to use a Pade approximant built around the closest integer x0.
So the simple formula is
Exp[-x0] [1 - (x - x0) / 2 + (x - x0)^2 / 12] / [1 + (x - x0)/2 + (x - x0)^2 / 12]
and the approximation is very good.
If you know $L$, then you can use numerical solution to find the approximation (using linear least squares for example). If you are not familiar, I can share some ideas.
Added following comment
First off, no single approximation is going to be good so I would strongly advice against doing this. That said, I will do it for $5 < x < 40$ so you can assess how good the approach is. You may want another approximation for $0 < x < 5$.
Let $$ f(x) = e^{-x}\\ g(x) = a_0 + a_1 x + a_2 x^2 \\ e(x) = f(x)-g(x)$$
Let $$ J = \int_5^{40} e(x)^2 dx$$ To get a good approximation, we want $J$ to be small. If you integrate it out, you should end up with a quadratic in $a_0$, $a_1$ and $a_2$. You now minimize the error by setting $$ \frac{dJ}{d a_0}=0 \\ \frac{dJ}{d a_1}=0 \\ \frac{dJ}{a_2}=0 $$ You can calculate the derivatives as $$ \frac{d}{d a_0}\int_5^{40} e(x)^2 dx = \int_5^{40} 2 e(x) \frac{d e(x)}{d a_0} dx = -2\int_5^{40} \left(e^{-x} - (a_0+a_1 x + a_2 x^2) \right)dx = 0 $$ Similarly $$ \frac{d}{d a_1}\int_5^{40} e(x)^2 dx = \int_5^{40} 2 e(x) \frac{d e(x)}{d a_1} dx = -2\int_5^{40} \left(e^{-x} - (a_0+a_1 x + a_2 x^2) \right) x dx = 0 $$ $$ \frac{d}{d a_2}\int_5^{40} e(x)^2 dx = \int_5^{40} 2 e(x) \frac{d e(x)}{d a_2} dx = -2\int_5^{40} \left(e^{-x} - (a_0+a_1 x + a_2 x^2)\right) x^2 dx = 0 $$
Note: These calculations are very sensitive to round off errors, so leave everything in the symbolic form till the very end.
Personally I would try to use different approximations, one for $0<x<5$, $5<x<10$, $10<x$. Not sure when you would want one approximation that fits all. Note that $$ e^{-40} = \approx 10^{-18}$$