Inspired by [An algebraic Hamiltonian vector field with a finite number of periodic orbits (2)](https://mathoverflow.net/questions/210996/an-algebraic-hamiltonian-vector-field-with-a-finite-number-of-periodic-orbits-2) we ask if there is a 1 dimensional analytic foliation of $\mathbb{R}^4$ which has at least 1 compact leaf and the number of compact leaves of the foliation is finite?


**Note:** If there is no an analytic example what about a smooth example?



A 1 dimensional foliation of $\mathbb{R}^4$ with few compact leaves
Yes, there is. Conceptually, imagine a flow on $\mathbb{R}^3$ with a single closed orbit on the unit circle in the plane $z=0$, while every other trajectory has an increasing z-coordinate. It's then easy to embed that flow in $\mathbb{R}^4$ to get the foliation you want.


More precisely, consider the vector field $$f(x\_1, x\_2, x\_3, x\_4) = (-x\_2, x\_1, (1 - x\_1^2 - x\_2^2)^2 + x\_3^2, x\_4)$$


It has no zeros, because if the third coordinate is zero, then at least one of the first two coordinates is nonzero. So the flow given by $x'= f(x)$ defines a 1D foliation of $\mathbb{R}^4$.


And it has exactly one closed orbit (i.e. compact leaf), the circle of the form $(a, b, 0, 0)$ where $a^2 + b^2 = 1$. To see this, note that the 4th coordinate has to be zero in a closed orbit, and that the quantity $x\_1^2 + x\_2^2$ is constant on flow trajectories.


