0

I am trying to estimate $\sin\left(\frac{1}{2}\right)$ using its Taylor series and Taylor's remainder theorem. Specifically, I need to find to find how many terms in the Taylor series I need to estimate $\sin x$ correct to five decimal places. I used the theorem, using the fact that all derivatives of $\sin x$ are certainly bounded by $1$ and took the base point of $a = 0$ (though I admittedly don't understand why) to get: \begin{align*} |R_n (x)| \leq \frac{\frac{1}{2^{n+1}}}{(n+1)!}. \end{align*} I would then set up $\frac{\frac{1}{2^{n+1}}}{(n+1)!} < 0.0001$ and solve, but I don't know how to solve that in closed form.

2 Answers2

1

Just use trial and error. For $n=1$, the expression is $\frac18>0.00001$, for $n=2$, it is $\frac1{48}>0.0001$, for $n=3$, it is $\frac1{384}$ and still $>0.0001$. Continue until success.


Remark: Why $a=0$? Indeed, you may be better off with $a$ closer to $\frac12$ than that - but you need to know $\sin a$ (and $\cos a$). So perhaps $a=\frac\pi4$ (where $\sin a=\cos a=\frac{\sqrt 2}{2}$) is better. Then again, you would need sufficient precision for the numerical values of $\frac{\sqrt2}2$ and for $x-a=\frac12-\frac{\pi}4$ to work with. Another interesting idea would be to first use Taylor compute $\sin\frac14$ (and $\cos\frac14$) which may reach the desired relative error with fewer terms, and then for the final goal use $\sin2x=2\sin x\cos x$ instead of Taylor.

0

Probably too advanced but, at least, for your curiosity.

Let us make the problem more general where you look for $n$ such that $$\frac{\frac{1}{2^{n+1}}}{(n+1)!} \leq 10^{-k} \implies (n+1)! \geq \frac{10^k}{2^{n+1}}$$ If you look at this question of mine, you will see a magnificent approximation proposed by @robjohn.

Adapted to your problem, it will write $$n\sim \frac{e}{2} e^{W(t)}-\frac 32 \qquad \text{where} \qquad t=\frac{2k \log (10)-\log (\pi )}{e}$$ where $W(t)$ is Lambert function.

For sure, you will need to take $\lceil n \rceil$.

Using $k=4$ as in your post, this gives $n=4.39035$ so $n=5$. Notice that the exact solution is $4.39321$.

Suppose that we want it for $k=50$; it will give $n=34$. Checking $$\frac{\frac{1}{2^{35}}}{35!}=2.81 \times 10^{-51} < 10^{-50}\qquad \text{while} \qquad \frac{\frac{1}{2^{34}}}{34!}=1.97 \times 10^{-49} > 10^{-50}$$

Notice that for this case, the approximation gives $n=33.7022$ while the exact solution is $33.7025$.

If you cannot use Lambert function, since $t$ is large, approximate it using

$$W(t)\approx L_1-L_2+\frac{L_2}{L_1}+\frac{L_2(L_2-2)}{2L_1^2}+\frac{L_2(2L_2^2-9L_2+6)}{6L_1^3}+\cdots$$ where $L_1=\log(t)$ and $L_2=\log(L_1)$