# nonstandard example of smooth function which fails to be analytic on $\mathbb{R}$

When I teach second-semester calculus I usually discuss the function $f$ defined by $$f(x)=e^{-1/x^2}$$ for $x \neq 0$ and $f(0)=0$. Or, almost the same example, $g$ defined by $$g(x)=e^{-1/x^2}$$ for $x>0$ and $g(x)=0$ for $x \in (-\infty,0]$. Both $f$ and $g$ are too smooth at $x=0$ to be analytic on a neighboorhood of the origin. Each has trivial Taylor series at $x=0$ and yet each function is clearly nonzero in any open nbhd which contains zero. So far as I'm aware, these are the standard examples to clarify the distinction between smooth and analytic functions on $\mathbb{R}$

Question: are there other examples of functions which are smooth but non analytic? Is it possible to give a smooth function which fails to be analytic on an interval? How special are the examples I offer?

I realize you can shift my examples vertically, horizontally, rescale or even add an analytic function to make it look different. Ideally I'm looking for a genuinely different looking example then the two I offered; also, given the intended audience, I dream of a formula which is accessible to calculus II students. I hope the spirit of the question is clear.

-
When asked for a distinction, I once gave the slightly different $$h(x) = e^{-1/x^2} \; \sin(1/x^2)$$ as a smooth function that did not resemble a polynomial as $x =0$ is not an isolated zero. One-variable polynomials and analytic functions have isolated zeros. –  Will Jagy Sep 2 '12 at 1:40
@WillJagy is there anyway I can accept two answers? I'd like to. If not, I'm going to have to get a quarter and flip on it. –  James S. Cook Sep 2 '12 at 2:16
@kahen is there anyway I can accept two answers? I'd like to. If not, I'm going to have to get a quarter and flip on it. –  James S. Cook Sep 2 '12 at 2:16
There is a nice example on the wikipedia page: en.wikipedia.org/wiki/… –  Chris Janjigian Sep 2 '12 at 2:30

Very nonstandard: the real function $f(x)$ on all of $\mathbb R$ with $$f(0), \; f'(0) = 1, \; f(f(x)) = \sin x .$$ See http://mathoverflow.net/questions/45608/formal-power-series-convergence/46765#46765

-
so this example is smooth everywhere and non-analytic at isolated points every so often? Is that fair? I read the overflow page, might be a little much for my calculus class... I also liked the $\sin(1/x^2)e^{-1/x^2}$, this I will use. –  James S. Cook Sep 2 '12 at 2:11
@JamesS.Cook , life isn't fair. –  Will Jagy Sep 2 '12 at 2:27
Is it correct? My wife broke the tie, you win. Sorry kahen. –  James S. Cook Sep 2 '12 at 2:35
@JamesS.Cook, your wife is a fine human being. –  Will Jagy Sep 2 '12 at 3:05
@JamesS.Cook, sent you a pdf with a graph of $f(x)$ and $\sin x$ on the same axes. If you do not get it pretty soon, check your spam folder. –  Will Jagy Sep 2 '12 at 3:21
show 1 more comment

If you teach the Cauchy-Hadamard formula, the example from this previous answer of mine might be decent.

PS: I'm not entirely sure I applied it correctly in the example. Compute the radius of convergence yourself to make sure.

-
it is doubtful I teach that formula, I get into some trouble by talking about complex exponentials as it is... that said, your previous answer is nice. I have not checked the r.o.c. –  James S. Cook Sep 2 '12 at 2:14
You may prefer the alternative definition as given in this link: math.osu.edu/~edgar.2/selfdiff –  Samuel Sep 3 '12 at 1:12