# Why do we need Taylor polynomials?

This question doubles as "Is my understanding of what a Taylor polynomial is for, correct?" but In order to write out a Taylor polynomial for a function, which we will use to approximate said function at a given value, we must first have the function itself. BUT, if we already have the function, why not just use it and get an exact value instead of using it's Taylor polynomial and only getting an approximation? Also, how does this benefit computer programmers?

-

Often times we know the function at very specific values and we want to approximate around that value. An easy example is to consider the exponential around zero. We know that the exponential function at zero is one. We also know that every derivative at zero is one, but it'd be much more difficult to calculate say $e^{0.1}$. However, using just an order three Taylor polynomial $$T_3(x) = 1 + x + \frac{x^2}{2} + \frac{x^3}{6}$$ I can calculate $e^{0.1}$ to be approximately $1.10517$ which is accurate to $6$ significant digits. Higher order approximations give greater accuracy.

The Taylor series gives us methods to approximate around regions of interest. And how exactly does this benefit computer science? The ability to estimate well is already essential to programming. If only a certain amount of precision is needed, it is often faster to take an approximation than to make some sort of full calculation and Taylor polynomials give a standard way of making such approximations. Taylor polynomials also give an order of magnitude estimate which is quite useful for asymptotics.

-
In your first example, setting $a=0$ makes it technically a Maclaurin series no? Good example with $e^x$ though, very illustrative. – Astrid Feb 19 at 11:35
@Astrid Technically yes. But a Maclaurin series is just a specific type of Taylor series, in the same way that a van is a specific type of car. – EuYu Feb 19 at 11:44

How do your calculator/computer calculate $\pi$, $e$ and $\sin$ and $\cos$ values? I would bet, mostly using Taylor polynomial approximation.

For example, integrating $\arctan'(x)=\displaystyle\frac1{1+x^2} = 1-x^2+x^4-x^6\pm\dots$, we get that $\arctan(x) = x-\displaystyle\frac{x^3}3+\frac{x^5}5-\frac{x^7}7\pm\dots$. One still needs to think over that it is legal, but if we put $x=1$ in it, we get $$\frac\pi4=1-\frac 13+\frac 15-\frac 17\pm\dots$$

-