本文整理汇总了C#中NormalDistribution.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# NormalDistribution.ToString方法的具体用法?C# NormalDistribution.ToString怎么用?C# NormalDistribution.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NormalDistribution
的用法示例。
在下文中一共展示了NormalDistribution.ToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConstructorTest5
public void ConstructorTest5()
{
var normal = new NormalDistribution(mean: 4, stdDev: 4.2);
double mean = normal.Mean; // 4.0
double median = normal.Median; // 4.0
double var = normal.Variance; // 17.64
double cdf = normal.DistributionFunction(x: 1.4); // 0.26794249453351904
double pdf = normal.ProbabilityDensityFunction(x: 1.4); // 0.078423391448155175
double lpdf = normal.LogProbabilityDensityFunction(x: 1.4); // -2.5456330358182586
double ccdf = normal.ComplementaryDistributionFunction(x: 1.4); // 0.732057505466481
double icdf = normal.InverseDistributionFunction(p: cdf); // 1.4
double hf = normal.HazardFunction(x: 1.4); // 0.10712736480747137
double chf = normal.CumulativeHazardFunction(x: 1.4); // 0.31189620872601354
string str = normal.ToString(CultureInfo.InvariantCulture); // N(x; μ = 4, σ² = 17.64)
Assert.AreEqual(4.0, mean);
Assert.AreEqual(4.0, median);
Assert.AreEqual(17.64, var);
Assert.AreEqual(0.31189620872601354, chf);
Assert.AreEqual(0.26794249453351904, cdf);
Assert.AreEqual(0.078423391448155175, pdf);
Assert.AreEqual(-2.5456330358182586, lpdf);
Assert.AreEqual(0.10712736480747137, hf);
Assert.AreEqual(0.732057505466481, ccdf);
Assert.AreEqual(1.4, icdf);
Assert.AreEqual("N(x; μ = 4, σ² = 17.64)", str);
}
示例2: ConstructorTest5
public void ConstructorTest5()
{
var normal = new NormalDistribution(mean: 4, stdDev: 4.2);
double mean = normal.Mean; // 4.0
double median = normal.Median; // 4.0
double mode = normal.Mode; // 4.0
double var = normal.Variance; // 17.64
double cdf = normal.DistributionFunction(x: 1.4); // 0.26794249453351904
double pdf = normal.ProbabilityDensityFunction(x: 1.4); // 0.078423391448155175
double lpdf = normal.LogProbabilityDensityFunction(x: 1.4); // -2.5456330358182586
double ccdf = normal.ComplementaryDistributionFunction(x: 1.4); // 0.732057505466481
double icdf = normal.InverseDistributionFunction(p: cdf); // 1.4
double hf = normal.HazardFunction(x: 1.4); // 0.10712736480747137
double chf = normal.CumulativeHazardFunction(x: 1.4); // 0.31189620872601354
string str = normal.ToString(CultureInfo.InvariantCulture); // N(x; μ = 4, σ² = 17.64)
Assert.AreEqual(4.0, mean);
Assert.AreEqual(4.0, median);
Assert.AreEqual(4.0, mode);
Assert.AreEqual(17.64, var);
Assert.AreEqual(0.31189620872601354, chf);
Assert.AreEqual(0.26794249453351904, cdf);
Assert.AreEqual(0.078423391448155175, pdf);
Assert.AreEqual(-2.5456330358182586, lpdf);
Assert.AreEqual(0.10712736480747137, hf);
Assert.AreEqual(0.732057505466481, ccdf);
Assert.AreEqual(1.4, icdf);
Assert.AreEqual("N(x; μ = 4, σ² = 17.64)", str);
Assert.AreEqual(Accord.Math.Normal.Function(normal.ZScore(4.2)), normal.DistributionFunction(4.2));
Assert.AreEqual(Accord.Math.Normal.Derivative(normal.ZScore(4.2)) / normal.StandardDeviation, normal.ProbabilityDensityFunction(4.2), 1e-16);
Assert.AreEqual(Accord.Math.Normal.LogDerivative(normal.ZScore(4.2)) - Math.Log(normal.StandardDeviation), normal.LogProbabilityDensityFunction(4.2), 1e-15);
var range1 = normal.GetRange(0.95);
var range2 = normal.GetRange(0.99);
var range3 = normal.GetRange(0.01);
Assert.AreEqual(-2.9083852331961833, range1.Min);
Assert.AreEqual(10.908385233196183, range1.Max);
Assert.AreEqual(-5.7706610709715314, range2.Min);
Assert.AreEqual(13.770661070971531, range2.Max);
Assert.AreEqual(-5.7706610709715314, range3.Min);
Assert.AreEqual(13.770661070971531, range3.Max);
}