# Taylor Series for $e^x$ where $x = 1$, estimating the Error

I'm trying to calculate $e$ to a certain number of digits. The Maclaurin Series expansion of $\displaystyle e^x = \sum_{n=0}^\infty \frac{x^n}{n!}$. When $x = 1$ we can approximate the value of $e$ by evaluating $\displaystyle\sum_{n=0}^m\frac1{n!}$. How can I find the error in the approximation when I compute the sum to $m$? If I take the output from the series, how many digits (truncated) of my approximation to $e$ are correct if I evaluate it to $m$ terms?

In general, how can we find the error when evaluating such a series?

Another good series, Brother's Formula (converges to $e$ faster than the one noted earlier):

$$\sum_{n=0}^\infty \frac{2n+2}{(2n+1)!}$$

Edit: To find the digits that are correct, add the upper bound for the error to the estimate and the digits before the first digit that changed are correct. For example, let's say that we have found $3.1234122$ as an estimate to some series. Let's say that we compute the error to be less than $0.0001879$. To find the digits that are correct in the estimate:

$$3.1234122 + 0.0001879 = 3.1236001$$ Thus we can see that the digits that we can be sure to be correct are $3.123$ so the first 4 digits of the number are $3.123$.

-

I've written another answer on this subject for Taylor series, and use $e^x$ as an example.

For Brother's formula, I've never seen it before but we can use some standard tricks to represent it.

I can first define $f(x) = (e^x - e^{-x})/2$ to cancel out all of the even terms out of the Taylor series for $e^x$:

$$f(x) = \sum_{n=0}^{+\infty} \frac{x^{2n+1}}{(2n+1)!}$$

If you're savvy, you might recognize this (either the series or the definition of $f(x)$) as the hyperbolic sine function: $f(x) = \sinh x$.

A common trick is to differentiate the series to bring the exponent on $x$ out as a coefficient. But this series is not quite right. Define

$$g(x) = x f(x) = \sum_{n=0}^{+\infty} \frac{x^{2n+2}}{(2n+1)!}$$

Now, define

$$h(x) = g'(x) = \sum_{n=0}^{+\infty} \frac{(2n+2) x^{2n+1}}{(2n+1)!}$$

So, we can apply the ideas of estimating the error of a Taylor series towards the calculation of $h(1)$, where

$$h(x) = \sinh x + x \cosh x = \frac{1}{2} \left( e^x - e^{-x} + x e^x + x e^{-x} \right)$$

Or, you might analyze the error on the Taylor series for $\sinh x$ and $\cosh x$ individually, and then combine them into an analysis of $h(x)$.

-
Strangely, that answer allows evaluation for the Mclaurin Series when $0<x<1$ and $x>1$, but not $x=1$, or did you just leave out the equals part on one of the ranges? – Justin May 1 '13 at 4:57
@gangqinlaohu: I fully expect that you could take any section of that analysis, and replace all of the $<$ with $\leq$ on one side of the inequalities. I'm just used to exluding the endpoints in these sorts of calculations because weird things often happen at endpoints. – Hurkyl May 1 '13 at 5:05
I don't quite understand all of the content from either answer. In your other answer, what is $c$? Also, the math is a bit confusing. In this answer, why did you define $f(x)$ to be $sinh(x)$? If I understand correctly, you are trying to remove all even terms from the series expansion of $e^x$ (which seems right for Brother's Formula). You then multiply by $x$ to make it fit the form you want. You then differentiate to find $h(x)$ which gives $e$ when $x=1$ but where did the formula for the error come from? What are these "ideas" of estimating the error of a Taylor Series? – Justin May 1 '13 at 5:15

There is a simple way to bound the error. Suppose you did your aproximation until some $m$, I mean, you computed $\displaystyle\sum_{n=0}^m\frac{1}{n!}$. Your exact error is $\displaystyle\sum_{n=0}^\infty\frac{1}{n!}-\sum_{n=0}^m\frac{1}{n!}=\sum_{n=m+1}^\infty\frac{1}{n!}$.

But note that $$\sum_{n=m+1}^\infty\frac{1}{n!}<\sum_{n=1}^\infty\frac{1}{(m+1)^n}=\frac{1}{m}.$$ What is an acceptable(if the idea is just to get some bound, not necessarily a good bound) error bound.

-

Improving @Integral's bound:

\begin{align} \sum_{n=m+1}^\infty \frac{1}{n!} &= \frac{1}{(m+1)!} \left( \frac11 + \frac1{m+2} + \frac1{(m+2)(m+3)} + \cdots \right) \\ &\le \frac{1}{(m+1)!} \left( \frac11 + \frac1{m+2} + \frac1{(m+2)^2} + \cdots\right) \\ &= \frac{1}{(m+1)!} \frac{1}{1-\frac1{m+1}} = \frac{1}{(m+1)!} \frac{m+1}{m} = \frac1{m\cdot m!} \end{align}

(comparing with a geometric series)

-
In fact, you can show that $\lim_{n\to\infty}\left(e-\sum_{k=0}^n\frac{1}{k!}\right)n\,n!=1$. – TZakrevskiy Nov 24 '15 at 11:42