A map from $(0,1)$ to $(0,1)$ such that the image of every open interval in $(0,1)$ is $(0,1)$

Can we have a map from $(0,1)$ to $(0,1)$ such that the image of every open interval in $(0,1)$ is all of $(0,1)$ ?

• This is more or less the same as math.stackexchange.com/questions/186427/… – Chris Eagle Jul 28 '13 at 16:09
• Try something using $\sin\frac1x$ or its translates perhaps. – Karthik C Jul 28 '13 at 16:09
• If you want to explicitly use Chris Eagle's example $f:\mathbb R\to\mathbb R$, you could always say $g(x) = 1+\frac1{\pi}\arctan(\pi f(\tan(\pi(x-\frac12))))$ – Omnomnomnom Jul 28 '13 at 16:21
• @Omnomnomnom: Using $g(x)=f(x)$ where it makes sense and $g(x)=0.5$ where it doesn't would be significantly less crazy. – Chris Eagle Jul 28 '13 at 16:26
• @ChrisEagle that indeed makes sense and seems much less crazy. – Omnomnomnom Jul 28 '13 at 16:30

Yes. My favorite, though it takes a little cleaning in the corners is this one. Let $x\in (0,1)$ and express it in base $3$. If there are an infinite number of $2$'s in the expansion, set $f(x)=x$ and ignore it. Otherwise, cut off all the leading digits through the last $2$ and read the resulting number in binary to get $f(x)$. Given any $y \in (0,1)$ expressed in binary and an interval $(a,b)$ we can find $c \in (a,b)$ expressed in ternary ending in $2$ that we can append $y$ to and stay in $(a,b)$