I recently came across the following theorem.
Theorem
Let $f\colon U\to \mathbb K$ be a non constant analytic function, where $U$ is an open connected space of $\mathbb K=\mathbb R\text{ or }\mathbb C$.
Then $f$ is an open map (i.e. is $V$ is open, then $f(V)$ is open).
I was wondering about a counterexample if $f$ is only $C^\infty$, but I was not able to find one. Do you have one ?
In the complex case, the theorem is called the open mapping theorem. The Theorem is actually false for $\mathbb{R}$, as the example $\sin(x)$ over $\mathbb{R}$ shows. ($\sin[(0,4\pi)] = [-1,1]$.) One could also consider the function $f(x) = x^2$ which maps $(-1,1)$ to $[0,1)$.
The original counterexample loses some interest, but I will keep it here for the sake of keeping the record: A counterexample over $\mathbb{R}$ is the bump map, i.e., $f(x) = e^{-1/(1-|x|^2)}$ for $|x|<1$ and $f(x)=0$ for $|x|\geq 1$. Then $f$ is $C^\infty$, but $f[(-2,2)] = [0,e^{-1}]$ is closed.
The idea here is that the bump map interpolates smoothly between the constant function $0$ to the left and right of $[-1,1]$.