> SignCoeff:=proc(T)
> d:=degree(T,n);
> S:={};
> for k from 1 to d do S:=S union {sign(coeff(T,n,k))} od;
> S;
> end proc;
>
# Warning, `d` is implicitly declared local to procedure `SignCoeff`
# Warning, `S` is implicitly declared local to procedure `SignCoeff`
# Warning, `k` is implicitly declared local to procedure `SignCoeff`
proc(T)
local d, S, k;
d := degree(T, n);
S := {};
for k to d do S := union(S, {sign(coeff(T, n, k))}) end do;
S;
end proc;
> SignCoeff(P0);
{-1}
> SignCoeff(P1);
{-1}
> SignCoeff(P2);
{-1}
> SignCoeff(P3);
{1}