Call a real valued function $f$ a piecewise polynomial if there exists a partition of the real line into non degenerate intervals such that the restriction of $f$ to each interval is a polynomial. Let $g$ be a continuous function mapping rationals to rationals. Must $g$ be a piecewise polynomial?
Piecewise polynomial
2 Answers
Enumerate the rationals $r_1,r_2,\dots$ and let $g(x)=a_1(x-r_1)+a_2(x-r_1)(x-r_2)+\dots$ where $a_1,a_2,\dots$ are rationals heading rapidly to zero. Then clearly $g(x)$ is rational for rational $x$, and if the $a_i$ go to zero fast enough then $g$ is analytic.
There is a theorem saying that for any two dense, countable sets $A, B \subset \mathbb{R}$ there exists a continuous and increasing bijection $f : A \to B$ (the proof is quite technical but also quite straightforward). If you take $A := \mathbb{Q}$ and select some relatively ugly $B$ (for instance, $B := \{ \frac{a}{2^n} : a \in \mathbb{Z}, n \in \mathbb{N} \}$ should suffice) you can show that $f$ cannot be a polynomial on any interval.
I'm not sure if you want the function to be bijective or not. If yes, the above can be modified taking by constructing two bijections $f_1 : A_1 \to B_1$ and $f_2 : A_2 \to B_2$ where $A_1 := B_2 := \{ \frac{a}{2^n} : a \in \mathbb{Z}$ nad $B_1 := A_2 := \mathbb{Q} \setminus A_1$