  In this paper we study the representation of Morse polynomial functions which
are nonnegative on a compact basic closed semi-algebraic set in $\mathbb R^n$,
and having only finitely many zeros in this set. Following C. Bivi\`{a}-Ausina,
we introduce two classes of non-degenerate polynomials for which the algebraic
sets defined by them are compact. As a consequence, we study the representation
of nonnegative Morse polynomials on these kinds of non-degenerate algebraic
sets. Moreover, we apply these results to study the polynomial optimization
problem for Morse polynomial functions.

Algebraic Geometry