Define the term “closer to” for polynomials in the intuitive way: $B(z)$ is closer to $A(z)$ then $C(z)$ if the degree of $\lvert A(z) \pm B(z) \rvert$ is smaller than the degree of $\lvert A(z) \pm C(z) \rvert$, or the coefficients are smaller in the case the degrees are equal.
Now let's say I have an arbitrary polynomial, e.g. $$ A(z) := 4z^4-28z^3+60z^2-43z+8. $$ Is there an algorithm to determine the closest square [or triangular or cubic, etc.] polynomial to $A(z)$? For example, $$ 4z^4-28z^3+60z^2-43z+8 = (2z^2-7z+3)^2-(z^2+z+1), $$ and so $(2z^2-7z+3)^2$ is the closest polynomial square to $A(z)$. But I know this only because I constructed the example in the first place!
EDIT: Here's a new concrete example. I'm trying to show that $$3x^4+3x^2+1$$ can never be a square. So how can I calculate the nearest square above and below?