예제 #1
0
        public void ValidateDensityLn(double dof, double x, double expected)
        {
            var chi = new Chi(dof);

            Assert.That(chi.DensityLn(x), Is.EqualTo(expected).Within(13));
            Assert.That(Chi.PDFLn(dof, x), Is.EqualTo(expected).Within(13));
        }
예제 #2
0
        public void ValidateDensityLn(double dof, double x)
        {
            var    n        = new Chi(dof);
            double expected = ((1.0 - (dof / 2.0)) * Math.Log(2.0)) + ((dof - 1.0) * Math.Log(x)) - (x * (x / 2.0)) - SpecialFunctions.GammaLn(dof / 2.0);

            Assert.AreEqual(expected, n.DensityLn(x));
            Assert.AreEqual(expected, Chi.PDFLn(dof, x));
        }