public function evaluate($expression)
    {
        $lexer = $this->getLexer();
        $tokens = $lexer->tokenize($expression);

        $translationStrategy = new \Math\TranslationStrategy\ShuntingYard();

        return $this->evaluateRPN($translationStrategy->translate($tokens));
    }
public function evaluate($expression)
    {
        $lexer = $this->getLexer();
        $tokens = $lexer->tokenize($expression);

        $translationStrategy = new \Math\TranslationStrategy\ShuntingYard();

        return $this->evaluateRPN($translationStrategy->translate($tokens));
    }
public function evaluate ( $ expression ) { $ lexer = $ this -> getLexer ( ) ; $ tokens = $ lexer -> tokenize ( $ expression ) ; $ translationStrategy = new \ Math \ TranslationStrategy \ ShuntingYard ( ) ; return $ this -> evaluateRPN ( $ translationStrategy -> translate ( $ tokens ) ) ; }
Evaluate string representing mathematical expression.

@param string $expression
@return float
Evaluate string representing mathematical expression .