# Finding the smallest value n from which the difference between the sum of an infinite series and a partial sum is less than 0,001

Basically I was told that this "the Solve function generally doesn't handle infinite series very well.

Choose some values of n and see how large the error is, then see if you can find a value of $$n$$ where the error is close to 0.001". The series is $$1/k!$$.

I am confused about how I can use the solve function to find an error at all. I tried this

Solve[Sum[1/k!, {k, 1, ∞}] == -1 + E, k]


It doesn't even give me an error.

• This tells you that n can be taken as 6 or 7: In[535]:= n /. FindRoot[Sum[1/k!, {k, n, Infinity}] == 1/1000, {n, 10}] Out[535]= 6.25056872869 – Daniel Lichtblau Feb 7 '20 at 16:27
• Sum[1/k!, {k, 1, Infinity}] == -1 + E evaluates to True so the Solve correctly states that any value of k works. Look at Solve[Sum[1/k!, {k, 1, \[Infinity]}] == -1 + E, k] // Trace – Bob Hanlon Feb 7 '20 at 19:08

You ask for an error, so I presume you want to compare partial sums with the (known) value of the infinite sum. So you could do things like the following:

N[Sum[1/k!,{k,1,n}]-(E-1)]/.n->5

Table[{n, N[Sum[1/k!, {k, 1, n}] - (E - 1)]}, {n, 10}] // TableForm

ListLinePlot[Table[Sum[1/k!, {k, 1, n}] - (E - 1), {n, 10}]]


Pick an upper bound for n, 10, 20, 100 whatever you feel is big enough. Then put bounds on n and Solve over the Integers:

Min[n /. Solve[
Abs[Sum[1/k!, {k, 1, n}] - (-1 + E)] < 1/1000 && 0 < n < 100, n,
Integers]]

(*  6  *)