/** * Parse the given <code>expression String</code> into an IExpr without evaluation. * * @param expression * an expression in math formula notation * * @return * @throws org.matheclipse.parser.client.SyntaxError * if a parsing error occurs */ final public IExpr parse(String expression) { return parse(expression, Config.EXPLICIT_TIMES_OPERATOR); // final ExprParser parser = new ExprParser(this, fRelaxedSyntax); // return parser.parse(expression); }
public IExpr parseExpression(String expr) { return myEvalEngine.parse(expr); }
/** * Parse the given <code>expression String</code> into an IExpr and evaluate it. * * @param expression * an expression in math formula notation * @return * @throws org.matheclipse.parser.client.SyntaxError * if a parsing error occurs */ final public IExpr evaluate(String expression) { return evaluate(parse(expression)); }
/** * Parse the given <code>expression String</code> into an IExpr and evaluate it. * * @param expression * an expression in math formula notation * @param explicitTimes * if <code>true</code> require times operator "*" * @return * @throws org.matheclipse.parser.client.SyntaxError * if a parsing error occurs */ final public IExpr evaluate(String expression, boolean explicitTimes) { return evaluate(parse(expression, explicitTimes)); }
/** * Parse the given <code>expression String</code> into an IExpr and evaluate * it. * * @param astString * an expression in math formula notation * @return * @throws org.matheclipse.parser.client.SyntaxError * if a parsing error occurs */ final public IExpr evaluate(String expression) { return evaluate(parse(expression)); }
/** * Parse the given <code>expression String</code> without evaluation * * @param inputExpression * @return * @throws SyntaxError */ public IExpr parse(final String inputExpression) { // try { if (inputExpression != null) { EvalEngine.set(engine); engine.reset(); return engine.parse(inputExpression); } // } finally { // EvalEngine.remove(); // } return null; }
public IExpr evalMathText(final String inTextExpr) throws Exception { IExpr parsedExpression = null; if (inTextExpr != null) { evalEngineAttach(); myEvalEngine.reset(); parsedExpression = myEvalEngine.parse(inTextExpr); return evalParsedExpr(parsedExpression, false, true); } return null; }
key = engine.parse(astString); astString = stream.readUTF(); value = engine.parse(astString); fEqualRules.put(key, new Pair<ISymbol, IExpr>(setSymbol, value)); lhs = engine.parse(astString); astString = stream.readUTF(); rhs = engine.parse(astString); pmEvaluator = new PatternMatcherAndEvaluator(setSymbol, lhs, rhs); } else { astString = stream.readUTF(); condition = engine.parse(astString); pmEvaluator.setCondition(condition); lhs = engine.parse(astString); astString = stream.readUTF(); rhs = engine.parse(astString); pmEvaluator = new PatternMatcherAndEvaluator(setSymbol, lhs, rhs); } else { astString = stream.readUTF(); condition = engine.parse(astString); pmEvaluator.setCondition(condition);
/** * Parse the given <code>expression String</code> and evaluate it to an IExpr value * * @param inputExpression * @return * @throws SyntaxError */ public IExpr eval(final String inputExpression) { if (inputExpression != null) { EvalEngine.set(engine); engine.reset(); fExpr = engine.parse(inputExpression); if (fExpr != null) { return eval(fExpr); } // call EvalEngine.remove() at the end of the thread if necessary } return null; }
/** * Runs the evaluation of the given math formula <code>String</code> in a time * limited thread * * @param traceEvaluation * */ public IExpr constrainedEval(final Writer writer, final String inputString, boolean traceEvaluation) throws Exception { fEvaluationResult = null; fException = null; fParsedExpression = null; fEvalEngine.setStopRequested(false); fTraceEvaluation = traceEvaluation; try { EvalEngine.set(fEvalEngine); fParsedExpression = fEvalEngine.parse(inputString); } catch (final RuntimeException e) { throw e; } return constrainedEval(writer, fParsedExpression); }
/** * Runs the evaluation of the given math formula <code>String</code> in a time * limited thread * * @param traceEvaluation * */ public IExpr constrainedEval(final Writer writer, final String inputString, boolean traceEvaluation) throws Exception { fEvaluationResult = F.NIL; fException = null; fParsedExpression = null; fEvalEngine.setStopRequested(false); fTraceEvaluation = traceEvaluation; try { EvalEngine.set(fEvalEngine); fParsedExpression = fEvalEngine.parse(inputString); } catch (final RuntimeException e) { throw e; } return constrainedEval(writer, fParsedExpression); }
IExpr parsedExpression = engine.parse(builder.toString()); if (parsedExpression != null && parsedExpression.isAST()) { IAST ast = (IAST) parsedExpression;
/** * Evaluate the <code>inputExpression</code> and return the resulting * expression. * * @param inputExpression * the expression which should be evaluated. * @return */ public IExpr evaluate(final String inputExpression) throws Exception { IExpr parsedExpression = null; if (inputExpression != null) { startRequest(); fEvalEngine.reset(); parsedExpression = fEvalEngine.parse(inputExpression); if (parsedExpression != null) { fEvalEngine.reset(); IExpr temp = fEvalEngine.evaluate(parsedExpression); fEvalEngine.addOut(temp); return temp; } } return null; }
try { engine.reset(); fExpr = engine.parse(inputExpression); if (fExpr != null) { final ExecutorService executor = Executors.newSingleThreadExecutor();
} else { value = ENGINE.parse(key); if (value.isTimes()) { IAST times = (IAST) value;
parsedExpression = fEvalEngine.parse(inputExpression); if (parsedExpression != null) { fEvalEngine.reset();
IExpr parsedExpression = fEvalEngine.parse(inputExpression); if (parsedExpression != null) {
/** * Parse the given <code>inputExpression</code> String and evaluate it to a <code>double</code> value if possible. * * @param inputExpression * an input expression * @return <code>Double.NaN</code> if no <code>double</code> value could be evaluated * @throws SyntaxError */ public double evalf(final String inputExpression) { if (inputExpression != null) { EvalEngine.set(engine); engine.reset(); fExpr = engine.parse(inputExpression); if (fExpr != null) { IExpr temp = eval(F.N(fExpr)); if (temp.isReal()) { return ((ISignedNumber) temp).doubleValue(); } } } return Double.NaN; }
/** * Evaluate the <code>inputExpression</code> and return the resulting * expression. * * @param inputExpression * the expression which should be evaluated. * @return <code>F.NIL</code>, if the inputExpression is <code>null</code> * */ public IExpr evaluate(final String inputExpression) throws MathException { if (inputExpression != null) { startRequest(); EvalEngine.set(fEvalEngine);; fEvalEngine.reset(); IExpr parsedExpression = fEvalEngine.parse(inputExpression); if (parsedExpression != null) { // F.join(); fEvalEngine.reset(); IExpr temp = fEvalEngine.evaluate(parsedExpression); fEvalEngine.addOut(temp); return temp; } } return F.NIL; }