public function testEvaluateWithFunction() { $Eval = new EvalMath(); $Eval->evaluate('f(x,y) = x^2 + y^2 - 2x*y + 1'); $result = $Eval->evaluate('3*f(1,3);'); $this->assertIdentical('15.000', $result); $result = $Eval->funcs(); $this->assertIdentical(array('f(x,y)'), $result); $result = $Eval->evaluate('sin(pi/2)'); $this->assertIdentical('1.000', $result); $result = $Eval->evaluate('log10(1)'); $this->assertIdentical('0.000', $result); $Eval->clear(); $Eval->evaluate('f(x) = sqrt(x)'); $result = $Eval->evaluate('f(4)'); $this->assertIdentical('2.000', $result); $Eval->evaluate('g(x) = sqrt(2x) + ln(e)'); $result = $Eval->evaluate('g(2)'); $this->assertIdentical('3.000', $result); unset($Eval); }