1

What is the precise number of terms needed in Taylor expansion of $e^x$ in order to achieve a precision of $1$?

It seems that we simply need something like $e \cdot x$ terms or about that, but I am not completely sure that this estimation comes from Taylor series error.

I try

$$R_n(x)=\frac{e^cx^n}{n!}<1$$

taking the worst case scenario $c=x$

$$e^x x^n < n!$$

$$x+n\ln(x) < n\ln(n)-n$$

$$x< n\ln(\frac{n}{x})-n$$

$$n=kx$$

$$x< kx\ln(\frac{kx}{x})-kx$$

$$k(\ln(k)-1) > 1$$

$$k > e^{W(\frac{1}{e})+1} \approx 3.59112$$

Taking into account how precise $\ln(n!) \approx n\ln(n)-n$ is, we indeed should have something like linear dependency.

Is this the best possible estimation we can have? Is it even correct to ask first actually?

  • 1
    If you want a fixed constant $c$, then $c = e$ is indeed the smallest value. However, this overestimates the number of terms needed for larger $x$ values, so you may want to look at other scalings of the upper limit of the sum. – eyeballfrog Jun 15 '19 at 18:31
  • 1
    If you branch out at $e^xx^n<(\frac ne)^n$ you get directly via the n-th root $e^{x/n}\frac xn < \frac1e$ so that $\frac xn<W(\frac1e)$ is a sufficient condition. This gives the same factor. – Lutz Lehmann Jun 15 '19 at 18:32

4 Answers4

2

A bound on the remainder terms by a geometric sum gives that for $N>2x$ the error of the partial sum is smaller than twice the next term. This would give the condition $$ \frac{x^N}{N!}<\frac12 $$ for which it is sufficient to have by the Stirling formula (and as $\sqrt{2\pi}>2$) $$ x^N<\left(\frac Ne\right)^N\iff x<\frac Ne \iff N>ex. $$ As $e>2$, this satisfies the assumptions of the bound $N>2x$ used in the error estimate.

Again by the full Stirling formula, the error estimate can be refined to $$\approx2\frac{x^N}{\sqrt{2\pi N}(\frac{N}e)^N}<\frac1{\sqrt{N}}\left(\frac{ex}N\right)^N<\frac1{\sqrt{N}}.$$


The remainder formula is for $0<x<N/2$ $$ \sum_{n=N}^\infty\frac{x^n}{n!}\le\frac{x^N}{N!}\sum_{k=0}^\infty\frac{x^k}{(N+1)^k}=\frac{x^N}{N!}\frac1{1-\frac{x}{N+1}}<2\frac{x^N}{N!} $$

Lutz Lehmann
  • 126,666
  • To the proposer: If $x\ne 0$ and $|x|<K+2 $ then $|\sum_{j=K+1}^\infty (x^j/j!),|$ $<\frac {|x|^{K+1}}{(K+1)!}\sum_{n=0}^{\infty} \frac {|x|^n}{(K+2)^n}.$ – DanielWainfleet Jun 15 '19 at 21:02
  • @DanielWainfleet Not sure what you want to stress with that equation –  Jun 15 '19 at 21:21
  • I'm not sure what the proposer meant in his comment. I thought this $might$ help. That is, the absolute error bounded by a geometric sum – DanielWainfleet Jun 15 '19 at 21:32
  • @DanielWainfleet : Yes, that is the method, to get a useful error bound one has to restrict the quotient clearly away from 1, taking it below $\frac12$ gives $2$ as bound for the geometric sum. (use *emph* emph or _emph_ emph) – Lutz Lehmann Jun 15 '19 at 21:38
  • 1
    @DanielWainfleet Never mind, it is just an estimation then again. I found a strict way of solving it. Thanks for the trouble. –  Jun 15 '19 at 21:44
  • I see, it has a condition for the estimation. Well that is good to know on its own. Maybe something can be conjured up out of it all more precise. –  Jun 17 '19 at 16:20
2

Hint

Given $$ e^{\,x} - \sum\limits_{n = 0}^{c\,x} {{{x^{\,n} } \over {n!}}} < 1\quad \Leftrightarrow \quad 1 - e^{\, - x} < e^{\, - x} \sum\limits_{n = 0}^{c\,x} {{{x^{\,n} } \over {n!}}} $$ it is known that the partial sum of the $e^x$ power series divided by $e^x$ is given by the Upper Incomplete Regularized Gamma Function.

So, from $$ \eqalign{ & e^{\,x} - \sum\limits_{n = 0}^{c\,x} {{{x^{\,n} } \over {n!}}} < 1\quad \Leftrightarrow \quad 1 - e^{\, - x} \sum\limits_{n = 0}^{c\,x} {{{x^{\,n} } \over {n!}}} < e^{\, - x} \quad \Leftrightarrow \cr & \Leftrightarrow \quad 1 - Q(cx + 1,x) = P(cx + 1,x) < e^{\, - x} \cr} $$ you might find other approaches to solve your problem

G Cab
  • 35,272
2

Thanks to all.

The answer is maybe tricky but indeed possible.

All we need is to estimate the implicit function $y(x)$ in form of

$$ e^x(1-\frac{\Gamma(1+xy(x),x)}{\Gamma(1+xy(x))}) = 1 $$

$$\frac{\ln(1-\frac{\Gamma(1+xy(x),x)}{\Gamma(1+xy(x))})}{x} = -1 $$

This is indeed giving something like $y(x) \to e$ or around that number at infinity.

So we need to prove something down the line, if it is really $e$:

$$ \lim_{x \to \infty} \frac{\ln(1-\frac{\Gamma(1+ex,x)}{\Gamma(1+ex)})}{x} = -1 $$

and we are done.

Maybe using

$$ \Gamma(s,x) = \Gamma(s) - \gamma(s,x) $$ and $$ s\gamma(s,x) \sim x^s e^{-x} $$

might help.

$$ \lim_{x \to \infty} \frac{\ln(\frac{e^{-x}x^{ex+1}}{(ex+1)\Gamma(1+ex)})}{x} = -1 $$

which requires

$$ \lim_{x \to \infty} \frac{\ln(\frac{x^{ex+1}}{(ex+1)\Gamma(1+ex)})}{x} = 0 $$

and this is correct taking the asymptotic behavior of $\Gamma(x+1) \sim \sqrt{2 \pi x}\left(\frac{x}{e}\right)^x$ into account because $x^{ex}$ is canceled.

Notice that $c$ must be greater or equal than $e$ otherwise $\left(\frac{z}{e}\right)^z$ in the asymptotic expression for $\Gamma(1+z)$ would make the limit being different from $0$ for $z=cx, c \neq e$

Job done!

A very sensitive limit though

$$ \lim_{x \to \infty} \frac{\ln(\frac{x^{x+1}}{(x+1)\Gamma(1+x)})}{x} = 1 $$

$$ \lim_{x \to \infty} \frac{\ln(\frac{x^{2x+1}}{(2x+1)\Gamma(1+2x)})}{x} = 2-\ln(4) $$

Using the shortest possible expression and regularized gamma function $\operatorname{P}(a,z)$ we have this implicit definition of our function

$$\operatorname{P}(xy(x)+1,x)=e^{-x}$$

2

Starting from @LutzL's answer, we need compute $n$ such that $$n!=2x^n$$

If you look at this question of mine, @Robjohn provided a splendid approximation.

Making in the answer $k=\frac{\log (2)}{\log (10)}$ and $a=x$, this would make $$n\sim e x \exp\Bigl[W\left(-\frac{1}{2 e x}\log \left(\frac{\pi x}{2}\right)\right) \Bigl]-\frac 12$$ which would make for large enough value of $x$ $$c \sim \exp\Bigl[1+W\left(-\frac{1}{2 e x}\log \left(\frac{\pi x}{2}\right)\right) \Bigl]$$ which, for sure, tends to $e$ (from below).