# Taylor series - least number of terms

Find the least number of terms to approximate $\sin(1.1)$ so that the error is less than $0.001$.

I know the interval of error (I think it's also known as error bounds) is [1, 1.1] and

$$R=\frac{\max(f^{n+1}(x)) * (x-a)^{n+1}}{(n+1)!}.$$

How do I use this to solve the problem?

Edit

Sorry, in the original post, I did not fully complete the question as I forgot to add "so that the error is less than 0.001."

I talked with my teacher, and as we're not allowed to use a calculator, we approximate the maximum value for sine to be 1, since it would be the highest value. As such, $f^{n+1}(x) = 1$. We are also given $R < 0.001$. According to our interval of error, [1, 1.1], $a = 1$ and $x = 1.1$.

Finally, $$\frac{1 * (1.1-1)^{n+1}}{(n+1)!} > 0.001.$$

We solve for $n$ by plugging in small values, such as 0, 1, 2, and so on. The smallest value to fit the equation is $n=2$, so the answer is 2 terms.

Now, I understand how we get the answer, but I am still lost on why $f^{n+1}(x) = 1$. My teacher explained that this was because it was a trigonometric function, and as we can't use a calculator, we need to choose between 0 and 1, but I still don't understand it.

Can someone clarify what she meant? Why use 0 and 1, and why did we choose 1 for $f^{n+1}(x) = 1$? Also, are there alternate methods to solve this problem?

• I'm sorry what do you mean by interval of error? Do you mean that the maximum error is 0.1? – Tim The Enchanter Feb 28 '17 at 5:33
• The interval of error includes the numbers used for determining $\max f^{n+1}(x)$. So you would plug in 1 and 1.1 to find the maximum value between those two, and you can use that to find R. Please correct me if I am mistaken. – Stardust Feb 28 '17 at 23:06

You want to use the taylor expansion (built around $x=0$)$$\sin (x) = \sum^{\infty}_{n=0} \frac{(-1)^n}{(2n+1)!} x^{2n+1}$$ and limit to order $n$ such that $$\large|\sin(x)-\sum^{m}_{n=1 } \frac{(-1)^n}{(2n+1)!} x^{2n+1}\large| < \epsilon$$ Since this is an alternating series, the remainder is bounded by the first neglected term. In other words, you need to find $m$ such that $$\frac{ x^{2m+3}}{(2m+3)!} < \epsilon$$ where $x$ and $\epsilon$ are given values. You can then proceed by inspection.
Admitting that you want to go further, let $p=2m+3$ and consider the equation $$f(p)=\frac{ x^{p}}{p!}-\epsilon=0$$ or easier (taking logarithms) $$g(p)=p\log(x)-\log(p!)-\log(\epsilon)=0$$ Admitting that $p$ can be large, use Stirling approximation $$\log(p!)=p (\log (p)-1)+\frac{1}{2} \left(\log (2 \pi )+\log \left({p}\right)\right)+O\left(\frac{1}{p}\right)$$ Using the first term only, then $$g(p)\approx p\log(x)-p (\log (p)-1)-\log(\epsilon)=0$$ The solution is given in terms of Lambert function $$p=-\frac{\log (\epsilon )}{W\left(-\frac{\log (\epsilon )}{e x}\right)}$$ The Wikipedia page gives approxiamtions (using series) of function $W(z)$. Since the argument is large, just use $$W(z)\approx \log(z)-\log(\log(z))$$
Let us try using $x=1.1$ and $\epsilon=10^{-10}$ giving $z\approx 7.7$ and $W(z)\approx 1.33$. So $p\approx 17.34$ and then $m=7$ (in fact the exact solution would be $p=13.67$ corresponding to $m=5$).
Looking at this post, you will see a fantastic answer by Robjohn which write $$p\approx ex \exp\left({W\left(\frac{k \log (100)-\log (2 \pi x)}{2 e x}\right)}\right)-\frac{1}{2}$$
After expanding to n terms as you said the error $R_{n+1}=\frac{f^{(n+1)}(\zeta)x^{n+1}}{(n+1)!}$. Where $0\leq \zeta \leq x$ and here $x=1.1$. As $f(x)= \sin (x)$ we have $f^{(n)}(x)= \sin (x+\frac{n \pi}{2})$. Thus we have $|R_{n+1}| \leq \frac{x^{n+1}}{(n+1)!}$. So for error $\epsilon$ find $n$ so $\frac{x^{n+1}}{(n+1)!} \leq \epsilon$ and expand to $n$ terms.