/** * Tell whether or not a Polynomial is constant (degree 0) * * @access public * * @param object $p * @return bool */ function isConstant($p) { if (!is_a($p, 'Math_Polynomial')) { $p = new Math_Polynomial($p); } if ($p->numTerms() == 1) { $term = $p->getTerm(0); if ($term->getExponent() == 0) { return true; } } else { if ($p->numTerms() == 0) { return true; } } return false; }