本文整理汇总了C#中Hypergeometric类的典型用法代码示例。如果您正苦于以下问题:C# Hypergeometric类的具体用法?C# Hypergeometric怎么用?C# Hypergeometric使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Hypergeometric类属于命名空间,在下文中一共展示了Hypergeometric类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CanCreateHypergeometric
public void CanCreateHypergeometric(int population, int success, int draws)
{
var d = new Hypergeometric(population, success, draws);
Assert.AreEqual(population, d.Population);
Assert.AreEqual(success, d.Success);
Assert.AreEqual(draws, d.Draws);
}
示例2: CanCreateHypergeometric
public void CanCreateHypergeometric(int size, int m, int n)
{
var d = new Hypergeometric(size, m, n);
Assert.AreEqual(size, d.PopulationSize);
Assert.AreEqual(m, d.M);
Assert.AreEqual(n, d.N);
}
示例3: CanCreateHypergeometric
public void CanCreateHypergeometric([Values(0, 1, 2, 2, 10, 10)] int size, [Values(0, 1, 1, 2, 1, 5)] int m, [Values(0, 1, 1, 2, 1, 3)] int n)
{
var d = new Hypergeometric(size, m, n);
Assert.AreEqual(size, d.PopulationSize);
Assert.AreEqual(m, d.M);
Assert.AreEqual(n, d.N);
}
示例4: CanCreateHypergeometric
public void CanCreateHypergeometric(int N, int m, int n)
{
var d = new Hypergeometric(N, m, n);
Assert.AreEqual<double>(N, d.PopulationSize);
Assert.AreEqual<double>(m, d.M);
Assert.AreEqual<double>(n, d.N);
}
示例5: SetSuccessFails
public void SetSuccessFails(int success)
{
var d = new Hypergeometric(10, 1, 1);
Assert.Throws<ArgumentOutOfRangeException>(() => d.Success = success);
}
示例6: SetPopulationFails
public void SetPopulationFails(int population)
{
var d = new Hypergeometric(10, 1, 1);
Assert.Throws<ArgumentOutOfRangeException>(() => d.Population = population);
}
示例7: ValidateEntropy
public void ValidateEntropy()
{
var d = new Hypergeometric(10, 1, 1);
var e = d.Entropy;
}
示例8: ValidateToString
public void ValidateToString()
{
var d = new Hypergeometric(10, 1, 1);
Assert.AreEqual("Hypergeometric(N = 10, M = 1, n = 1)", d.ToString());
}
示例9: ValidateProbabilityLn
public void ValidateProbabilityLn(int population, int success, int draws, int x)
{
var d = new Hypergeometric(population, success, draws);
Assert.AreEqual(Math.Log(d.Probability(x)), d.ProbabilityLn(x));
}
示例10: ValidateMode
public void ValidateMode(int population, int success, int draws)
{
var d = new Hypergeometric(population, success, draws);
Assert.AreEqual((draws + 1)*(success + 1)/(population + 2), d.Mode);
}
示例11: ValidateMedianThrowsNotSupportedException
public void ValidateMedianThrowsNotSupportedException()
{
var d = new Hypergeometric(10, 1, 1);
Assert.Throws<NotSupportedException>(() => { var m = d.Median; });
}
示例12: ValidateSkewness
public void ValidateSkewness(int N, int m, int n)
{
var d = new Hypergeometric(N, m, n);
Assert.AreEqual<double>((Math.Sqrt(N - 1.0) * (N - 2 * n) * (N - 2 * m)) / (Math.Sqrt(n * m * (N - m) * (N - n)) * (N - 2.0)), d.Skewness);
}
示例13: ValidateProbabilityLn
public void ValidateProbabilityLn(int N, int m, int n, int x)
{
var d = new Hypergeometric(N, m, n);
Assert.AreEqual(Math.Log(d.Probability(x)), d.ProbabilityLn(x));
}
示例14: ValidateProbability
public void ValidateProbability(int N, int m, int n, int x)
{
var d = new Hypergeometric(N, m, n);
Assert.AreEqual<double>(SpecialFunctions.Binomial(m, x) * SpecialFunctions.Binomial(N - m, n - x) / SpecialFunctions.Binomial(N, n), d.Probability(x));
}
示例15: ValidateMode
public void ValidateMode(int N, int m, int n)
{
var d = new Hypergeometric(N, m, n);
Assert.AreEqual<double>((n + 1) * (m + 1) / (N + 2), d.Mode);
}