TITLE: Is there a non-constant smooth function mapping $\mathbb{R}$ into $\mathbb{Q}$
QUESTION [7 upvotes]: I cannot think of a non-constant smooth function which maps all real numbers into rational numbers. 
Can anyone give a simple example ? The simpler, the better !

REPLY [2 votes]: However, you didn't mention these two creatures as they are in Group Theory; I want to note some points about them from Group Theory point of views. We know that $G_1=(\mathbb Q,+)$ and $G_2=(\mathbb R, +)$ are both groups and of course abelian, i.e; $x+y=y+x$. Moreover in $G_1,G_2$ and for every $n\in\mathbb N$ and $a\in G_1~~\text{or}~~a\in G_2$ we can find some $x\in G_1~~\text{or}~~\in G_2$ such that the equation $a=nx$ has at least one solution (Divisibility). Also both groups are torsion free and so they are both vector spaces over $\mathbb Q$. If $G_1\cong\ G_2$ so both should be have the same dimensions over $\mathbb Q$. But this not true. These points just show that Rational and Real numbers have another differences as well.