What is known about $\mathcal C^\infty$ functions $\mathbb R\to\mathbb R$ that always take rationals to rationals? Are they all quotients of polynomials? If not, are there any that are bounded yet don’t tend to a limit for $x\to +\infty$? If there are, then can we also require them to be analytic?
(This is basically just a random musing after I found myself using trigonometric functions twice in unrelated throwaway counterexamples. It struck me that it was kind of conceptual overkill to whip out a transcendental function for the purpose I needed: basically that it had to keep wiggling forever. I couldn’t think of a nice non-trancendental function to do this job, however, and now wonder whether that is because they can’t exist).
See Philip Franklin’s 1925 Trans. AMS paper Analytic transformations of everywhere dense point sets. Theorem I on p. 94 of Franklin’s paper states:
For any two enumerable linear point sets, each everywhere dense on an open interval, an analytic function can be found which maps the two intervals on one another, and effects a one to one correspondence between the point sets.
I think Franklin’s Theorems II and III can be used to answer your question, but I don’t have time now to think about it.
For related results (some of which I believe may also address your question) and additional references, see my 15 March 2002 sci.math post in the thread a question on real-analytic functions at google sci.math archive or Math Forum sci.math archive.
(what follows was added 4 days later)
This morning I was in the middle of preparing a chronological list of references when I came across the following paper by accident, which has in its first couple of pages an excellent historical summary of results related to your questions.
[William] Stephen Watson and Petr Simon, Open subspaces of countable dense homogeneous spaces, Fundamenta Mathematicae 141 #2 (1992), 101-108. MR 93m:54038; Zbl 770.54017
Below are some relevant references I know of that are not in Watson/Simon’s bibliography: Cooper (1939), Melzak (1960), Ceder (1987), Omiecinski (1980, 1982, 1983, 1991), and Green (1939). Also, as I had already “looked up” the details for Morayne (1987) and Melzak (1959) (both of which are in Watson/Simon’s bibliography), I’m leaving those below as well. Finally, I spent some time this morning typing quotes from Green (1939), a paper that does not seem to be freely available on the internet, so I’m leaving in those quotes as well.
Incidentally, regarding Franklin (1925): In the bibliographic listing for Franklin’s 1925 paper in Abraham A. Frankel’s book Abstract Set Theory (Franklin’s paper is cited in a footnote where order-uniqueness of countable unbounded dense linear orderings is proved), Frankel says to see H. Minkowski: Kongr. Heidelberg 1904, 171-172, 1905. This is freely available on the internet, but I do not know what Minkowski says or proves.
R. Cooper, Transformations of enumerable sets which are dense in an interval, Quarterly Journal of Mathematics (Oxford) 10 (1939), 247-251. MR 1,107c; Zbl 22.21302; JFM 65.0189.01
Zdzislaw Alexander Melzak, Existence of certain analytic homeomorphisms, Canadian Mathematical Bulletin 2 #2 (May 1959), 71-75. MR 21 #4215; Zbl 89.27603
Zdzislaw Alexander Melzak, A countable interpolation problem, Proceedings of the American Mathematical Society 11 #2 (April 1960), 304-306. MR 22 #2599; Zbl 91.04702
Michal Morayne, Measure preserving analytic diffeomorphisms of countable dense sets in $C^n$ and $R^n,$ Colloquium Mathematicum 52 #1 (1987), 93-98. MR 88f:28015; Zbl 627.28012
Jack Ceder: MR 88g:54040; Zbl 641.54020
Jan Omiecinski: MR 82i:26005 Zbl 485.26007; MR 84k:26021 Zbl 523.26019; MR 85j:26012 Zbl 549.26003; MR 92m:26007
John Willie Green, Functions which assume rational values at rational points, Duke Mathematical Journal 5 #1 (1939), 164-171. Zbl 20.35202; JFM 65.0327.03
For what it’s worth, Green was Andrew M. Bruckner’s Ph.D. advisor. What follows is the introduction to Green’s paper.
Of the continuous functions which assume rational values for rational values of the argument, the familiar examples either are extremely regular, as the rational or piecewise rational functions, or else exhibit some extremely irregular properties. For example, the functions $x(t),$ $y(t)$ defining Peano’s area filling curve assume rational values for rational $t$ and are nowhere derivable. Likewise the familiar function defined with respect to Cantor’s ternary set as $\frac{1}{2}$ on the middle extracted one-third, $\frac{1}{4}$ and $\frac{3}{4}$ on the extracted middle one-thirds of the left- and right-hand remaining intervals, respectively, etc. can be shown to assume rational values for rational $x.$ This function possesses a derivative at no point except points where it is piecewise rational. It is desired, then, to investigate what kinds of functions may possess the property of assuming rational values at rational points, which property we shall denote by (A). For example, it might be asked whether the only analytic functions with property (A) are the rational functions, or it might be asked if it is possible that a function exist with property (A), the function being analytic in no interval and yet, say, having a continuous derivative. The author has been informed that something of this nature was discussed in a conversation between Weierstrass and Hilbert and that Hilbert exhibited an example; however, no record of the conversation seems to be extant. Neither has the author been able to find the example mentioned in the literature, or to discover its exact nature. Consequently, some of the results obtainable may be of sufficient interest to warrant their exposition.
In the following, a rational complex number is a complex number such that both its real and imaginary parts are rational numbers.
THEOREM 1. There exist entire functions which possess the property (A) with respect to all rational complex numbers, and which are not rational functions.
In the following, rational point is a rational complex number and the functions are from $\mathbb C$ to $\mathbb C.$
THEOREM 2. Let $E_1$ and $E_2$ be any mutually disjoint sets of rational points. Then there exist analytic functions assuming rational values at points of $E_1$ and assuming rational values at no point of $E_2.$
Let $P(z) = a_{0} + a_{1}z + a_{2}z^{2} + \cdots$ converge for all $z \in {\mathbb C}$ and assume that $P(z)$ possesses property (A). Question 1 Is it possible for each $a_{k}$ to be a rational complex number and $P(z)$ to not be a rational function? Question 2 Is it possible for some of the $a_{k}$’s to be irrational?
THEOREM 3. The questions (1) and (2) above may be answered affirmatively.
In the following, all functions are from $\mathbb R$ to $\mathbb R.$
We define a function $f_{n}(x)$ as follows. Let $S_n$ be the set of points between zero and one of the form $m/(2^{n-1}n!)$ $(m=0,\;1,\;\cdots,\;2^{n-1}n!).$ Let $p<q$ be two consecutive points of $S_{n};$ then $f_{n}(x)$ is defined for $p \leq x \leq q$ as the continuous function vanishing at $p$ and $q,$ and with derivative $+1$ for $p < x< \frac{1}{2}(p+q)$ and derivative $-1$ for $\frac{1}{2}(p+q) < x < q.$ Then $0 \leq f_{n}(x) \leq \left(2^{n}n\right)^{-1},$ and $\Sigma_{1}^{\infty}f_{n}(x)$ converges uniformly. We define $f(x) = \Sigma_{n=1}^{\infty}f_{n}(x).$ It follows from well-known principles that $f(x)$ possesses a derivative at no point.
(For this last claim, Green cites p. 621 of Hobson, The Theory of Functions of a Real Variable, 1907.)
THEOREM 4. A function possessing property (A), with continuous $k$-th derivative and with $(k+1)$-th derivative nowhere, can be obtain by integrating $f(x)$ $k$ times and subtracting a polynomial of degree $k,$ possibly with irrational coefficients.
The references given by Dave Renfro and Cocopuffs did not completely answer my question, but gave enough inspration that I think I’ve got it now. After several false starts:
Theorem. There exists an analytic function $\xi:\mathbb R\to[0,1]$ such that
Proof. Let $q_1, q_2, \ldots$ be a fixed enumeration of the rationals. Define by simultaneous induction a sequence of functions $f_0, f_1, f_2\ldots$ and integers $m_0<m_1<m_2\cdots$, as follows:
As (more or less arbitrary) base cases, let $f_0(x)=0$ and $m_0=1$.
For $n\ge 1$, let
$$h_n(x) = \prod_{i=1}^n(q_n-x) = a_{n0}+a_{n1}x+\cdots+a_{nn}x^n$$
(where the middle part defines the coefficients $a_{ni}$ on the right hand side) and
$$ f_n(x) = \frac{h_n(x)}{2^n\Bigr\lceil |a_{n0}|+|a_{n1}|m_{n-1}+\cdots+|a_{nn}|m_{n-1}^n \Bigr\rceil}$$
Note that $f_n$ is a polynomial with rational coefficients and $|f_n(z)|\le 2^{-n}$ for every complex $z$ with $|z|\le m_{n-1}$.
Now if $n$ is even let $m_n$ be first integer larger than $m_{n-1}$ such that $\sum_{i=0}^{n}f_i(m_n)\ge 2$. If $n$ is odd, let $m_n$ be the first integer larger than $m_{n-1}$ such that $\sum_{i=0}^{n}f_i(m_n)\le-2$. Since the leading coefficient of $h_n$ is $(-1)^n$ these conditions are always true for large enough $m_n$.
After defining all $f_n$, let
$$ g(x) = \sum_{i=0}^\infty f_n(x) $$
Properties of $g$:
The sum converges uniformly in the open ball $B_{m_n}(0)$ for all $n$, because except for the first $n$ terms, every $f_i$ is bounded absolutely by $2^{-i}$, and the sum of these converges.
Because uniform convergence in an open subset of $\mathbb C$ preserves analyticity, $g$ is analytic on every $B_{m_n}(0)$ and so on all of $\mathbb C$.
$g$ maps rationals to rationals. For any fixed $q$ there are finitely many terms in the sum for $g(q)$ before every $f_n(q)$ is zero by constructions.
$g(m_1), g(m_2), \ldots$ are alternately less than $-1$ and greater than $1$. By construction $\sum_{i=0}^{n} f_i(m_n)$ is less than $-2$ or greater than $2$, and the remaining terms in $g(m_n)$ cannot change the sum by more than $1$.
By the intermediate value theorem there is a zero of $g$ between every $m_n$ and $m_{n+1}$.
Finally, let
$$ \xi(x) = \frac{g(x)^2}{g(x)^2+1}$$
Then $\xi$ is analytic because $g$ is. Its range is trivially at most $[0,1]$. It maps rationals to rationals because $g$ does.
Also, $\xi$ cannot have a limit for $x\to\infty$. It is zero infinitely often, but it is also at least $\frac12$ at every $m_n$.
Remarks. The definition of $\xi$ is completely constructive, and $\xi(q)$ can be computed in finitely many steps for any $q\in\mathbb Q$.
Incidentally, $\lim_{x\to-\infty}\xi(x)=1$, buf if we also want absence of limits for $x\to-\infty$ just consider $\xi(x^2)$ instead.
I think I will continue using sines in throwaway counterexamples 🙂