Non-polynomial integrals of motion for polynomial dynamical systems Does there exist a polynomial Hamiltonian function $H$ on some $\mathbb{R}^{2n}$ such that 


*

*Any polynomial function $P$ such that $\{P,H\}=0$ is of the form $p(H)$ for some polynomial $p$ in one variable;

*There exists a smooth function $F$ such that $\{F,H\}=0$, and yet $F$ is not of the form $f(H)$ for any smooth function $f$ in one variable?


I am looking for an example of such a phenomenon, or a proof that it cannot occur. A non-Hamiltonian example -- that is, of a polynomial vector field such that the smooth completion of the algebra of its polynomial integrals is strictly smaller than the algebra of its smooth integrals -- would also be helpful. Any references to the literature will be much appreciated, of course.
Thanks in advance!
 A: Here is a tentative Hamiltonian answer having  2 degrees of freedom. 
Take $H = (1/2)(1 + a x^2 + bxy + cy^2) (p_x ^2 + p_y ^2)$.
for  essentially  any  parameters $a, b, c$ for which
$ax^2 + bxy + cy^2$ is positive definite ($a x^2 + bxy + c y^2) > \epsilon (x^2 + y^2)$)
but  NOT a multiple of $x^2 + y^2$.   This $H$ is the Hamiltonian for geodesic flow
on the plane with metric $ds^2 = (dx^2 + dy^2)/((1 + a x^2 + bxy + cy^2)$.
Comparing the arclength $ds$ with $dr/\sqrt{1 + \epsilon r^2}$
seems to show that  the metric is complete.  Now we can play the 
 scattering integrability' trick
which I learned from E. Gutkin.  This trick yields
2 new integrals $F, G$ as thescattering data'' for the
resulting geodesics.    What I  mean  is that any
  geodesic will be asymptotic to a
straight line in the xy plane, and the asymptotic direction $(F, G)$  of this
line is an integral.  The hard part is to show this asymptotic direction,   is a smooth function of $x, y, p_x, p_y$.  I wager
that unless $a x^2 + bxy + cy^2$ is a square (like $x^2$)
or a multiple of $x^2 + y^2$, these scattering integrals are not polynomials.
They might not even be analytic..
A: There are such examples (with transcendental integrals of motion) already on $\mathbb{R}^{4}$, see the paper of Hietarinta. 
The Hamiltonian is
$$H=p_x^2/2+p_y^2/2+2y p_x p_y-x,$$
the desired integral is
$$I_1=p_y \exp(p_x^2).$$
