The discriminant command computes the discriminant of a polynomial A in the variable X. An optional third argument P specifies the modulus.
f = x^2 + 2*x + 1; discriminant(f,x); 0