Rational numbers from irrational numbers Can any real function of irrational numbers  be rational ? If possible, please give examples. Special case  $ e^ {\pi i } = -1 $ seems to restrict solutions entirely to complex numbers. The question is right now vague as I do not know how to  exclude "obviously  derived " examples.
 A: The cosine of $\pi$ is -1, a rational number.
A: You can construct required function from any real function, rounding the result to finite number of decimals.
A: What about $f(x)=x^2$? One has $f(\sqrt2)=2$.
A: A well-known example.  
Is $m:=\sqrt{2}^{\sqrt{2}}$ rational?  If yes, that is your answer.  
If no, then $m^\sqrt{2}$ is your answer: $m$ and $\sqrt{2}$ are irrational, but
$$
m^\sqrt{2} = \left(\sqrt{2}^\sqrt{2}\right)^\sqrt{2}
=\sqrt{2}^{(\sqrt{2}\cdot\sqrt{2})} = \sqrt{2}^2 = 2
$$
is rational.
A: Sure. Choose any constant function $f : \mathbb R \setminus \mathbb Q \to \mathbb Q$, for example
$$f(x) = 1 \quad\text{ for all } x \in \mathbb R \setminus \mathbb Q$$
If this answer seems flippant, you may want to sharpen the question.
A: I don’t understand your question, since it seems to be insufficiently quantified. Do you mean, “Is there a function that takes every irrational number to a rational?”? Or do you mean, “Given an irrational number, is there a function that takes it to a rational image?”? Your example seems to support the second interpretation, in which case I’d suggest the function $f(x)=x/a$, if your given irrational number is $a$.
And you didn’t say what kind of function you were allowing. Any continuous function? Analytic? I can suggest all manner of discontinuous functions that take irrationals to rationals, beyond of course the ultimate in continuity, the constant functions.
A: According to a famous theorem about trascendental numbers for all $\alpha$ real algebraic with $1\ne\alpha\ne0$ the number $\ln \alpha$ is trascendental. Consider the function $f(x)=e^x$ which is a bijection of $\mathbb R$ onto $]0,\infty[$; take now un $r\in$ $\mathbb Q^+ $, for instance $r=7$; there exists x such that $f(x)=7$ but $f(x)=e^x=7\iff x=\ln 7$ hence $x$ is a trascendental number whose image by $f$ is rational.
You have this way infinitely many rational $r$ such that if $x=\ln r$ then $f(x)=r$ where x is irrational (it is trascendental indeed).
A: Several.
f(x) = x - x = 0
f(x) = x / x = 1, for x in R - {0}
f(x) = round(x, 5), where round() rounds a number to the specified quantity of decimal places.
The Dirac delta.
f(x) = 
    1 if x in Q,
    0 if x not in Q

f(x) =The average of the first 10^6 digits of x (in base 10).
And so on...
