ProbabilityDensityFunction() public method

Gets the probability density function (pdf) for the Normal distribution evaluated at point x.
public ProbabilityDensityFunction ( double x ) : double
x double A single point in the distribution range. For a /// univariate distribution, this should be a single double value. /// For a multivariate distribution, this should be a double array.
return double
        public void ConstructorTest1()
        {
            var normal = new GeneralizedNormalDistribution(location: 1, scale: 5, shape: 0.42);

            double mean = normal.Mean;     // 1
            double median = normal.Median; // 1
            double mode = normal.Mode;     // 1
            double var = normal.Variance;  // 19200.781700666659

            double cdf = normal.DistributionFunction(x: 1.4); // 0.50877105447218995
            double pdf = normal.ProbabilityDensityFunction(x: 1.4); // 0.024215092283124507
            double lpdf = normal.LogProbabilityDensityFunction(x: 1.4); // -3.7207791921441378

            double ccdf = normal.ComplementaryDistributionFunction(x: 1.4); // 0.49122894552781005
            double icdf = normal.InverseDistributionFunction(p: cdf); // 1.4000000149740104

            double hf = normal.HazardFunction(x: 1.4); // 0.049294921448706883
            double chf = normal.CumulativeHazardFunction(x: 1.4); // 0.71084497569360638

            string str = normal.ToString(CultureInfo.InvariantCulture); // GGD(x; μ = 1, α = 5, β = 0.42)

            Assert.AreEqual(1, mean);
            Assert.AreEqual(1, median);
            Assert.AreEqual(1, mode);
            Assert.AreEqual(19200.781700666659, var);
            Assert.AreEqual(0.71084497569360638, chf);
            Assert.AreEqual(0.50877105447218995, cdf);
            Assert.AreEqual(0.024215092283124507, pdf);
            Assert.AreEqual(-3.7207791921441378, lpdf);
            Assert.AreEqual(0.049294921448706883, hf);
            Assert.AreEqual(0.49122894552781005, ccdf);
            Assert.AreEqual(1.4000000149740104, icdf);
            Assert.AreEqual("GGD(x; μ = 1, α = 5, β = 0.42)", str);
        }
        public void ConstructorTest1()
        {
            var normal = new GeneralizedNormalDistribution(location: 1, scale: 5, shape: 0.42);

            double mean = normal.Mean;     // 1
            double median = normal.Median; // 1
            double mode = normal.Mode;     // 1
            double var = normal.Variance;  // 19200.781700666659

            double cdf = normal.DistributionFunction(x: 1.4); // 0.51076148867681703
            double pdf = normal.ProbabilityDensityFunction(x: 1.4); // 0.024215092283124507
            double lpdf = normal.LogProbabilityDensityFunction(x: 1.4); // -3.7207791921441378

            double ccdf = normal.ComplementaryDistributionFunction(x: 1.4); // 0.48923851132318297
            double icdf = normal.InverseDistributionFunction(p: cdf); // 1.4000000149740108

            double hf = normal.HazardFunction(x: 1.4); // 0.049495474543966168
            double chf = normal.CumulativeHazardFunction(x: 1.4); // 0.7149051552030572

            string str = normal.ToString(CultureInfo.InvariantCulture); // GGD(x; μ = 1, α = 5, β = 0.42)

            Assert.AreEqual(1, mean);
            Assert.AreEqual(1, median);
            Assert.AreEqual(1, mode);
            Assert.AreEqual(19200.781700666659, var);
            Assert.AreEqual(0.7149051552030572, chf);
            Assert.AreEqual(0.51076148867681703, cdf);
            Assert.AreEqual(0.024215092283124507, pdf);
            Assert.AreEqual(-3.7207791921441378, lpdf);
            Assert.AreEqual(0.049495474543966168, hf);
            Assert.AreEqual(0.48923851132318297, ccdf);
            Assert.AreEqual(1.4000000149740108, icdf);
            Assert.AreEqual("GGD(x; μ = 1, α = 5, β = 0.42)", str);

            var range1 = normal.GetRange(0.95);
            var range2 = normal.GetRange(0.99);
            var range3 = normal.GetRange(0.01);

            Assert.AreEqual(-173.60070095277663, range1.Min);
            Assert.AreEqual(175.60070093821949, range1.Max);
            Assert.AreEqual(-428.92857248354409, range2.Min);
            Assert.AreEqual(430.92857248354375, range2.Max);
            Assert.AreEqual(-428.92857248354403, range3.Min);
            Assert.AreEqual(430.92857248354375, range3.Max);
        }
        private static void test(GeneralizedNormalDistribution target, UnivariateContinuousDistribution normal)
        {

            Assert.AreEqual(normal.Mean, target.Mean);
            Assert.AreEqual(normal.Variance, target.Variance, 1e-10);
            Assert.AreEqual(normal.Entropy, target.Entropy, 1e-10);
            Assert.AreEqual(normal.StandardDeviation, target.StandardDeviation, 1e-10);
            Assert.AreEqual(normal.Mode, target.Mode);
            Assert.AreEqual(normal.Median, target.Median);

            for (double x = -10; x < 10; x += 0.0001)
            {
                double actual = target.ProbabilityDensityFunction(x);
                double expected = normal.ProbabilityDensityFunction(x);
                Assert.AreEqual(expected, actual, 1e-15);
                Assert.IsFalse(Double.IsNaN(actual));
            }

            for (double x = -10; x < 10; x += 0.0001)
            {
                double actual = target.LogProbabilityDensityFunction(x);
                double expected = normal.LogProbabilityDensityFunction(x);
                Assert.AreEqual(expected, actual, 1e-10);
                Assert.IsFalse(Double.IsNaN(actual));
            }
        }