No, this is not possible. Dave L. Renfro wrote an excellent historical Essay on nowhere analytic $C^\infty$ functions in two parts (with numerous references). See here: 1 (dated May 9, 2002 6:18 PM), and 2 (dated May 19, 2002 8:29 PM).
As indicated in part 1, in
Zygmunt Zahorski. Sur l'ensemble des points singuliers d'une fonction d'une variable réelle admettant les dérivées de tous les ordres, Fund. Math., 34, (1947), 183–245. MR0025545 (10,23c); and Supplément au mémoire "Sur l'ensemble des points singuliers d'une fonction d'une variable réelle admettant les dérivées de tous les orders", Fund. Math., 36, (1949), 319–320. MR0035329 (11,718a),
Zahorski suggested in 1947 the following classification of points where a function $f$ is $C^\infty$ but not analytic:
- A point $a$ is a C-point (for Cauchy) iff the formal Taylor series about $a$ associated to $f$ converges in a neighborhood of $a$, but the resulting analytic function does not coincide with $f$ in any neighborhood of $a$.
- The point $a$ is a P-point (for Pringsheim) iff the formal Taylor series of $f$ about $a$ has radius of convergence $0$.
Theorem (Zahorski). Let $C,P$ be sets of real numbers. The following are equivalent:
- $C$ and $P$ are the sets of C-points and P-points, respectively, of some $C^\infty$
function $f:\mathbb R\to\mathbb R$.
- The following 4 conditions hold:
- $C$ is a first category $F_\sigma$ set.
- $P$ is a $G_\delta$ set.
- $C\cap P=\emptyset$.
- $C\cup P$ is closed in $\mathbb R$.
As a corollary, note that if $f:\mathbb R\to\mathbb R$ is smooth, and its set of P-points is empty then, since no interval is first category (by the Baire category theorem), in every interval there must be points where $f$ is analytic.
Two other key references you may want to consult (also mentioned in Renfro's essay) are
Gerald Gustave Bilodeau. The origin and early development of nonanalytic infinitely differentiable functions, Arch. Hist. Exact Sci., 27 (2), (1982), 115–135. MR0677684 (84g:26017),
and
Helmut R. Salzmann, and Karl Longin Zeller. Singularitäten unendlich oft differenzierbarer Funktionen, Math. Z., 62 (1), (1955), 354–367. MR0071479 (17,134b).
(The latter contains a simplified proof of Zahorski's result.)
(Coincidentally, last term I had the opportunity to cover some of the results in this area in my analysis class. See also MathOverflow, for a version of this question, and the related question of whether the set of P-points can be $\mathbb R$.)
Infinitely differentiable functions whose Taylor series diverges except at $0$:
- $\displaystyle f(x)=\int_0^\infty e^{-t}\cos(t^2 x)\;dt$.
Source: A primer of real functions by R. Boas Jr.
- $\displaystyle f(x)=\sum_{n=1}^\infty f_n(x)$, where $f_n(x)=\phi_{n,n-1}(x)$, where
$$\begin{aligned}
&\phi_{n1}(x)=\int_0^x\phi_{n0}(t)\;dt,\\
&\phi_{n2}(x)=\int_0^x\phi_{n1}(t)\;dt,\\
&\quad\vdots\\
&\phi_{n,n-1}(x)=\int_0^x\phi_{n,n-2}(t)\;dt,
\end{aligned}$$
where
$$\phi_{n0}(x)=\left\{\begin{aligned}
((n-1)!)^2,&\quad \text{if}\quad 0\leq |x|\leq \frac{1}{2^{n}(n!)^2}\\
0,&\quad \text{if}\quad |x|\geq \frac{1}{2^{n-1}(n!)^2}.
\end{aligned}\right.$$
Source: Counterexamples in Analysis by B. Gelbaum and J. Olmsted.
Best Answer
Define the family of $C^\infty$ functions $$ \varphi_n(x)=\left\{\begin{array}{cl} 0&\text{for }x\le0\\ \frac{e^{\frac{n}{1-x}}}{e^{\frac{n}{x}}+e^{\frac{n}{1-x}}}&\text{for }0\lt x\lt1\\ 1&\text{for }x\ge1 \end{array}\right. $$ then $$ \varphi_n^\prime\!\left(\frac12\right)=2n $$
With $f(x)=e^{-\frac1x}$, and $x_k=\frac1k$, define $$ \begin{align} g(x) &=f(x_k)+(f(x_{k-1})-f(x_k))\,\varphi_{n_k}\!\!\left(\frac{x-x_k}{x_{k-1}-x_k}\right)&&\text{for }x_k\le x\le x_{k-1}\\ &=e^{-k}\left(1+(e-1)\varphi_{n_k}((k-1)(kx-1))\right)&&\text{for }\frac1k\le x\le\frac1{k-1}\\ \end{align} $$
$g$ is infinitely differentiable, monotonically increasing, and $g(x)\le e^{1-\frac1x}$.
For integer $k\ge1$, $$ g'\!\left(\frac1k\right)=0 $$ and for integer $k\ge2$, $$ g'\!\left(\frac12\left(\frac1{k-1}+\frac1k\right)\right)=2n_kk(k-1)(e-1)e^{-k} $$ If we set $n_k=3^k$, then $g'(x)$ varies between $0$ and $2k(k-1)(e-1)\left(\frac3e\right)^k$ on $\left[\frac1k,\frac1{k-1}\right]$. Thus, $g''(0)$ does not exist.