/** * Store the current numeric mode and evaluate the expression <code>expr</code>. After evaluation reset the numeric * mode to the value stored before the evaluation starts. If evaluation is not possible return the input object. * * @param expr * the object which should be evaluated * @return the evaluated object */ public final IExpr evaluate(final IExpr expr) { boolean numericMode = fNumericMode; try { return evalWithoutNumericReset(expr); } finally { fNumericMode = numericMode; } }
/** * Store the current numeric mode and evaluate the expression <code>expr</code>. After evaluation reset the numeric * mode to the value stored before the evaluation starts. If evaluation is not possible return the input object. * * @param expr * the object which should be evaluated * @return the evaluated object */ public final IExpr evaluateNonNumeric(final IExpr expr) { boolean numericMode = fNumericMode; try { fNumericMode = false; return evalWithoutNumericReset(expr); } finally { fNumericMode = numericMode; } }
/** * * Evaluate an object and reset the numeric mode to the value before the * evaluation step. If evaluation is not possible return the input object. * * @param expr * the object which should be evaluated * @param numericMode * reset the numericMode to this value after evaluation * @return the evaluated object */ public final IExpr evaluate(final IExpr expr) { boolean numericMode = fNumericMode; // StackContext.enter(); try { return evalWithoutNumericReset(expr); // if (fTraceMode) { // fTraceList = StackContext.outerCopy(fTraceList); // } // return StackContext.outerCopy(temp); } finally { fNumericMode = numericMode; // StackContext.exit(); } }
maxCount = evalEngine.evalWithoutNumericReset(lst.get(1)); step = F.C1; variable = symbol; break; case 3: start = evalEngine.evalWithoutNumericReset(lst.get(1)); maxCount = evalEngine.evalWithoutNumericReset(lst.get(2)); step = F.C1; variable = symbol; start = evalEngine.evalWithoutNumericReset(lst.get(1)); maxCount = evalEngine.evalWithoutNumericReset(lst.get(2)); step = evalEngine.evalWithoutNumericReset(lst.get(3)); variable = symbol;
public static IExpr refineAssumptions(final IExpr expr, IAssumptions assumptions, EvalEngine engine) { IAssumptions oldAssumptions = engine.getAssumptions(); try { engine.setAssumptions(assumptions); // System.out.println(expr.toString()); return engine.evalWithoutNumericReset(expr); } finally { engine.setAssumptions(oldAssumptions); } }
/** * <p> * Store the current numeric mode and evaluate the expression <code>expr</code>. After evaluation reset the numeric * mode to the value stored before the evaluation starts. If evaluation is not possible return the input object. * </p> * <p> * <b>Note:</b> if this method catches exception <code>org.matheclipse.parser.client.math.MathException</code>, it * returns the input expression. * </p> * * @param expr * the object which should be evaluated * @return the evaluated object */ public final IExpr evalPattern(@Nonnull final IExpr expr) { boolean numericMode = fNumericMode; try { if (expr.isFreeOfPatterns()) { return evalWithoutNumericReset(expr); } if (expr.isAST()) { return evalHoldPattern((IAST) expr).orElse(expr); } return expr; } catch (MathException ce) { return expr; } finally { fNumericMode = numericMode; } }
maxCount = evalEngine.evalWithoutNumericReset(lst.get(1)); step = F.C1; variable = null; case 3: start = F.C1; maxCount = evalEngine.evalWithoutNumericReset(lst.get(2)); step = F.C1; start = evalEngine.evalWithoutNumericReset(lst.get(2)); maxCount = evalEngine.evalWithoutNumericReset(lst.get(3)); step = F.C1; start = evalEngine.evalWithoutNumericReset(lst.get(2)); maxCount = evalEngine.evalWithoutNumericReset(lst.get(3)); step = evalEngine.evalWithoutNumericReset(lst.get(4));
lowerLimit = evalEngine.evalWithoutNumericReset(originalLowerLimit); maxCounterOrList = evalEngine.evalWithoutNumericReset(originalUpperLimit); step = evalEngine.evalWithoutNumericReset(originalStep);
@Override public IExpr numericEval(final IAST ast, EvalEngine engine) { Validate.checkRange(ast, 2, 3); final boolean numericMode = engine.isNumericMode(); final int oldPrecision = engine.getNumericPrecision(); try { int numericPrecision = Config.MACHINE_PRECISION; if (ast.isAST2()) { IExpr arg2 = engine.evaluateNonNumeric(ast.arg2()); numericPrecision = Validate.checkIntType(arg2); } engine.setNumericMode(true, numericPrecision); return engine.evalWithoutNumericReset(ast.arg1()); } finally { engine.setNumericMode(numericMode); engine.setNumericPrecision(oldPrecision); } }
upperLimit = evalEngine.evalWithoutNumericReset(list.arg1()); step = F.C1; variable = symbol; lowerLimit = evalEngine.evalWithoutNumericReset(list.arg1()); upperLimit = evalEngine.evalWithoutNumericReset(list.arg2()); step = F.C1; variable = symbol; lowerLimit = evalEngine.evalWithoutNumericReset(list.arg1()); upperLimit = evalEngine.evalWithoutNumericReset(list.arg2()); step = evalEngine.evalWithoutNumericReset(list.arg3()); variable = symbol; if (lowerLimit instanceof Num && upperLimit instanceof Num && step instanceof Num) {
upperLimit = evalEngine.evalWithoutNumericReset(list.arg1()); step = F.C1; variable = null; upperLimit = evalEngine.evalWithoutNumericReset(list.arg2()); step = F.C1; lowerLimit = evalEngine.evalWithoutNumericReset(list.arg2()); upperLimit = evalEngine.evalWithoutNumericReset(list.arg3()); step = F.C1; lowerLimit = evalEngine.evalWithoutNumericReset(list.arg2()); upperLimit = evalEngine.evalWithoutNumericReset(list.arg3()); step = evalEngine.evalWithoutNumericReset(list.arg4()); if (list.arg1() instanceof ISymbol) { variable = (ISymbol) list.arg1();