$$\displaystyle\int_{0}^{1} \frac{1-\cos(x)}{x} dx$$
Can I somehow write the Taylor-series of $\frac{1-\cos(x)}{x}$?
$$\displaystyle\int_{0}^{1} \frac{1-\cos(x)}{x} dx$$
Can I somehow write the Taylor-series of $\frac{1-\cos(x)}{x}$?
On
Observe we have \begin{align} 1-\cos x = \sum^\infty_{n=1} (-1)^{n+1}\frac{x^{2n}}{(2n)!} \end{align} which means \begin{align} \int^1_0 \frac{1-\cos x}{x} \ dx = \sum^\infty_{n=1}(-1)^{n+1}\frac{1}{(2n)!}\int^1_0 x^{2n-1}\ dx = \sum^\infty_{n=1}(-1)^{n+1}\frac{1}{(2n)!}\frac{1}{2n}. \end{align}
Hence \begin{align} \left|\sum^\infty_{n=N}(-1)^{n+1}\frac{1}{(2n)!2n}\right| \leq \sum^\infty_{n=N} \frac{1}{(2n)! 2n} \leq \sum^\infty_{n=N}\frac{1}{2^{2(n+1)}} = \sum^\infty_{n=N}\frac{1}{4^{n+1}} = \frac{3}{4^{N}} \end{align} when $N\geq 4$. In particular, if you want three digit accuracy, all you have to do is choose $N$ such that \begin{align} \frac{3}{4^N}<10^{-3} \end{align} which means you need $N\geq 6$. Hence sum up six terms to get at least 3 decimal places of accuracy.
On
Jacky Chong provided an elegant and simple way to obtain an upper bound of $N$.
If we compute $$S_p=\sum^p_{n=1}\frac{(-1)^{n+1}}{(2n)!}\frac{1}{2n}$$ we have the following results $$\left( \begin{array}{ccc} p & S_p & S_p\approx\\ 1 & \frac{1}{4} & 0.250000 \\ 2 & \frac{23}{96} & 0.239583 \\ 3 & \frac{259}{1080} & 0.239815 \\ 4 & \frac{232061}{967680} & 0.239812 \end{array} \right)$$ showing that less terms could be used (as mathreadler commented).
The last value given in the table is exact for six significant figures.
Edit
Assuming that you could want a much higher accuracy, say for $k$ digits, you would need to solve for $n$ equation $$2n\,(2n)!=10^k$$ A quick and dirty regression work shows that we could write it as $$1.1566\, n^{1.26257}-1.22265=k \implies n= 0.89116 \times (k+1.22265)^{0.7920}$$ For $10$ significant figures, this would lead to $n=6.79$ so $7$ terms which is the correct answer ($6$ terms leading to an error of $1.74\times 10^{-10}$).
For $x\in (0,1]$ we have: $$F(x)=(1-\cos x)/x=x/2!-x^3/4!+r(x)$$ where $r(x)=(x^5/6!)(1-x^2/7\cdot 8+-...).$
We have $0<r(x)<x^5/6!$ because $(1-x^2/7\cdot 8+-...)$ is an alternating series whose terms are decreasing in absolute value. So $$0<\int_0^1F(x)\;dx - \int_0^1(x-x^3/4!)\;dx <\int_0^1(x^5/6!)\;dx=1/(6\cdot 6!)=1/4320.$$