Excel's EXP function compared to a series expansion

387 Views Asked by At

I am comparing the results of a series expansion of $e^x$ to Excel's $\mathop{EXP}(x)$ function. Should I expect them to be the same?

Excel's gives $\mathop{EXP}(10) = 22026.4657948067$. However, the series expansion, to 21 terms is $22031.0549667285$

This is using the series expansion below: $$e^x=1+\frac{x}{1!}+\frac{x^2}{2!}+\cdots$$

2

There are 2 best solutions below

0
On

Excel's value for $EXP(10)$ is correct to the digits quoted. You seem to have made a mistake in your "series expansion": a truncation of the series, when $x > 0$, should be less than the true value, and yours is greater. The correct value of $\sum_{j=0}^{21} 10^j/j!$ (yes, that's really $22$ terms, not $21$) would be $22011.0549667285$.

1
On

Excel is correct, and your sum of the series expansion is not, presumably because of accumulated numerical error. The sum of the first 21 terms of the series expansion should be $$ \sum_{n=0}^{20} \frac{10^n}{n!} \;=\; \frac{29687012153221}{1349932311} \;\approx\; 21991.4820256650. $$ Note that this is quite far off from the actual value of $e^{10}$. For numbers as large as $10$, the series for $e^x$ really doesn't converge that quickly. You would need to use at least 44 terms of the series to get ten decimal places of accuracy.