// Discriminant returns the discriminant of this polynomial. func Discriminant(p *poly.IntPolynomial) *mathx.Int { if p.Degree() == 2 { c, b, a := p.Coeff(0), p.Coeff(1), p.Coeff(2) ac4 := mathx.NewInt(4).Mul(a).Mul(c) return b.Mul(b).Sub(ac4) } return nil }