0

I know that

$$\sum\limits_{n=0}^\infty \frac{x^n}{n!} = e^x$$

However, what if the summation had limits? How do I find x inside this summation?

$$\sum\limits_{n=0}^{57} \frac{x^n}{n!} = 1.586*10^{15}$$

3 Answers3

1

A natural place to start is to say $57$ is not so far from $\infty$ so we can just take the log of the right hand side. Here it is very close to $35$. Then we can check the size of the first neglected term, which is $\frac {35^{58}}{58!}\approx 1.53\cdot 10^{11}$. Subsequent terms are multiplied by a number smaller than $\frac {35}{59}$. If the ratio stayed that high, the sum would be $1.53 \cdot 10^{11}\frac 1{1-\frac {35}{59}}=1.53 \cdot 10^{11}\cdot \frac {59}{24}$, which is a tiny error, so $n \approx 35$. If we know $n$ is an integer we are done. Otherwise we can use any of our favorite root finding algorithms to improve the estimate.

This approach will be effective as long as $x$ is rather less than the upper limit of the sum because the terms will be getting smaller quickly.

Ross Millikan
  • 383,099
0

As Ross Millikan answered, the is no explicit solution and some numerical method would be required.

Making the problem more general, you want to solve for $x$ the equation $$\sum\limits_{n=0}^{k} \frac{x^n}{n!} = A$$ where $A$ is a large number and $k$ is a quite large integer.

Rewrite the equation as $$e^x\frac{ \Gamma (k+1,x)}{k!}=A$$ and take logarithms of both sides. Now, develop the lhs as a series for large values of $x$ to get $$-\log \left({k!}\right)+k \log \left({x}\right)+\frac{k}{x}+O\left(\frac{1}{x^2}\right)=\log(A)$$ Ignoring the higher order terms, we then need to solve, for an approximation, $$\log(x)+\frac 1x=\frac {\log(A k!)}k\implies x=-\frac{1}{W\left(-e^{-K}\right)} \quad \text{where} \quad K=\frac {\log(A k!)}k$$ where $W(t)$ is Lambert function.

For your case $A=1.586\times 10^{15}$ and $k=57$, this will give $x=39.788$. On the other side, we know that $x > \log(A)=35$; so, we have a pretty narrow range to be explored. In practice, the "exact" solution given by Newton method would be $35.0002$.

0

With parameters of this size, it is easy to tackle the problem directly with Newton's method. We consider the problem of finding the root of

$$f(x)=\left(\sum_{n=0}^k\frac{x^n}{n!}\right)-y$$

where in our case we take $k=57$ and $y=1.586~\mathrm E15$.

We can use the initial approximation given by

$$x_0\simeq\ln(y)$$

and then use

$$x_{n+1}=x_n-\frac{f(x)}{f'(x)}$$

where

$$f'(x)=\sum_{n=0}^{k-1}\frac{x^n}{n!}$$

can be computed with $f(x)$ as well. Rewriting it in terms of $f'(x)$ this becomes

$$x_{n+1}=x_n-1-\frac{\frac{x^n}{n!}-y}{f'(x)}$$

which converges rapidly to the desired solution.

Try it online!