What functions, if any, can NOT be approximated by a Taylor series? I am taking some courses online (machine learning) and the instructor noted that a Taylor series can be used to approximate any function.  A student left a comment that a Taylor series cannot approximate ANY function, but noted that the instructor probably stated it unequivocally because it can certainly approximate any function we would need for the class.
I am curious, what functions cannot be approximated by a Taylor series?
Two things lead me to believe that any function CAN be approximated by a Taylor series:


*

*In context of regression, it seems I can always continue to add terms and adjust the coefficients on those terms (or solve for them to reduce the error) to continually get a better approximation of points in my data set.

*The ambiguity of the word approximate suggests that we don't have to meet a strict criteria to say that a Taylor series approximates a function.


With those things in mind, I can also see a point to the opposite view.  For example, a function with large discontinuities such as
$f(x) = \begin{cases}sin(x)/x^2 & \text{if $x < 0$} \\ 2x & \text{if $x > 100$}\end{cases}$ 
seems like it wouldn't be well approximated by a Taylor series.  But then again, without some defenition of approximate, I don't see how we can say either way.
 A: Notice that to have a taylor series, our function must be smooth (e.g. infinitely continuously differentiable). Hence, a counter example will be any function that isn't smooth. Indeed, a simple counter example is \begin{align} f(x) = |x| \end{align} We cannot obtain a taylor series around $x=0$ because $f'(0)$ is not continuous. 
For more sophiscated counter examples where $f$ is smooth, https://en.wikipedia.org/wiki/Non-analytic_smooth_function. 
But a curious fact is that for a complex valued function $g$, then $g$ is smooth if and only if it's analytic(e.g. has a taylor series).
A: Here's a function that is smooth (infinitely differentiable) but fails to have a Taylor series at $x=0$:
Consider $f(x)=e^{-\frac{1}{x^2}}$ for $x \in \mathbb{R}-0$ and $f(0)=0$. 
Show that $f^{(n)}=0$ and therefore the Taylor series for this function, if it existed, must be $0$. While this function is clearly not constant in any neighborhood of $0$.
In general, analytic functions have Taylor series. This is pretty much the definition of an analytic function as far as I'm aware.
