diff --git a/src/Numerics/Distributions/BetaBinomial.cs b/src/Numerics/Distributions/BetaBinomial.cs index 13d450fc..af9661bf 100644 --- a/src/Numerics/Distributions/BetaBinomial.cs +++ b/src/Numerics/Distributions/BetaBinomial.cs @@ -3,7 +3,7 @@ // http://numerics.mathdotnet.com // http://github.com/mathnet/mathnet-numerics // -// Copyright (c) 2009-2014 Math.NET +// Copyright (c) 2009-2020 Math.NET // // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation @@ -141,17 +141,17 @@ namespace MathNet.Numerics.Distributions /// /// Gets the mean of the distribution. /// - double IUnivariateDistribution.Mean => (_n * _a) / (_a + _b); + public double Mean => (_n * _a) / (_a + _b); /// /// Gets the variance of the distribution. /// - double IUnivariateDistribution.Variance => (_n*_a*_b*(_a+_b+_n))/(Math.Pow((_a+_b),2) * (_a+_b+1)); + public double Variance => (_n*_a*_b*(_a+_b+_n))/(Math.Pow((_a+_b),2) * (_a+_b+1)); /// /// Gets the standard deviation of the distribution. /// - double IUnivariateDistribution.StdDev => Math.Sqrt((_n * _a * _b * (_a + _b + _n)) / (Math.Pow((_a + _b), 2) * (_a + _b + 1))); + public double StdDev => Math.Sqrt((_n * _a * _b * (_a + _b + _n)) / (Math.Pow((_a + _b), 2) * (_a + _b + 1))); /// /// Gets the entropy of the distribution. @@ -161,14 +161,14 @@ namespace MathNet.Numerics.Distributions /// /// Gets the skewness of the distribution. /// - double IUnivariateDistribution.Skewness => + public double Skewness => (_a + _b + 2 * _n) * (_b - _a) / (_a + _b + 2) * Math.Sqrt((1 + _a + _b) / (_n * _a * _b * (_n + _a + _b))); /// /// Gets the mode of the distribution /// int IDiscreteDistribution.Mode => throw new NotSupportedException(); - + /// /// Gets the median of the distribution. /// @@ -235,7 +235,7 @@ namespace MathNet.Numerics.Distributions } else { - return Math.Exp(PMFLn(n, a, b, k)); + return Math.Exp(PMFLn(n, a, b, k)); } } @@ -330,7 +330,7 @@ namespace MathNet.Numerics.Distributions /// /// Fills an array with samples generated from the distribution. /// - public void Samples(int[] values) + public void Samples(int[] values) { SamplesUnchecked(_random, values, _n, _a, _b); } diff --git a/src/Numerics/SpecialFunctions/GeneralizedHyperGeometric.cs b/src/Numerics/SpecialFunctions/GeneralizedHyperGeometric.cs index 5a7c9e9d..8313f2f6 100644 --- a/src/Numerics/SpecialFunctions/GeneralizedHyperGeometric.cs +++ b/src/Numerics/SpecialFunctions/GeneralizedHyperGeometric.cs @@ -3,7 +3,7 @@ // http://numerics.mathdotnet.com // http://github.com/mathnet/mathnet-numerics // -// Copyright (c) 2009-2010 Math.NET +// Copyright (c) 2009-2020 Math.NET // // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation @@ -38,16 +38,13 @@ namespace MathNet.Numerics { public static partial class SpecialFunctions { - //Rising and falling factorials - reference here: //https://en.wikipedia.org/wiki/Falling_and_rising_factorials - /// /// Computes the Rising Factorial (Pochhammer function) x -> (x)n, n>= 0. see: https://en.wikipedia.org/wiki/Falling_and_rising_factorials /// /// The real value of the Rising Factorial for x and n - public static double RisingFactorial(double x, int n) { double accumulator = 1.0; @@ -73,7 +70,6 @@ namespace MathNet.Numerics } return accumulator; } - // /// /// A generalized hypergeometric series is a power series in which the ratio of successive coefficients indexed by n is a rational function of n. @@ -137,7 +133,7 @@ namespace MathNet.Numerics } else { - return incrementAs / incrementBs * Math.Pow(z, currentN) / Factorial(currentN); + return incrementAs / incrementBs * Math.Pow(z, currentN) / Factorial(currentN); } }