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);
}