/** * Evaluate the given expression in numeric mode * * @param a0 * @return */ public static IExpr evaln(final IExpr a0) { return eval(N, a0); }
public IExpr evaluate(final IAST ast) { Validate.checkSize(ast, 3); if (F.evalTrue(ast.get(2))) { return F.eval(ast.get(1)); } throw new ConditionException(ast); }
public static boolean equals(java.math.BigInteger i, IExpr b) { IExpr tempA = integer(i); IExpr tempB = b; if (b instanceof AST) { tempB = eval(b); } return tempA.equals(tempB); }
public static boolean equals(Integer i, IExpr b) { IExpr tempA = integer(i.longValue()); IExpr tempB = b; if (b instanceof AST) { tempB = eval(b); } return tempA.equals(tempB); }
/** * First derivative of unary function */ public UnivariateFunction derivative() { IExpr expr = F.eval(F.D, fFunction, fVariable); return new UnaryNumerical(expr, fVariable, fEngine); }
/** * {@inheritDoc} */ @Override public void increment(final IExpr d) { value = F.eval(F.Plus(value, d)); n++; }
public static boolean equals(IExpr a, Integer i) { IExpr tempA = a; IExpr tempB = integer(i.longValue()); if (a instanceof AST) { tempA = eval(a); } return tempA.equals(tempB); }
public static boolean equals(IExpr a, java.math.BigInteger i) { IExpr tempA = a; IExpr tempB = integer(i); if (a.isAST()) { tempA = eval(a); } return tempA.equals(tempB); }
public static int compareTo(Integer i, IExpr b) throws UnsupportedOperationException { if (b instanceof ISignedNumber) { return integer(i.longValue()).compareTo(b); } IExpr temp = eval(b); if (temp instanceof ISignedNumber) { return integer(i.longValue()).compareTo(temp); } throw new UnsupportedOperationException("compareTo() - second argument could not be converted into a signed number."); }
public IExpr evaluate(final IAST ast) { Validate.checkSize(ast, 2); try { return F.eval(ast.get(1)); } catch (final ThrowException e) { return e.getValue(); } }
public IExpr opposite() { if (this.isNumber()) { return F.eval(F.Times(F.CN1, this)); } return F.Times(F.CN1, this); }
public IExpr inverse() { if (this.isNumber()) { return F.eval(F.Power(this, F.CN1)); } return F.Power(this, F.CN1); }
public IExpr times(final IExpr that) { if (this.isNumber() && that.isNumber()) { return F.eval(F.Times(this, that)); } return F.Times(this, that); }
public final IExpr power(final IExpr that) { if (this.isNumber() && that.isNumber()) { return F.eval(F.Power(this, that)); } return F.Power(this, that); }
public IExpr plus(final IExpr that) { if (this.isNumber() && that.isNumber()) { return F.eval(F.Plus(this, that)); } return F.Plus(this, that); }
public final IExpr power(final Integer n) { if (this.isNumber()) { return F.eval(F.Power(this, F.integer(n))); } return F.Power(this, F.integer(n)); }
/** * {@inheritDoc} */ @Override public IExpr getResult() { if (product.getN() > 0) { return F.eval(F.Exp(F.Divide(product.getResult(), F.integer(product.getN())))); // FastMath.exp(sumOfLogs.getResult() / sumOfLogs.getN()); } else { return null; } }
public static IExpr evaluateNestList(final IAST ast, final IAST resultList) { IExpr arg3 = F.eval(ast.get(3)); if (arg3.isInteger()) { final int n = Validate.checkIntType(arg3); nestList(ast.get(2), n, Functors.append(F.ast(ast.get(1))), resultList); return resultList; } return null; }
public IExpr minus(final IExpr that) { if (this.isNumber() && that.isNumber()) { return F.eval(F.Plus(this, ((INumber) that).opposite())); } if (that.isNumber()) { return F.Plus(this, ((INumber) that).opposite()); } return F.Plus(this, F.Times(F.CN1, that)); }