use of org.matheclipse.core.eval.EvalUtilities 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.core.eval.EvalUtilities in project symja_android_library by axkr.
the class AssumptionTestCase method testGreaterZeroOrInteger001.
public void testGreaterZeroOrInteger001() {
// don't distinguish between lower- and uppercase identifiers
ParserConfig.PARSER_USE_LOWERCASE_SYMBOLS = true;
EvalUtilities util = new EvalUtilities(false, true);
util.getEvalEngine().setAssumptions(new XGreaterZeroOrYInteger());
IAST function = Abs(x);
IExpr result = util.evaluate(function);
assertEquals(result.toString(), "x");
function = Abs(y);
result = util.evaluate(function);
assertEquals(result.toString(), "Abs(y)");
function = Floor(x);
result = util.evaluate(function);
assertEquals(result.toString(), "Floor(x)");
function = Floor(y);
result = util.evaluate(function);
assertEquals(result.toString(), "y");
}
use of org.matheclipse.core.eval.EvalUtilities in project symja_android_library by axkr.
the class AssumptionTestCase method testSqrt001.
public void testSqrt001() {
// don't distinguish between lower- and uppercase identifiers
ParserConfig.PARSER_USE_LOWERCASE_SYMBOLS = true;
EvalUtilities util = new EvalUtilities(false, true);
// define "t" with "t" assumed greater than 0
// use #1 (Slot1) as placeholder for a new symbol!
ISymbol t = F.symbol("t", F.Greater(F.Slot1, F.C10));
// (t^2) ^ (1/2)
IAST function = F.Sqrt(F.Sqr(t));
IExpr result = util.evaluate(function);
assertEquals(result.toString(), "t");
}
use of org.matheclipse.core.eval.EvalUtilities in project symja_android_library by axkr.
the class JavaFormTestCase method testJavaForm001.
public void testJavaForm001() {
// don't distinguish between lower- and uppercase identifiers
ParserConfig.PARSER_USE_LOWERCASE_SYMBOLS = true;
EvalUtilities util = new EvalUtilities(false, true);
IAST function = Sinc(Times(CI, CInfinity));
IExpr result = EvalEngine.get().evalHoldPattern(function);
assertEquals("Sinc(DirectedInfinity(CI))", result.internalFormString(true, -1).toString());
result = util.evaluate(function);
assertEquals("oo", result.internalFormString(true, -1).toString());
}
use of org.matheclipse.core.eval.EvalUtilities 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
*/
@Override
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();
}
}
Aggregations