0

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?

J. W. Tanner
  • 60,406
newhere
  • 3,115

2 Answers2

2

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.

Bernard
  • 175,478
  • Thanks, that is were I got. a. how can we conclude what you said about the first term by Leibniz' rule? b. to find n, I took ln from both sides, but $(2n+1)!$ is an issue should I use stirling approximation? c. if $\pi$ has an error so I need to use the formula for error propagation? – newhere Nov 25 '19 at 10:14
  • 1
    For b., any calculator will give you the exact value of $n!$, I guess (in any case Maxima does) For c., I don't know, I'm not a specialist of numerical analysis. For a., it is proved considering the partial sums $S_{2n}$ and $S_{2n+1}$, which are shown to be adjacent sequences, i.e. one increases to the total sum, and the other decreases to this same total sum, while the difference tends to $0$. – Bernard Nov 25 '19 at 10:56
1

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}$$