Calculate an infinite series by computer: get sum and number of terms for given precision

304 Views Asked by At

I need to find a sum and number of terms in an infinite series if ε ∈ (0;1) and x ∈ (1;5):

$$\sum_{k=0}^∞ \frac{k^2x^k}{(k+1)!}$$

I was able to convert it into a simpler form, but stuck there:

$$\lim_{k→∞} \frac{x^k×k^2}{k!×(k+1)} = e^x \frac{k^2}{k+1}$$

Can you suggest a direction to simplify the $\frac{k^2}{k+1}$ portion, please?

3

There are 3 best solutions below

5
On BEST ANSWER

$$ \begin{align} \sum_{k=0}^\infty\frac{k^2x^k}{(k+1)!} &=\sum_{k=0}^\infty\frac{((k+1)k-(k+1)+1)\,x^k}{(k+1)!}\tag1\\ &=\sum_{k=1}^\infty\frac{x^k}{(k-1)!}-\sum_{k=0}^\infty\frac{x^k}{k!}+\sum_{k=0}^\infty\frac{x^k}{(k+1)!}\tag2\\ &=x\sum_{k=0}^\infty\frac{x^k}{k!}-\sum_{k=0}^\infty\frac{x^k}{k!}+\frac1x\left(\sum_{k=0}^\infty\frac{x^k}{k!}-1\right)\tag3\\ &=(x-1)e^x+\frac{e^x-1}x\tag4\\[3pt] &=\frac{(x^3+1)e^x-(x+1)}{x(x+1)}\tag5 \end{align} $$ Explanation:
$(1)$: $k^2=(k+1)k-(k+1)+1$
$(2)$: cancel numerators and denominators
$\phantom{\text{(2):}}$ since $(k+1)k=0$ when $k=0$, we can remove the $k=0$ term from the first sum
$(3)$: substitute $k\mapsto k+1$ in the first sum and $k\mapsto k-1$ in the last sum
$(4)$: recognize the series for $e^x$
$(5)$: simplify the fraction

3
On

$$\sum_{k=0}^∞ \frac{k^2x^k}{(k+1)!}{\\=\sum_{k=0}^∞ \frac{(k^2+k)x^k}{(k+1)!}-\sum_{k=0}^∞ \frac{kx^k}{(k+1)!}\\=\sum_{k=1}^∞ \frac{x^k}{(k-1)!}-\sum_{k=0}^∞ \frac{kx^k}{(k+1)!}\\=xe^x-\sum_{k=0}^∞ \frac{kx^k}{(k+1)!}}$$also $$\sum_{k=0}^∞ \frac{kx^k}{(k+1)!}=\sum_{k=0}^∞ \frac{x^k}{k!}-\sum_{k=0}^∞ \frac{x^k}{(k+1)!}=e^x-\sum_{k=0}^∞ \frac{x^{k+1}}{x(k+1)!}=e^x-{1\over x}(e^x-1)$$therefore $$\sum_{k=0}^∞ \frac{k^2x^k}{(k+1)!}=e^x(x-1+{1\over x})-{1\over x}$$

4
On

I had very serious mistakes in my answer. Trying to fix them now.

After Yuriy S's comment, if you need to find $k$ such that
$$\frac{k^2\, x^k}{(k+1)!}< 10^{-d} \tag 1$$ Since $$\frac{k^2}{(k+1)!}=\frac k{k+1} \frac 1 {(k-1)!}\sim \frac 1 {(k-1)!}$$ we can approximate $(1)$ by equation $$(k-1)! = ( x\,{10^d})\,x^{k-1}$$ or, simpler, $$n!= (x\,10^d)\, x^n \qquad \text{where }\qquad n=k-1$$ If you look at this question of mine, you will see a magnificent approximation of the inverse factorial function which was proposed by @robjohn.

Applied to this case, this would give $$\color{blue} { k\sim e\, x\,e^{W(t)}+\frac 12} \qquad \text{where }\qquad \color{blue} {t=\frac {\log \left(\frac{x\, 10^{2 d}}{2 \pi }\right) } {2e x }}\tag 2$$ where appears $W(.)$ which is Lambert function.

Let us try for a few values of $x$ and $d$. The next table reports in the real domain the value given by the approximation $(2)$ as well as the exact solution of $(1)$. You just need to use the next integer. $$\left( \begin{array}{ccc} x & d & \text{approximation} & \text{exact} \\ 1 & 4 & 8.33367 & 8.28080 \\ 1 & 5 & 9.41743 & 9.37320 \\ 1 & 6 & 10.4438 & 10.4056 \\ 1 & 7 & 11.4258 & 11.3922 \\ 1 & 8 & 12.3721 & 12.3420 \\ 1 & 9 & 13.2888 & 13.2615 \\ & & & \\ 2 & 4 & 12.0127 & 11.9689 \\ 2 & 5 & 13.2892 & 13.2517 \\ 2 & 6 & 14.5002 & 14.4674 \\ 2 & 7 & 15.6595 & 15.6302 \\ 2 & 8 & 16.7765 & 16.7500 \\ 2 & 9 & 17.8579 & 17.8338 \\ & & & \\ 3 & 4 & 15.3123 & 15.2744 \\ 3 & 5 & 16.7140 & 16.6810 \\ 3 & 6 & 18.0471 & 18.0178 \\ 3 & 7 & 19.3250 & 19.2987 \\ 3 & 8 & 20.5572 & 20.5333 \\ 3 & 9 & 21.7508 & 21.7288 \\ & & & \\ 4 & 4 & 18.4409 & 18.4071 \\ 4 & 5 & 19.9348 & 19.9051 \\ 4 & 6 & 21.3592 & 21.3326 \\ 4 & 7 & 22.7268 & 22.7028 \\ 4 & 8 & 24.0470 & 24.0250 \\ 4 & 9 & 25.3267 & 25.3063 \\ & & & \\ 5 & 4 & 21.4717 & 21.4412 \\ 5 & 5 & 23.0379 & 23.0108 \\ 5 & 6 & 24.5347 & 24.5104 \\ 5 & 7 & 25.9744 & 25.9521 \\ 5 & 8 & 27.3656 & 27.3452 \\ 5 & 9 & 28.7152 & 28.6963 \end{array} \right)$$