>Let P be a polynomial with real coefficients. Suppose there >are nonempty intervals I and J such that P maps surjectively >the rationals of I into the rationals of J. Does this imply >P is an affine mapping?
Consider the set S of polynomials f in R[x] such that, for some nonempty intervals I,J of R, the set Q /\ J is a subset of f(Q /\ I).
As Ken Pledger showed, if f is in S, f must have rational coefficients, that is, f must be an element of Q[x].
It's clear that every element of S have must have degree at least 1.
It's also clear that every element of Q[x] of degree 1 is in S.
Moreover, if A,B in Q[x] are of degree 1, and f is in S, then (A o f o B) is in S.
Claim all elements of S have degree exactly 1.
Suppose otherwise, that is, suppose there exists f in S such that deg(f) = n, where n > 1.
We proceed to transform f by a series of steps, where at each step, a new polynomial is obtained as a composition (sometimes on the left, sometimes on the right) of the previous polynomial with a polynomial in Q[x] of degree 1. Each new polynomial is still in S and the degree of each polynomial is still equal to n. The coefficients get progressively "better" in a sense that will become clear later.
Let c_0 be the constant term of f, and let d be the lcm of the nonzero coefficients of f.
Let g(x) = A o B o f where B(x) = d*x and A(x) = x - d*(c_0)
Then g is in S, still with degree n, but g has integer coefficients and zero constant term.
Next, let p be a prime which does not divide the leading coefficient of g.
Let h(x) = C o g o D where C(x) = (p^n)*x and D(x) = x/p.
Then h is in S, still with degree n, still with integer coefficients, still with zero constant term, but in addition, all coefficients of h are multiples of p, except for the leading coefficient which is not a multiple of p.
Since h is in S, there exist nonempty intervals I,J of R such that the set Q /\ J is a subset of h(Q /\ I).
Now consider the set Y of rational numbers such that the denominator is not a multiple of p, while the numerator is a multiple of p but not a multiple of p^2.
It's easily seen that Y is dense in R, hence Y /\ (Q /\ J) is nonempty.
Let y1 be an element of Y /\ (Q /\ J).
Write y1 = u/v where u,v are integers such that v is not a multiple of p, and u is a multiple of p but not a multiple of p^2.
Since Q /\ J is a subset of h(Q /\ I), there exists x1 in Q /\ I such that h(x1) = y1.
Then the polynomial
k(x) = v*h(x) - u
is a polynomial of degree n with integer coefficients and rational root x1.
Since k has a rational root and deg(k) > 1, k is reducible in Q[x].
Since k has integer coefficients, k is also reducible in Z[x].
But k satisfies Eisenstein's criterion hence k is irreducible in Z[x], contradiction.