I have been given the function $$F(x)=\frac1x\int_0^x\frac{1-\cos t}{t^2}\,{\rm d}t$$ for $x\ne 0,$ $F(0)=\frac12,$ and charged with finding a Taylor polynomial for $F(x)$ differing from $F$ by no more than $5\times 10^{-10}$ on the interval $[-1,1].$
My First (problematic) Approach:
$\dfrac{1-\cos t}{t^2}$ agrees with the power series $$\sum_{k=0}^\infty\frac{(-1)^k}{(2k+2)!}t^{2k}$$ for all $t\ne 0,$ so since that series converges everywhere--and in particular converges uniformly on $[-1,1]$--then we have $$\begin{align}xF(x) &= \int_0^x\frac{1-\cos t}{t^2}\,dt\\ &= \int_0^x\sum_{k=0}^\infty\frac{(-1)^k}{(2k+2)!}t^{2k}\,dt\\ &= \sum_{k=0}^\infty\frac{(-1)^k}{(2k+2)!}\int_0^xt^{2k}\,dt\\ &= \sum_{k=0}^\infty\frac{(-1)^k}{(2k+2)!(2k+1)}x^{2k+1}\\ &= x\sum_{k=0}^\infty\frac{(-1)^k}{(2k+2)!(2k+1)}x^{2k}\end{align}$$ for all $x\in[-1,1].$ Furthermore, we have $$F(0)=\frac12=\frac{(-1)^0}{2!\cdot 1}\cdot 1=\sum_{k=0}^\infty\frac{(-1)^k}{(2k+2)!(2k+1)}0^{2k},$$ and so $$F(x)=\sum_{k=0}^\infty\frac{(-1)^k}{(2k+2)!(2k+1)}x^{2k}$$ for all $x\in[-1,1].$
It seemed that I should be able to use this power series to determine Maclaurin polynomials of any (nonnegative even) degree I cared to choose, but there were a few problems with this. For one, I couldn't see how to find a nice bound for the remainder, since I hadn't actually calculated any of the derivatives of $F.$ For another, once I did calculate the first several derivatives, it became clear that the $n$th derivative of $F$ fails to be defined at $x=0$ when $n\ge3,$ so the "obvious" polynomial approximations are not actually Maclaurin polynomials, after all. [Edit: Never mind about that second problem. Turns out I mistyped the third derivative I found in Wolfram Alpha, resulting in a functions which had no limit as $x\to0.$]
My Second Approach:
I tried calculating the derivatives of $F$ so that I could explicitly develop the Taylor polynomials, and still be able to use the Taylor remainder. Unfortunately, I've not found any clear pattern that I can exploit to give a closed form for the $n$th derivative of $F$ in general. Here are the first several (with the rewrite of $F$ coming via integration by parts), which hold for all $x\ne0$:
$$F(x)=-\frac1{x^2}(1-\cos x)+\frac1x\operatorname{Si}(x)\\F'(x)=\frac2{x^3}(1-\cos x)-\frac1{x^2}\operatorname{Si}(x)\\F''(x)=-\frac6{x^4}(1-\cos x)+\frac2{x^3}\operatorname{Si}(x)+\frac1{x^3}\sin x\\F'''(x)=\frac{24}{x^5}(1-\cos x)-\frac6{x^4}\operatorname{Si}(x)-\frac7{x^4}\sin x+\frac1{x^3}\cos x\\F^{(4)}(x)=-\frac{120}{x^6}(1-\cos x)+\frac{24}{x^5}\operatorname{Si}(x)+\frac{46}{x^5}\sin x-\frac{10}{x^4}\cos x-\frac1{x^3}\sin x\\F^{(5)}(x)=\frac{720}{x^7}(1-\cos x)-\frac{120}{x^6}\operatorname{Si}(x)-\frac{326}{x^6}\sin x+\frac{86}{x^5}\cos x+\frac{13}{x^4}\sin x-\frac1{x^3}\cos x$$
Here, $$\operatorname{Si}(x):=\int_0^x\frac{\sin t}t\,dt.$$
It seems fairly clear that for any integer $n\ge0$ and any $x\ne0$ we will have $$F^{(n)}(x)=\frac{(-1)^{n+1}(n+1)!}{x^{n+2}}(1-\cos x)+\frac{(-1)^nn!}{x^{n+1}}\operatorname{Si}(x)+p_n\left(\frac1x\right)\sin x+q_n\left(\frac1x\right)\cos x,$$ where $p_n$ and $q_n$ are some univariate polynomials determined by $n.$ In particular:
- $p_n\equiv0$ for $n=0,1;$ for $n\ge2,$ $p_n$ is a degree $n+1$ polynomial that is odd (origin-symmetric) when $n$ is even, even ($y$-axis symmetric) when $n$ is odd.
- $q_n\equiv 0$ for $n=0,1,2;$ for $n\ge 3,$ $p_n$ is a degree $n$ polynomial that is odd when $n$ is odd, even when $n$ is even.
I suspect I can even prove the above by induction (though I haven't tried it, yet). I'm not seeing a clear way to tell what the coefficients of $p_n$ and $q_n$ are, in general, though. Probably this is a case of oversimplifying, but perhaps the coefficients don't have a nice closed form.
I'd like to do one of the following things:
- Determine closed forms for the derivatives of $F(x).$
- Determine a point $x_0\ne0$ and a sufficiently large $n$ such that the $n$th Taylor polynomial of $F(x)$ centered at $x=x_0\ne0$ is within $5\times 10^{-10}$ of $F$ on the interval $[-1,1].$ (It seems like, in order to make $n$ as small as possible and still have the coefficients relatively easy to calculate, we should make $x_0=\frac\pi2$ or $x_0=\pi$ or some such, but this is just an idea, and I have not confirmed this.)
If anyone can help me to proceed along one of these paths, it would be appreciated. Alternative methods and hints of any kind would also be welcome.
Hint: Estimate the integral from $0$ to $1$ and double.
The series you got is an alternating series. The truncation error has size less than the first neglected term.