public void TestDescriptiveStatisticsMeanVariance()
        {
            // Test around 10^9, potential stability issues
            NormalDistribution gaussian = new NormalDistribution(1e+9, 2);

            Assert.That(DescriptiveStatistics.Mean(gaussian.EnumerateDoubles(10000)), NumericIs.AlmostEqualTo(1e+9, 0.2), "Mean of (1e+9,2)");
            Assert.That(DescriptiveStatistics.Variance(gaussian.EnumerateDoubles(10000)), NumericIs.AlmostEqualTo((double) 4, 0.5), "Variance of (1e+9,2)");
            Assert.That(DescriptiveStatistics.StandardDeviation(gaussian.EnumerateDoubles(10000)), NumericIs.AlmostEqualTo((double) 2, 0.5), "StdDev of (1e+9,2)");
        }
        public void TestContinuousDistributions_Gaussian()
        {
            TestContinuousDistributionShapeMatchesCumulativeDensity(
                new StandardDistribution(),
                -2.0,
                2.0,
                10,
                100000,
                0.01,
                "StandardDistribution()");

            TestContinuousDistributionShapeMatchesCumulativeDensity(
                new NormalDistribution(-5.0, 2.0),
                -9.0,
                -1.0,
                10,
                100000,
                0.01,
                "NormalDistribution(-5.0,2.0)");

            TestContinuousDistributionShapeMatchesCumulativeDensity(
                new LognormalDistribution(1.0, 0.5),
                0.0,
                8.0,
                10,
                100000,
                0.01,
                "LognormalDistribution(1.0,0.5)");

            // Test Parameter Estimation
            NormalDistribution source = new NormalDistribution(4.0, 2.0);
            NormalDistribution target = new NormalDistribution();
            target.EstimateDistributionParameters(source.EnumerateDoubles(1000));
            Assert.That(target.Mu, NumericIs.AlmostEqualTo(4.0, 0.1), "Normal Parameter Estimation: Mu");
            Assert.That(target.Sigma, NumericIs.AlmostEqualTo(2.0, 0.1), "Normal Parameter Estimation: Sigma");
        }