/** * Evaluate GreaterEqual, if both arguments are real numbers * * @param a1 * @return */ default IExpr greaterEqual(final IExpr a1) { if (isReal() && a1.isReal()) { return ((ISignedNumber) this).isLessThan(((ISignedNumber) a1)) ? F.False : F.True; } EvalEngine engine = EvalEngine.get(); return engine.evaluate(F.GreaterEqual(this, a1)); }
private IAST createComparator(IAST matrix, int i, int j, int size) { if (i == 1) { // # < matrix[i+2, 1] return F.Less(F.Slot1, matrix.getPart(i + 2, 1)); } else { if (j < size) { // matrix[i+1, 1] <= # < matrix[i+2, 1] return F.And(F.LessEqual(matrix.getPart(i + 1, 1), F.Slot1), F.Less(F.Slot1, matrix.getPart(i + 2, 1))); } else { // # >= matrix[i+1, 1] return F.GreaterEqual(F.Slot1, matrix.getPart(i + 1, 1)); } } }
@Override public IExpr cdf(IAST dist, IExpr k) { if (dist.isAST1()) { IExpr p = dist.arg1(); // IExpr function = // [$ Piecewise({{GammaRegularized(1 + Floor(#), p), # >= 0}}, 0) & $] F.Function(F.Piecewise(F.List(F.List(F.GammaRegularized(F.Plus(F.C1, F.Floor(F.Slot1)), p), F.GreaterEqual(F.Slot1, F.C0))), F.C0)); // $$; return callFunction(function, k); } return F.NIL; }
@Override public IExpr pdf(IAST dist, IExpr k) { if (dist.isAST1()) { IExpr n = dist.arg1(); // IExpr function = // [$ Piecewise({{n/E^(#*n), # >= 0}}, 0) & $] F.Function(F.Piecewise(F.List(F.List(F.Times(F.Power(F.Exp(F.Times(F.Slot1, n)), -1), n), F.GreaterEqual(F.Slot1, F.C0))), F.C0)); // $$; return callFunction(function, k); } return F.NIL; }
@Override public IExpr pdf(IAST dist, IExpr k) { if (dist.isAST1()) { IExpr n = dist.arg1(); // IExpr function = // [$ (Piecewise({{(1 - n)^#*n, # >= 0}}, 0)) & $] F.Function(F.Piecewise(F.List(F.List(F.Times(F.Power(F.Plus(F.C1, F.Negate(n)), F.Slot1), n), F.GreaterEqual(F.Slot1, F.C0))), F.C0)); // $$; return callFunction(function, k); } return F.NIL; }
@Override public IExpr cdf(IAST dist, IExpr k) { if (dist.isAST1()) { IExpr n = dist.arg1(); IExpr function = // [$ (Piecewise({{1 - E^((-#)*n), # >= 0}}, 0)) & $] F.Function(F.Piecewise(F.List(F.List(F.Plus(F.C1, F.Negate(F.Exp(F.Times(F.CN1, F.Slot1, n)))), F.GreaterEqual(F.Slot1, F.C0))), F.C0)); // $$; return callFunction(function, k); // Piecewise({{1 - E^((-k)*n), k >= 0}}, 0) // return F.Piecewise(F.List( // F.List(F.Plus(F.C1, F.Negate(F.Power(F.E, F.Times(F.CN1, k, n)))), F.GreaterEqual(k, F.C0))), // F.C0); } return F.NIL; }
@Override public IExpr pdf(IAST dist, IExpr k) { if (dist.isAST1()) { IExpr p = dist.arg1(); // IExpr function = // [$ Piecewise({{p^#/(E ^ p * #!), # >= 0}}, 0) & $] F.Function(F.Piecewise(F.List(F.List( F.Times(F.Power(p, F.Slot1), F.Power(F.Times(F.Exp(p), F.Factorial(F.Slot1)), -1)), F.GreaterEqual(F.Slot1, F.C0))), F.C0)); // $$; return callFunction(function, k); } return F.NIL; }
@Override public IExpr cdf(IAST dist, IExpr k) { if (dist.isAST1()) { IExpr n = dist.arg1(); IExpr function = // [$ (Piecewise({{1 - (1 - n)^(1 + Floor(#)), # >= 0}}, 0)) & $] F.Function( F.Piecewise(F.List(F.List( F.Plus(F.C1, F.Negate(F.Power(F.Plus(F.C1, F.Negate(n)), F.Plus(F.C1, F.Floor(F.Slot1))))), F.GreaterEqual(F.Slot1, F.C0))), F.C0)); // $$; return callFunction(function, k); } return F.NIL; }
IASTAppendable rules = F.ListAlloc(2); IASTAppendable plus = F.PlusAlloc(coefficientMap.size()); IAST comparator = F.GreaterEqual(n, F.C0); for (Map.Entry<IExpr, IExpr> entry : coefficientMap.entrySet()) { IExpr exp = entry.getKey(); comparator = F.GreaterEqual(n, F.C0); } else { comparator = F.LessEqual(F.C0, n, exp);
@Override public IExpr cdf(IAST dist, IExpr k) { IExpr[] minMax = minmax(dist); if (minMax != null) { IExpr a = minMax[0]; IExpr b = minMax[1]; IExpr function = // [$ (Piecewise({{(1 - a + Floor(#))/(1 - a + b), a<=#<b}, {1, # >= b}}, 0)) & $] F.Function(F.Piecewise(F.List( F.List(F.Times(F.Power(F.Plus(F.C1, F.Negate(a), b), -1), F.Plus(F.C1, F.Negate(a), F.Floor(F.Slot1))), F.And(F.LessEqual(a, F.Slot1), F.Less(F.Slot1, b))), F.List(F.C1, F.GreaterEqual(F.Slot1, b))), F.C0)); // $$; return callFunction(function, k); } return F.NIL; }
@Override public IExpr cdf(IAST dist, IExpr k) { if (dist.isAST2()) { IExpr n = dist.arg1(); IExpr m = dist.arg2(); IExpr function = // [$ (Piecewise({{BetaRegularized(1 - m, n - Floor(#), 1 + Floor(#)), 0<=#<n}, {1, # >= n}}, // 0)) & $] F.Function(F.Piecewise(F.List( F.List(F.BetaRegularized(F.Plus(F.C1, F.Negate(m)), F.Plus(n, F.Negate(F.Floor(F.Slot1))), F.Plus(F.C1, F.Floor(F.Slot1))), F.And(F.LessEqual(F.C0, F.Slot1), F.Less(F.Slot1, n))), F.List(F.C1, F.GreaterEqual(F.Slot1, n))), F.C0)); // $$; return callFunction(function, k); } return F.NIL; }
public static IExpr tukeyWindow(IExpr x) { return // [$ Piecewise({{1, -(1/3) - 2*x <= 0 && -(1/3) + 2*x <= 0}, {(1/2)*(1 + Cos(3*Pi*(1/6 + x))), x >= -(1/2) && // -(1/3) - 2*x > 0}, {(1/2)*(1 + Cos(3*Pi*(-(1/6) + x))), -(1/3) + 2*x > 0 && x <= 1/2}}, 0) $] F.Piecewise(F.List( F.List(F.C1, F.And(F.LessEqual(F.Plus(F.CN1D3, F.Times(F.CN2, x)), F.C0), F.LessEqual(F.Plus(F.CN1D3, F.Times(F.C2, x)), F.C0))), F.List(F.Times(F.C1D2, F.Plus(F.C1, F.Cos(F.Times(F.C3, F.Pi, F.Plus(F.QQ(1L, 6L), x))))), F.And(F.GreaterEqual(x, F.CN1D2), F.Greater(F.Plus(F.CN1D3, F.Times(F.CN2, x)), F.C0))), F.List(F.Times(F.C1D2, F.Plus(F.C1, F.Cos(F.Times(F.C3, F.Pi, F.Plus(F.QQ(-1L, 6L), x))))), F.And(F.Greater(F.Plus(F.CN1D3, F.Times(F.C2, x)), F.C0), F.LessEqual(x, F.C1D2)))), F.C0); // $$; }
F.LessEqual(F.Plus(n, ns, F.Negate(nt)), F.Slot1), F.Less(F.Slot1, n), F.Less(F.Slot1, ns))), F.List(F.C1, F.Or(F.GreaterEqual(F.Slot1, n), F.GreaterEqual(F.Slot1, ns)))),
return F.Piecewise( F.List(F.List(F.Times(F.Power(x0, F.Plus(exp, n.negate())), F.Binomial(exp, n)), F.GreaterEqual(n, F.C0))), F.C0); return F.Piecewise( F.List(F.List(F.Times(F.Power(b, x0), F.Power(F.Factorial(n), F.CN1), F.Power(F.Log(b), n)), F.GreaterEqual(n, F.C0))), F.C0);