  Polynomial processes are defined by the property that conditional
expectations of polynomial functions of the process are again polynomials of
the same or lower degree. Many fundamental stochastic processes, including
affine processes, are polynomial, and their tractable structure makes them
important in applications. In this paper we study polynomial diffusions whose
state space is a compact quadric set. Necessary and sufficient conditions for
existence, uniqueness, and boundary attainment are given. The existence of a
convenient parameterization of the generator is shown to be closely related to
the classical problem of expressing nonnegative polynomials---specifically,
biquadratic forms vanishing on the diagonal---as a sum of squares. We prove
that in dimension $d\le 4$ every such biquadratic form is a sum of squares,
while for $d\ge6$ there are counterexamples. The case $d=5$ remains open. An
equivalent probabilistic description of the sum of squares property is
provided, and we show how it can be used to obtain results on pathwise
uniqueness and existence of smooth densities.
