/** * Test if a Math_Polynomial object is an odd function (i.e.: f(-x) == -f(x) for all x) * * @see Math_PolynomialOp::isEven() * * @access public * * @param mixed $p * @param integer $num_test_points * @return bool */ function isOdd($p, $num_test_points = 10) { // f(-x) == -f(x) symmetry about origin/x=y $func = Math_PolynomialOp::createFunction($p); for ($i = 0; $i < $num_test_points; $i++) { $x = rand(); if ($func(-1 * $x) != -1 * $func($x)) { return false; } } return true; }