Search in sources :

Example 71 with IAST

use of org.matheclipse.core.interfaces.IAST in project symja_android_library by axkr.

the class AbstractTestCase method check.

public void check(EvalEngine engine, boolean configMode, IAST ast, String strResult) {
    boolean mode = Config.SERVER_MODE;
    try {
        StringWriter buf = new StringWriter();
        Config.SERVER_MODE = configMode;
        if (Config.SERVER_MODE) {
            IAST inExpr = ast;
            TimeConstrainedEvaluator utility = new TimeConstrainedEvaluator(engine, false, Config.FOREVER);
            utility.constrainedEval(buf, inExpr);
        } else {
            if (ast != null) {
                OutputFormFactory off = OutputFormFactory.get();
                off.setIgnoreNewLine(true);
                off.convert(buf, ast);
            }
        }
        assertEquals(strResult, buf.toString());
    } catch (Exception e) {
        e.printStackTrace();
        assertEquals("", e);
    } finally {
        Config.SERVER_MODE = mode;
    }
}
Also used : TimeConstrainedEvaluator(org.matheclipse.core.eval.TimeConstrainedEvaluator) StringWriter(java.io.StringWriter) IAST(org.matheclipse.core.interfaces.IAST) OutputFormFactory(org.matheclipse.core.form.output.OutputFormFactory)

Example 72 with IAST

use of org.matheclipse.core.interfaces.IAST in project symja_android_library by axkr.

the class PatternsTest method testPriority002.

public void testPriority002() {
    IAST ast1 = ast(f);
    ast1.append(Times(a, x));
    IAST ast2 = ast(f);
    ast2.append(Times(a_, x_));
    PatternMatcher pm1 = new PatternMatcher(ast1);
    PatternMatcher pm2 = new PatternMatcher(ast2);
    int cpr = pm1.compareTo(pm2);
    assertEquals(cpr, -1);
}
Also used : IAST(org.matheclipse.core.interfaces.IAST) PatternMatcher(org.matheclipse.core.patternmatching.PatternMatcher)

Example 73 with IAST

use of org.matheclipse.core.interfaces.IAST in project symja_android_library by axkr.

the class RubiIntegrationTest method testRubi003.

public void testRubi003() {
    IAST ast;
    ast = MemberQ(List($s("Sin"), $s("Cos"), $s("Tan"), $s("Cot"), $s("Sec"), $s("Csc")), If(AtomQ(Sin(Times(C2, x))), Sin(Times(C2, x)), Head(Sin(Times(C2, x)))));
    check(ast, "True");
    ast = UnsameQ(Coefficient(Times(2, x), x, C1), C0);
    check(ast, "True");
    ast = Exponent(Times(2, x), x);
    check(ast, "1");
    ast = PolyQ(Times(2, x), x, C1);
    check(ast, "True");
    ast = LinearQ(Times(2, x), x);
    check(ast, "True");
    ast = FunctionOfTrig(Sin(Times(2, x)), Null, x);
    check(ast, "2*x");
    ast = FunctionOfTrigOfLinearQ(Sin(Times(2, x)), x);
    check(ast, "True");
    ast = MatchQ(Times(2, x), Condition(Plus(a_DEFAULT, Times(b_DEFAULT, x)), FreeQ(List(a, b), x)));
    check(ast, "True");
}
Also used : IAST(org.matheclipse.core.interfaces.IAST)

Example 74 with IAST

use of org.matheclipse.core.interfaces.IAST in project symja_android_library by axkr.

the class RubiIntegrationTest method testRubi008.

public void testRubi008() {
    IAST ast;
    ast = RealNumericQ(C1);
    check(ast, "True");
}
Also used : IAST(org.matheclipse.core.interfaces.IAST)

Example 75 with IAST

use of org.matheclipse.core.interfaces.IAST in project symja_android_library by axkr.

the class RubiIntegrationTest method testRubi012.

public void testRubi012() {
    IAST ast;
    // 2*(a+b*x),x
    ast = ExpandToSum(Times(C2, Plus(a, Times(b, x))), x);
    // throws AbortException
    check(ast, "2*a+2*b*x");
}
Also used : IAST(org.matheclipse.core.interfaces.IAST)

Aggregations

IAST (org.matheclipse.core.interfaces.IAST)413 IExpr (org.matheclipse.core.interfaces.IExpr)248 ISymbol (org.matheclipse.core.interfaces.ISymbol)76 IInteger (org.matheclipse.core.interfaces.IInteger)34 WrongArgumentType (org.matheclipse.core.eval.exception.WrongArgumentType)30 ISignedNumber (org.matheclipse.core.interfaces.ISignedNumber)22 ExpVector (edu.jas.poly.ExpVector)15 ArrayList (java.util.ArrayList)14 BigRational (edu.jas.arith.BigRational)13 JASIExpr (org.matheclipse.core.convert.JASIExpr)13 VariablesSet (org.matheclipse.core.convert.VariablesSet)13 INum (org.matheclipse.core.interfaces.INum)13 ExprPolynomial (org.matheclipse.core.polynomials.ExprPolynomial)12 GenPolynomial (edu.jas.poly.GenPolynomial)11 JASConversionException (org.matheclipse.core.eval.exception.JASConversionException)11 IFraction (org.matheclipse.core.interfaces.IFraction)11 INumber (org.matheclipse.core.interfaces.INumber)11 IComplex (org.matheclipse.core.interfaces.IComplex)10 ModLong (edu.jas.arith.ModLong)9 ExprPolynomialRing (org.matheclipse.core.polynomials.ExprPolynomialRing)9