# Compute the value of $\sqrt{e}$ with accuracy of 0.001 by using the Taylor Series of $e^x$

I'm trying to solve the following problem: Compute the value of $\sqrt{e}$ with accuracy of 0.001 by using the Taylor Series of $e^x$.
Computing the value without a given precision is no problem as I know that
$$e^x = \sum_{i=0}^\infty \frac{x^n}{n!}$$
The remainder equals $R_N(x)=\frac{f^{n+1}(c)}{(n+1)!}\cdot(x-x_0)^{n+1}$
As we don't know c we can't use this to estimate an absolute value for the error so we replace $f^{n+1}(c)$ with M where M is the estimated max of our function.
I decided to choose $M = 3$ as $e \approx 3 \land \sqrt{e} < e$
In the end I come up with $$R_n(x)= \frac {M \cdot (x-x_0)^n}{(n+1)!} \Rightarrow R_n(0.5)=\frac{3\cdot 0.5^n}{(n+1)!} \Rightarrow \frac{3\cdot 0.5^n}{(n+1)!} < 0.001$$
When I solve this by brute force I'm getting $n \ge 5$ but this gives me a precision of 3 decimal places.
$$e^x = \sum_{i=0}^5 \frac{x^n}{n!} \Rightarrow f(x) = 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} + \frac{x^4}{4!} + \frac{x^5}{5!} \Rightarrow f(0.5)= 1.648698$$
$$e^{0.5} = 1.64872$$ You can see that this is correct to 3 decimal places. By playing a bit around I found out that it should be enough to go up to n=3.
$$e^x = \sum_{i=0}^3 \frac{x^n}{n!} \Rightarrow f(x) = 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} \Rightarrow f(0.5)= 1.646$$.
I'm feeling that I'm missing something simple but important but I can't find my mistake.

• What is the problem? You find an approximation and it's good to $0.00002$ which is better than you need. The estimate for the error is just an upper bound so don't expect it to give the minimum $n$ for which the error is less than $0.001$. Commented Aug 29, 2018 at 11:13
• Well you're right. The real precision is better than I wanted it. From quality perspective this is a good thing but from the needed time perspective of calculating the derivates (of a maybe more complicated function) it's a bad thing. I don't want to calculate the first 5 items if I only need 3. So my question would be: Is there any error in my calculated number of needed items and/or is there a way to calculate this more precise to reduce the number of unneded/unwanted series items? Commented Aug 29, 2018 at 11:19
• Moreover, following what Winther wrote, you proved that using only $n=3$ is not sufficient as the third digit after the dot is not correct. Commented Aug 29, 2018 at 11:20
• Yes that would be nice, but there is no general method to finding such a minimum $n$. Atleast not one that is computationally fast, you would need to do something like finding the exact value (to desired accuracy) and then checking $n=1,2,3,\ldots$. As you can see this would require much more computation. The advantage of Taylor's formula is that you get a an $n$ for which you then know that the accuracy is good enough. Commented Aug 29, 2018 at 11:22
• Note that your value $n$ depends on $M$. Choosing a smaller $M$ might result in a smaller $n$, but even for the safe value $M=2$ you would need $n=5$, because wiith $n=4$ the error term would be $0.001042$. With $M=\sqrt{3}$ you would get $n=4$. Commented Aug 29, 2018 at 11:36