public static final double diff(String expression, double val) throws InvalidExpressionException {

        ExpressionTree expTree = parseToTree(expression);

        expTree.derive();
        expTree.reduce();

        return expTree.getVal();
    }
public static final double diff ( String expression , double val ) throws InvalidExpressionException { ExpressionTree expTree = parseToTree ( expression ) ; expTree . derive ( ) ; expTree . reduce ( ) ; return expTree . getVal ( ) ; }
Compute numeric derivative
@param expression the mathematical expression
@param val the value for which to evaluate the expression at
@return numeric derivative