public static IExpr or(IExpr a, Integer i) { return $(Or, a, integer(i.longValue())); }
public static IExpr or(Integer i, IExpr b) { return $(Or, integer(i.longValue()), b); }
/** * Get the "denominator form" of the given function. Example: * <code>Csc[x]</code> gives <code>Sin[x]</code>. * * @param function * the function which should be transformed to "denominator * form" * @return */ public static IAST getDenominatorForm(IAST function) { if (function.size() == 2) { for (int i = 0; i < Denominator.NUMERATOR_SYMBOLS.length; i++) { ISymbol sym = Denominator.NUMERATOR_SYMBOLS[i]; if (function.head().equals(sym)) { return F.$(Denominator.DENOMINATOR_SYMBOLS[i], function.get(1)); } } } return null; }
if (Config.DOMINANT_IMPLICIT_TIMES || oper.getPrecedence() >= min_precedence) { rhs = parseLookaheadOperator(oper.getPrecedence()); lhs = F.$(F.$s(oper.getFunctionName()), lhs, rhs); continue;
if (arg1.size() == 2) { if (header.equals(F.Sin) || header.equals(F.Cos)) { return F.$(header, F.Limit(arg1.get(1), rule));
/** * Search for one of the <code>Derivative[..]</code> rules from the * <code>System.mep</code> file read at startup time. * * Examples for rules from the <code>System.mep</code> file:<br/> * <code>Derivative[Cos]=(-1)*Sin[#]&</code><br/> * <code>Derivative[Sin]=Cos[#]&</code><br/> * <code>Derivative[Tan]=Cos[#]^(-2)&</code><br/> * * @param x * @param arg1 * @param header * @return */ private IExpr getDerivativeArg1(IExpr x, final IExpr arg1, final IExpr header) { IExpr der = F.evalNull(F.Derivative, header); if (der != null) { // we've found a derivative for a function of the form f[x_] IExpr derivative = F.eval(F.$(der, arg1)); return F.Times(derivative, F.D(arg1, x)); } return null; }
@Override public double[] computeDerivatives(double t, double[] xyz) { double[] xyzDot = new double[fDimension]; IExpr[] replacements = new IExpr[fDimension]; IASTAppendable rules = F.ListAlloc(fDimension + 1); for (int i = 0; i < fDimension; i++) { replacements[i] = F.$(fVariables.get(i + 1), fT); rules.append(F.Rule(replacements[i], F.num(xyz[i]))); } rules.append(F.Rule(fT, F.num(t))); IExpr[] dotEquations = new IExpr[fDimension]; for (int i = 0; i < fDimension; i++) { dotEquations[i] = fDotEquations[i].replaceAll(rules); } for (int i = 0; i < fDimension; i++) { xyzDot[i] = ((INum) fEngine.evalN(dotEquations[i])).doubleValue(); } return xyzDot; } }
/** * Parse expressions like <code>expr''[x]</code> * * @param expr * @return */ private IExpr parseDerivative(IExpr expr) { int derivativeCounter = 1; getNextToken(); while (fToken == TT_DERIVATIVE) { derivativeCounter++; getNextToken(); } IAST deriv = F.$(DERIVATIVE, F.integer(derivativeCounter)); expr = F.$(deriv, expr); expr = parseArguments(expr); return expr; }
public IExpr createFunction(final IParserFactory factory, final IExpr argument) { return F.$(F.$s(getFunctionName()), argument); } }
public IExpr createFunction(final IParserFactory factory, final IExpr argument) { return F.$(F.$s(getFunctionName()), argument); } }