Derivatives with rational numbers A definite integral written entirely in terms of rational numbers and functions of rational numbers does not always equal a rational number. For example, with the function $1/x$,
$$
\int_1^2 \frac{dx}{x}  = \ln 2$$
I am curious whether or not this is also true for derivatives. Given a function $f$ for which the image of $\mathbb Q$ is a subset of $\mathbb Q$, is the image of $\mathbb Q$ under $f'$ always a subset of $\mathbb Q$? I have verified that this is true for every function written as a combination of arithmetic operations, but I have not verified it for all rational functions.
 A: No; this is not true. One has a lot of freedom constructing differentiable functions $\mathbb Q\rightarrow \mathbb Q$ - this problem is susceptible to the usual tricks of enumerating the rational numbers and nudging them into place one by one.
For any desired real number $\alpha$, we will now construct a continuously differentiable $f:\mathbb R\rightarrow\mathbb R$ such that $f'(0)=\alpha$ and $f(\mathbb Q)\subseteq \mathbb Q$.
In broad strokes our proof will work as follows: we fix an enumeration $c_1,c_2,c_3,\ldots$ of the rational numbers, then prove the following:

Lemma: There is some sequence of continuously differentiable functions $f_0,f_1,f_2,f_3,\ldots$ such that:

*

*$|f_i'(x)-f_{i+1}'(x)| < \frac{1}{2^i}$ for all $i$ and $x$.

*$f(0)=0$.

*$f'(0)=\alpha$.

*$f_i(c_i)\in\mathbb Q$.

*If $j\leq i$ then $f_{i}(c_j)=f_{i+1}(c_j)$.


From this lemma, it is straightforwards to see that $f(x)=\lim_{n\rightarrow\infty}f_n(x)$ is such that $f(\mathbb Q)\subseteq \mathbb Q$ and $f'(0)=\alpha$.
To construct such a function, we first need to choose some continuously differentiable function $t$ supported on $(-1,1)$ such that $t(0)=1$ - which are easy enough to come by, so we will not specify which. We also need to choose a sequence of radii $r_i$ such that the intervals $(c_i-r_i,c_i+r_i)$ don't contain any elements $c_j$ for $j<i$ and also don't contain $0$.
From this, we may define a function $t_i(x)=t\left(\frac{x-c_i}{r_i}\right)$ and propose that we define the desired sequence by, once we have constructed the first $i$ terms $f_0,f_1,\ldots,f_i$, extending the sequence by setting
$$f_{i+1}=f_i+\beta t_{i+1}$$
noting that this definition satisfies condition (2), (3), and (5) by choice of  radii $r_i$, satisfies condition (1) for all sufficiently small $\beta$ and satisfies (4) for every value in the coset $\mathbb Q - f_i(c_{i+1})$ - but, of course, we can choose a sufficiently small value in that coset, thus can always  extend such a sequence by one term. Note also that we can choose $f_0(x)=\alpha x$ as a starting point to this construction, as this sequence of one function satisfies the stated conditions. Therefore, we can inductively construct an infinite sequence satisfying the conditions and note that the limit of this sequence has the desired properties.
