/// <summary> /// Probability Distribution Function /// </summary> /// <see cref="https://en.wikipedia.org/wiki/Probability_density_function"/> public override double Pdf(double x) { if (x < 0) { throw new ArgumentOutOfRangeException(nameof(x), "value must be non negative"); } else if (x == 0) { return(0.0); } return(Math.Pow(Rate, x) * Math.Exp(-Rate) / GammaFunctions.Factorial(x)); }
/// <summary> /// Cumulative Density Function /// </summary> /// <see cref="https://en.wikipedia.org/wiki/Cumulative_distribution_function"/> public override double Cdf(double x) { if (x < 0) { throw new ArgumentOutOfRangeException(nameof(x), "value must be positive"); } else if (x == 0) { return(0.0); } else if (double.IsPositiveInfinity(x)) { return(1.0); } return(GammaFunctions.GammaHigh(x + 1, Rate) / GammaFunctions.Factorial(x)); }