public static IExpr dirichletWindow(IExpr x) { return // [$ Piecewise({{1, -(1/2) <= x <= 1/2}}, 0) $] F.Piecewise(F.List(F.List(F.C1, F.LessEqual(F.CN1D2, x, F.C1D2))), F.C0); // $$; }
@Override public IExpr median(IAST dist) { if (dist.isAST1()) { // (p) => Piecewise({{1, p > 1/2}}, 0) return F.Piecewise(F.List(F.List(F.C1, F.Greater(dist.arg1(), F.C1D2))), F.C0); } return F.NIL; }
@Override public IExpr mean(IAST dist) { if (dist.isAST1()) { // (v) -> Piecewise({{0, v > 1}}, Indeterminate) return F.Piecewise(F.List(F.List(F.C0, F.Greater(dist.arg1(), F.C1))), F.Indeterminate); } if (dist.isAST3()) { // (m,s,v) -> Piecewise({{m, v > 1}}, Indeterminate) return F.Piecewise(F.List(F.List(dist.arg1(), F.Greater(dist.arg3(), F.C1))), F.Indeterminate); } return F.NIL; }
public static IExpr hannWindow(IExpr x) { return // [$ Piecewise({{1/2 + (1/2)*Cos(2*Pi*x), -(1/2) <= x <= 1/2}}, 0) $] F.Piecewise(F.List(F.List(F.Plus(F.C1D2, F.Times(F.C1D2, F.Cos(F.Times(F.C2, F.Pi, x)))), F.LessEqual(F.CN1D2, x, F.C1D2))), F.C0); // $$; }
@Override public IExpr variance(IAST dist) { if (dist.isAST1()) { IExpr n = dist.arg1(); return F.Piecewise(F.List(F.List(F.Divide(n, F.Plus(F.CN2, n)), F.Greater(n, F.C2))), F.Indeterminate); } return F.NIL; }
public static IExpr gaussianWindow(IExpr x) { return // [$ Piecewise({{E^(-((50*x^2)/9)), -(1/2) <= x <= 1/2}}, 0) $] F.Piecewise(F.List( F.List(F.Exp(F.Times(F.CN1, F.QQ(1L, 9L), F.ZZ(50L), F.Sqr(x))), F.LessEqual(F.CN1D2, x, F.C1D2))), F.C0); // $$; }
public static IExpr hammingWindow(IExpr x) { return // [$ Piecewise({{25/46 + (21/46)*Cos(2*Pi*x), -(1/2) <= x <= 1/2}}, 0) $] F.Piecewise(F.List(F.List(F.Plus(F.QQ(25L, 46L), F.Times(F.QQ(21L, 46L), F.Cos(F.Times(F.C2, F.Pi, x)))), F.LessEqual(F.CN1D2, x, F.C1D2))), F.C0); // $$; }
@Override public IExpr mean(IAST dist) { if (dist.isAST2()) { IExpr n = dist.arg1(); IExpr m = dist.arg2(); return // [$ Piecewise({{m/(-2 + m), m > 2}}, Indeterminate) $] F.Piecewise(F.List(F.List(F.Times(F.Power(F.Plus(F.CN2, m), -1), m), F.Greater(m, F.C2))), F.Indeterminate); // $$; } return F.NIL; }
@Override public IExpr mean(IAST dist) { if (dist.isAST2()) { IExpr n = dist.arg1(); IExpr m = dist.arg2(); // Piecewise({{m*Gamma(1 - 1/n), 1 < n}}, Infinity) return F.Piecewise( F.List(F.List(F.Times(m, F.Gamma(F.Subtract(F.C1, F.Power(n, F.CN1)))), F.Less(F.C1, n))), F.CInfinity); } return F.NIL; }
@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; }
public static IExpr bartlettWindow(IExpr x) { return // [$ Piecewise({{1 - 2*x, 0 <= x <= 1/2}, {1 + 2*x, Inequality(-(1/2), LessEqual, x, Less, 0)}}, 0) // $] F.Piecewise(F.List(F.List(F.Plus(F.C1, F.Times(F.CN2, x)), F.LessEqual(F.C0, x, F.C1D2)), F.List(F.Plus(F.C1, F.Times(F.C2, x)), F.And(F.LessEqual(F.CN1D2, x), F.Less(x, F.C0)))), F.C0); // $$; }
@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 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 p = dist.arg1(); // IExpr function = // [$ Piecewise({{1 - p, # == 0}, {p, # == 1}}, 0) & $] F.Function(F.Piecewise(F.List(F.List(F.Plus(F.C1, F.Negate(p)), F.Equal(F.Slot1, F.C0)), F.List(p, F.Equal(F.Slot1, F.C1))), F.C0)); // $$; return callFunction(function, k); } return F.NIL; }
public static IExpr blackmanWindow(IExpr x) { return // [$ Piecewise({{(1/50)*(21 + 25*Cos(2*Pi*x) + 4*Cos(4*Pi*x)), -(1/2) <= x <= 1/2}}, 0) $] F.Piecewise( F.List(F.List( F.Times(F.QQ(1L, 50L), F.Plus(F.ZZ(21L), F.Times(F.ZZ(25L), F.Cos(F.Times(F.C2, F.Pi, x))), F.Times(F.C4, F.Cos(F.Times(F.C4, F.Pi, x))))), F.LessEqual(F.CN1D2, x, F.C1D2))), F.C0); // $$; }
@Override public IExpr variance(IAST dist) { if (dist.isAST2()) { IExpr n = dist.arg1(); IExpr m = dist.arg2(); return // [$ Piecewise({{(2*m^2*(-2 + m + n))/((-4 + m)*(-2 + m)^2*n), m > 4}}, Indeterminate) $] F.Piecewise(F.List(F.List( F.Times(F.C2, F.Sqr(m), F.Plus(F.CN2, m, n), F.Power(F.Times(F.Plus(F.CN4, m), F.Sqr(F.Plus(F.CN2, m)), n), -1)), F.Greater(m, F.C4))), F.Indeterminate); // $$; } return F.NIL; } }
public static IExpr nuttallWindow(IExpr x) { return // [$ Piecewise[{{(88942 + 121849*Cos(2*Pi*x) + 36058*Cos(4*Pi*x) + 3151*Cos(6*Pi*x))/250000, -(1/2) <= x <= // 1/2}}, 0] $] F.Piecewise(F.List(F.List( F.Times(F.QQ(1L, 250000L), F.Plus(F.ZZ(88942L), F.Times(F.ZZ(121849L), F.Cos(F.Times(F.C2, F.Pi, x))), F.Times(F.ZZ(36058L), F.Cos(F.Times(F.C4, F.Pi, x))), F.Times(F.ZZ(3151L), F.Cos(F.Times(F.C6, F.Pi, x))))), F.LessEqual(F.CN1D2, x, F.C1D2))), F.C0); // $$; }
public static IExpr blackmanHarrisWindow(IExpr x) { return // [$ Piecewise({{(35875 + 48829*Cos(2*Pi*x) + 14128*Cos(4*Pi*x) + 1168*Cos(6*Pi*x))/100000, -(1/2) <= x <= // 1/2}}, 0) // $] F.Piecewise(F.List(F.List( F.Times(F.QQ(1L, 100000L), F.Plus(F.ZZ(35875L), F.Times(F.ZZ(48829L), F.Cos(F.Times(F.C2, F.Pi, x))), F.Times(F.ZZ(14128L), F.Cos(F.Times(F.C4, F.Pi, x))), F.Times(F.ZZ(1168L), F.Cos(F.Times(F.C6, F.Pi, x))))), F.LessEqual(F.CN1D2, x, F.C1D2))), F.C0); // $$; }
public static IExpr blackmanNuttallWindow(IExpr x) { return // [$ Piecewise({{(4891775*Cos(2*Pi*x) + 1365995*Cos(4*Pi*x) + 106411*Cos(6*Pi*x) + 3635819)/10000000, -(1/2) <= // x // <= 1/2}}, 0) // $] F.Piecewise(F.List(F.List( F.Times(F.QQ(1L, 10000000L), F.Plus(F.Times(F.ZZ(4891775L), F.Cos(F.Times(F.C2, F.Pi, x))), F.Times(F.ZZ(1365995L), F.Cos(F.Times(F.C4, F.Pi, x))), F.Times(F.ZZ(106411L), F.Cos(F.Times(F.C6, F.Pi, x))), F.ZZ(3635819L))), F.LessEqual(F.CN1D2, x, F.C1D2))), F.C0); // $$; }
public static IExpr flatTopWindow(IExpr x) { return // [$ Piecewise({{(215578947 + 416631580*Cos(2*Pi*x) + 277263158*Cos(4*Pi*x) + 83578947*Cos(6*Pi*x) + // 6947368*Cos(8*Pi*x))/1000000000, -(1/2) <= x <= 1/2}}, 0) $] F.Piecewise(F.List(F.List( F.Times(F.QQ(1L, 1000000000L), F.Plus(F.ZZ(215578947L), F.Times(F.ZZ(416631580L), F.Cos(F.Times(F.C2, F.Pi, x))), F.Times(F.ZZ(277263158L), F.Cos(F.Times(F.C4, F.Pi, x))), F.Times(F.ZZ(83578947L), F.Cos(F.Times(F.C6, F.Pi, x))), F.Times(F.ZZ(6947368L), F.Cos(F.Times(F.C8, F.Pi, x))))), F.LessEqual(F.CN1D2, x, F.C1D2))), F.C0); // $$; }