本文整理汇总了C#中MathNet.Numerics.Distributions.Gamma类的典型用法代码示例。如果您正苦于以下问题:C# Gamma类的具体用法?C# Gamma怎么用?C# Gamma使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Gamma类属于MathNet.Numerics.Distributions命名空间,在下文中一共展示了Gamma类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestStarUniformDistribution
public void TestStarUniformDistribution()
{
IContinuousDistribution distribution = new Gamma(9, 1/5000.0);
Console.WriteLine(distribution.CumulativeDistribution(30000));
//IContinuousDistribution distribution = new Gamma(3, 0.05);
for (double d = 0; d < 50000; d = d + 1000)
{
//Console.WriteLine(Gamma.PDF(3, 0.05, d));
//Console.WriteLine(Gamma.CDF(3, 0.05, d));
Console.WriteLine("" + d + ": " + distribution.CumulativeDistribution(d));
}
}
示例2: SetupDistributions
public void SetupDistributions()
{
dists = new IDistribution[8];
dists[0] = new Beta(1.0, 1.0);
dists[1] = new ContinuousUniform(0.0, 1.0);
dists[2] = new Gamma(1.0, 1.0);
dists[3] = new Normal(0.0, 1.0);
dists[4] = new Bernoulli(0.6);
dists[5] = new Weibull(1.0, 1.0);
dists[6] = new DiscreteUniform(1, 10);
dists[7] = new LogNormal(1.0, 1.0);
}
示例3: SetShapeFailsWithNegativeShape
public void SetShapeFailsWithNegativeShape()
{
var n = new Gamma(1.0, 1.0);
n.Shape = -1.0;
}
示例4: CanCreateGamma
public void CanCreateGamma(double shape, double invScale)
{
var n = new Gamma(shape, invScale);
Assert.AreEqual(shape, n.Shape);
Assert.AreEqual(invScale, n.Rate);
}
示例5: ValidateToString
public void ValidateToString()
{
var n = new Gamma(1d, 2d);
Assert.AreEqual("Gamma(α = 1, β = 2)", n.ToString());
}
示例6: ValidateSkewness
public void ValidateSkewness(double shape, double invScale, double skewness)
{
var n = new Gamma(shape, invScale);
AssertHelpers.AlmostEqualRelative(skewness, n.Skewness, 15);
}
示例7: ValidateMinimum
public void ValidateMinimum()
{
var n = new Gamma(1.0, 1.0);
Assert.AreEqual(0.0, n.Minimum);
}
示例8: ValidateMean
public void ValidateMean(double shape, double invScale, double mean)
{
var n = new Gamma(shape, invScale);
Assert.AreEqual(mean, n.Mean);
}
示例9: ValidateInverseCumulativeDistribution
public void ValidateInverseCumulativeDistribution(int shape, double invScale, double x, double cdf)
{
var gamma = new Gamma(shape, invScale);
Assert.That(gamma.InverseCumulativeDistribution(cdf), Is.EqualTo(x).Within(10));
Assert.That(Gamma.InvCDF(shape, invScale, cdf), Is.EqualTo(x).Within(10));
}
示例10: ValidateCumulativeDistribution
public void ValidateCumulativeDistribution(int shape, double invScale, double x, double cdf)
{
var n = new Gamma(shape, invScale);
AssertHelpers.AlmostEqual(cdf, n.CumulativeDistribution(x), 14);
AssertHelpers.AlmostEqual(cdf, Gamma.CDF(shape, invScale, x), 14);
}
示例11: CanCreateGamma
public void CanCreateGamma(double shape, double invScale)
{
var n = new Gamma(shape, invScale);
AssertEx.AreEqual<double>(shape, n.Shape);
AssertEx.AreEqual<double>(invScale, n.InvScale);
}
示例12: ValidateToString
public void ValidateToString()
{
var n = new Gamma(1.0, 2.0);
AssertEx.AreEqual<string>("Gamma(Shape = 1, Inverse Scale = 2)", n.ToString());
}
示例13: ValidateMedian
public void ValidateMedian(double shape, double invScale)
{
var n = new Gamma(shape, invScale);
var median = n.Median;
}
示例14: ValidateMaximum
public void ValidateMaximum()
{
var n = new Gamma(1.0, 1.0);
AssertEx.AreEqual<double>(System.Double.PositiveInfinity, n.Maximum);
}
示例15: ValidateDensityLn
public void ValidateDensityLn(double shape, double invScale, double x, double pdfln)
{
var n = new Gamma(shape, invScale);
AssertHelpers.AlmostEqual(pdfln, n.DensityLn(x), 14);
}