use of org.matheclipse.parser.client.Parser in project symja_android_library by axkr.
the class PatternMatchingTestCase method setUp.
// public void testSlotPatternMatching() {
// checkPattern("b_.* #+c_.*#^2", "#-1*#^2", "");
// checkPattern("b_.* #+c_.*#^2", "#+#^2", "[1, 1]");
// checkPattern("a_. + b_.* #+c_.*#^2", "-1+#+#^2", "[-1, 1, 1]");
// }
/**
* The JUnit setup method
*/
protected void setUp() {
try {
// setup the evaluation engine (and bind to current thread)
// F.initSymbols();
// EvalEngine.get();
EvalEngine engine = new EvalEngine();
EvalEngine.set(engine);
engine.setSessionID("SpecialTestCase");
engine.setRecursionLimit(256);
engine.setIterationLimit(1024 * 1024);
util = new EvalUtilities(engine, false, false);
// setup a parser for the math expressions
fParser = new Parser();
} catch (Exception e) {
e.printStackTrace();
}
}
use of org.matheclipse.parser.client.Parser in project symja_android_library by axkr.
the class ParserTestCase method testParser14.
public void testParser14() {
try {
Parser p = new Parser();
ASTNode obj = p.parse("-a-b*c!!+d");
assertEquals(obj.dependsOn("d"), true);
assertEquals(obj.dependsOn("x"), false);
} catch (Exception e) {
e.printStackTrace();
assertEquals("", e.getMessage());
}
}
use of org.matheclipse.parser.client.Parser in project symja_android_library by axkr.
the class ParserTestCase method testParser20.
public void testParser20() {
try {
Parser p = new Parser();
ASTNode obj = p.parse("B[[;;, 2]]");
assertEquals(obj.toString(), "Part(B, Span(1, All), 2)");
} catch (Exception e) {
e.printStackTrace();
assertEquals("", e.getMessage());
}
}
use of org.matheclipse.parser.client.Parser in project symja_android_library by axkr.
the class ParserTestCase method testParser24.
public void testParser24() {
try {
Parser p = new Parser();
ASTNode obj = p.parse("x'[t] == 10*(y[t] - x[t])");
assertEquals(obj.toString(), "Equal(Derivative(1)[x][t], Times(10, Plus(y(t), Times(-1, x(t)))))");
} catch (Exception e) {
e.printStackTrace();
assertEquals("", e.getMessage());
}
}
use of org.matheclipse.parser.client.Parser in project symja_android_library by axkr.
the class ParserTestCase method testParser12.
public void testParser12() {
try {
Parser p = new Parser();
ASTNode obj = p.parse("-(Pi/4)");
assertEquals(obj.toString(), "Times(-1, Times(1/4, Pi))");
} catch (Exception e) {
e.printStackTrace();
assertEquals("", e.getMessage());
}
}
Aggregations