Approximate $\frac{\sin(\pi x)}{x}$ with an error of less than $10^{-6}$

203 Views Asked by At

Find $n$ in Taylor series such that the approximation of the function $f(x)=\frac{\sin(\pi x)}{x}$ at the point $x=\pi$ is accurate to $6$ points after the radix.

So I first tried to use the formula $$\frac{f^{(n+1)}(c)x^{(n+1)}}{(n+1)!}$$ for some $c\in(0,\pi)$

but taking more and more derivatives of $\frac{\sin(\pi x)}{x}$ results in a huge expression.

So I used the known expansion \begin{align}\sin x&=\sum_{n=0}^{\infty}\frac{(-1)^n}{(2n+1)!}x^{2n+1}\\ \sin(\pi x)&=\sum_{n=0}^{\infty}\frac{(-1)^n}{(2n+1)!}(\pi x)^{2n+1}\\ \frac{\sin(\pi x)}{x}&=\sum_{n=0}^{\infty}\frac{(-1)^n}{(2n+1)!}(\pi x)^{2n} \end{align}

But then how can I bound the error?

2

There are 2 best solutions below

2
On BEST ANSWER

This is an alternating series, and Leibniz' rule asserts that the remainder has the sign of its first term, and its absolute value is bounded from above by the absolute value of this first term.

So you have to determine the least $n$ such that $$\frac{\pi^{4n}}{(2n+1)!}\le 10^{-6}$$ and take into account that you have an error on the value of $\pi$ in the approximating formula.

0
On

Starting from Bernard's answer and making the problem more general, you need to solve for $n$ the equation $$\frac{\pi^{4n}}{(2n+1)!}= \epsilon$$ that is to say $$(2n+1)!=\frac{\pi^{4n}} \epsilon=\frac 1 {\pi^2\epsilon} (\pi^2)^{2n+1}$$ For the time being, let $m=2n+1$.

If you look at this question of mine asking for the solution of $$m!=a^m 10^k$$ you will see a magnificent approximation built by @robjohn for this last equation. $$ m\sim ea\exp\left(\operatorname{W}\left(\frac k{ea}\log(10)-\frac1{2ea}\log(2\pi a)\right)\right)-\frac12$$ where appears Lambert function. Applied to your case, this would give $$2n+1=\pi^2 e \exp\left(W\left(-\frac{\log \left(2 \pi ^7 \epsilon ^2\right)}{2 e \pi ^2}\right) \right)-\frac12$$ and for sure, you need to use $\lceil n \rceil$.

For $\epsilon=10^{-6}$, this would give $n=16.8116$ while the exact solution obtained using Newton method would be $16.8121$ !

Let us check

$$\frac {\pi^{64}}{33!} \sim 7.57 \times 10^{-6} \qquad \text{and} \qquad \frac {\pi^{68}}{35!} \sim 6.19 \times 10^{-7}$$