I noticed that none of the "nice" sigmoid functions I know of sends rationals to rationals.
I set out to find a sigmoid function that maps rationals into rationals. I did find one, but it is not smooth. I wonder if such a function exists, and if not, what is the connection between this non-existence and the requirement that it and its inverse map rationals to rationals.
The function $$ x \mapsto \begin{cases} \frac{1}{2 (1 - x)} &, \text {if} \ \ x < 0 \\ \frac{2 x + 1}{2 (1 + x)} &, \text {if} \ \ x \geq 0 \end{cases} $$ is a strictly increasing bijection from $\mathbb{R}$ onto $(0, 1)$, and it maps $\mathbb{Q}$ into $\mathbb{Q}\cap(0, 1)$.
Furthermore, its inverse
$$ y \mapsto \begin{cases} \frac{2 y - 1}{2 y} &, \text {if} \ \ 0 < y < \frac{1}{2} \\ \frac{2 y - 1}{2 (1 - y)} &, \text {if} \ \ \frac{1}{2} \leq y < 1 \end{cases} $$
maps $\mathbb{Q}\cap(0, 1)$ into $\mathbb{Q}$.
Therefore, the restriction of this function to $\mathbb{Q}$ is a monotone bijection from $\mathbb{Q}$ onto $\mathbb{Q}\cap(0, 1)$.
The original function (over $\mathbb{R}$) is not smooth, however: its second derivative does not exist at $x = 0$.
Does there exist a smooth monotone bijection from $\mathbb{R}$ onto $(0, 1)$ whose restriction to $\mathbb{Q}$ maps $\mathbb{Q}$ onto $\mathbb{Q}\cap(0, 1)$? Is it possible to write down a formula for it?
EDIT: Below is the function one gets if one subtracts $\frac{1}{2}$ from the expressions in the original definition.
$$ x \mapsto \begin{cases} \frac{x}{2 (1 - x)} &, \text {if} \ \ x < 0 \\ \frac{x}{2 (1 + x)} &, \text {if} \ \ x \geq 0 \end{cases} $$
(Informally, this "translates" the graph of the function down by $\frac{1}{2}$, so that the function's value at $0$ is $0$.)
This "translate" of the original function more clearly shows its symmetry.
EDIT2: I realized after the fact that the word "monotone" in the phrase "smooth monotone bijection" is probably redundant. I cannot envision a smooth bijection on $\mathbb{R}$ that fails to be monotone. (The sign of the first derivative must remain bounded away from zero if the function is going to be injective.)