0

In Taylor's series, to determine the number of terms needed to obtain the desired accuracy, sometimes one needs to solve inequalities of the form $$\frac{a^n}{n!}<b,$$ where $a$ and $b$ are fixed positive numbers. In most textbooks in calculus, the only introduced method to solve $\frac{a^n}{n!}<b$ for $n$ is trial and error. While this method works well in many cases, I feel that it is inefficient when $a$ is large and $b$ is small. (For example, how about solving $\frac{1000^n}{n!}<0.01$?)

My Question: Apart from using brutal force, is there another method to solve the inequality $\frac{a^n}{n!}<b$ for $n$?

Zuriel
  • 5,331

2 Answers2

1

I am quite certain that this inequality doesn't have an analytical solution. But usually in these problems, we deal with fairly large values of $n$ to the extent that Stirling's approximation is reasonably accurate. So if you replace $n!$ with its approximation: $$\frac{a^n}{n!}\approx\frac{(ae)^n}{n^n\sqrt{2\pi n}}<b$$ and then take logarithm of both sides $$n(\ln a+1)-(n+\frac12)\ln n<b+\frac12\ln(2\pi)$$ the only nonlinear term in the above inequality is $\ln n$, but it looks much simpler to check this one rather than the original inequality. For example, if $a=1000$ and $b=0.01$ as you say, then $$7.9n-(n+0.5)\ln n<0.01+0.919=0.929$$ and you can easily (well, sort of) find an approximation of $n$ by applying Newton's method to solve this inequality: $$n\approx 2693$$

jeckerya
  • 346
  • Thank you! Your answer is crystal clear and I have learnt a lot from it. Many thanks again! – Zuriel Oct 04 '18 at 14:37
1

Answering this question of mine, @robjohn proposed an extremely nice approximation.

Applied to your problem, this would give $$\color{blue}{n=-\frac{\log \left(2 \pi a b^2\right)}{2 \,W\left(-\frac{\log \left(2 \pi a b^2\right)}{2 e a}\right)}-\frac 12}$$ where appears Lambert function.

Using your values $(a=1000,b=0.01)$, in the real domain, this would give $n=2718.0142$ while the exact solution would be $2718.0096$.

Quite impressive, isn't it ?

Edit

For conveniency, let $k=-\frac{\log \left(2 \pi a b^2\right)}{2 e a}$ to make $$n=ea \frac k {W(k)}-\frac 12$$ When, as in your case, $k$ is small, you can approximate the result using $$n=ea \left(1+k-\frac{k^2}{2}+O\left(k^3\right)\right)-\frac12$$ which, for the working case, would give the same result.

Another (better) approximation could be $$n=ea\frac{2+3 k}{2+k}-\frac 12$$