# Are there non-periodic continuous functions with this property?

Suppose $f$ is a real-valued continuous non-constant function defined on all of $\mathbb{R}$. Let $A = \text{image} f$. Suppose also that there is a $L > 0$ such that for every half open interval $I \subseteq \mathbb{R}$ with $| I | = L$, $\text{image} f|_{I} = A$. Must $f$ be periodic?

• sounds like $\tan(x)$ to me. It doesn't have to be periodic as you can imagine a slight change to the curve at each interval. – BananaCats Category Theory App Oct 12 '13 at 2:29
• It's not continuous on all of $\mathbb{R}$. – user18063 Oct 12 '13 at 2:34
• If by range in this case you mean that $f$ takes all real values on a half-open interval $[a,b)$, say, then it cannot be continuous because it has to be bounded on $[a,b]$. – lhf Oct 12 '13 at 2:41
• There seems to have been a lot of confusion caused by the original wording. I have edited to clarify. – user18063 Oct 12 '13 at 3:08

No; a counterexample is $x\mapsto \sin |x|$ with $A=[-1,1]$ and $L=4\pi$.
• That seems like a cheat, because it's a piecewise function constructed from two periodic functions. What if we require something stronger than being non-periodic, like there can be no $a$, $b$, and $c$ such that $f(x) = f(x+c)$ for all $x$ in $[a,b)$? – Keshav Srinivasan Oct 12 '13 at 3:32
• @KeshavSrinivasan: What about $\sin(x^3+x)$ with $L=2\pi$ instead, then? – Henning Makholm Oct 12 '13 at 3:34
• That also seems to violate the spirit of the question, because while $f(I)$ does technically equal $A$ whenever $|I|=2\pi$, the graph of f passes through the points in $A$ a different number of times in each such interval. So what if we require in addition that the "multiplicity" of the values in the range must be matched, i.e. if $|I_1| = |I_2| = L$, then for any $y$, the number of times that $f(x) = y$ in $I_1$ must equal the number of times that $f(x) = y$ in $I_2$? – Keshav Srinivasan Oct 12 '13 at 3:49
• @KeshavSrinivasan: That would imply pretty directly that $L$ is a period of $f$ -- if you move the interval any small distance to the right, the values that drop out at the left end must be exactly the same as the ones that enter at the right end. – Henning Makholm Oct 12 '13 at 11:11
• But apart from that, how's $(\cos^2 x)^{1+x^2}$ for spirit? – Henning Makholm Oct 12 '13 at 11:13
Attaining all real values in each length $L$ interval would mean that the function tends to positive infinity and negative infinity in the same bounded interval. This is clearly impossible for a continuous function.
Edit: This was a response to an earlier iteration of the question, in which it was only specified that the function be continuous. In that case, observe a continuous function on a closed and bounded (i.e., compact) interval achieves its minimum and maximum; thus, taking any closed interval of length $L$, you could not hope to have the function defined at all $x$ and attain all real values.