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
Config.PARSER_USE_LOWERCASE_SYMBOLS = true;
EvalUtilities util = new EvalUtilities(false, true);
IAST function = Sinc(Times(CI, CInfinity));
IExpr result = PatternMatcher.evalLeftHandSide(function);
assertEquals(result.internalFormString(true, -1), "Sinc(DirectedInfinity(CI))");
result = util.evaluate(function);
assertEquals(result.internalFormString(true, -1), "oo");
}
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
Config.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 testTensorDimensions001.
public void testTensorDimensions001() {
// don't distinguish between lower- and uppercase identifiers
ParserConfig.PARSER_USE_LOWERCASE_SYMBOLS = true;
EvalUtilities util = new EvalUtilities(false, true);
// Element(M, Matrices({3, 3}, Reals))
// define "m" with "m" assumed to be a 3x3 matrix
// use #1 (Slot1) as placeholder for a new symbol!
ISymbol t = F.symbol("m", F.Element(F.Slot1, F.Matrices(F.List(3, 3), S.Reals)));
IAST function = F.TensorDimensions(t);
IExpr result = util.evaluate(function);
assertEquals(result.toString(), "{3,3}");
}
use of org.matheclipse.core.eval.EvalUtilities in project symja_android_library by axkr.
the class AssumptionTestCase method testFloor001.
public void testFloor001() {
// 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 to be an element of the integers
// use #1 (Slot1) as placeholder for a new symbol!
ISymbol t = F.symbol("t", F.Element(F.Slot1, F.Integers));
IAST function = F.Floor(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 testJavaForm002_fullyQualifiedName.
public void testJavaForm002_fullyQualifiedName() {
// 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("org.matheclipse.core.expression.F.Sinc(org.matheclipse.core.expression.F.DirectedInfinity(org.matheclipse.core.expression.F.CI))", result.internalJavaString(SYMBOL_FACTORY_PROPERTIES_FULL_NAMES, -1, x -> null).toString());
result = util.evaluate(function);
assertEquals("org.matheclipse.core.expression.F.oo", result.internalJavaString(SYMBOL_FACTORY_PROPERTIES_FULL_NAMES, -1, x -> null).toString());
}
Aggregations