MathExpr implements
		Function<Double[], Double>,
		Serializable { public static MathExpr parse(final String expression) { final Tree<? extends Op<Double>, ?> tree = parseTree(expression); Program.check(tree); return new MathExpr(tree, true); } private  MathExpr(final Tree<? extends Op<Double>, ?> tree, boolean primary);  MathExpr(final Tree<? extends Op<Double>, ?> tree); ISeq<Var<Double>> vars(); TreeNode<Op<Double>> toTree(); @Override Double apply(final Double[] args); double eval(final double... args); @Override int hashCode(); @Override boolean equals(final Object obj); @Override String toString(); MathExpr simplify(
		final TreeRewriter<Op<Double>> rewriter,
		final int limit
	); MathExpr simplify(final TreeRewriter<Op<Double>> rewriter); MathExpr simplify(); static String format(final Tree<? extends Op<Double>, ?> tree); static MathExpr parse(final String expression); static TreeNode<Op<Double>> parseTree(final String expression); static double eval(final String expression, final double... args); static double eval(
		final Tree<? extends Op<Double>, ?> expression,
		final double... args
	); static int rewrite(final TreeNode<Op<Double>> tree, final int limit); static int rewrite(final TreeNode<Op<Double>> tree); static final TreeRewriter<Op<Double>> CONST_REWRITER; static final TreeRewriter<Op<Double>> ARITHMETIC_REWRITER; static final TreeRewriter<Op<Double>> REWRITER; }
@Test public void parse() { Assert.assertEquals( MathExpr.eval("3*4"), 12.0 ); Assert.assertEquals( MathExpr.eval("3*4*x", 2), 24.0 ); Assert.assertEquals( MathExpr.eval("3*4*x + y", 2, 4), 28.0 ); }
@Test(expectedExceptions = IllegalArgumentException.class) public void parseError1() { MathExpr.parse("x~y"); }
@Test(expectedExceptions = IllegalArgumentException.class) public void parseError2() { MathExpr.parse("xy**g"); }