public void ValidateCumulativeDistribution(double dof, double x) { var n = new Chi(dof); double expected = SpecialFunctions.GammaLowerIncomplete(dof / 2.0, x * x / 2.0) / SpecialFunctions.Gamma(dof / 2.0); Assert.AreEqual(expected, n.CumulativeDistribution(x)); Assert.AreEqual(expected, Chi.CDF(dof, x)); }
public void ValidateCumulativeDistribution(double dof, double x, double expected) { var chi = new Chi(dof); Assert.That(chi.CumulativeDistribution(x), Is.EqualTo(expected).Within(13)); Assert.That(Chi.CDF(dof, x), Is.EqualTo(expected).Within(13)); //double expected = SpecialFunctions.GammaLowerIncomplete(dof / 2.0, x * x / 2.0) / SpecialFunctions.Gamma(dof / 2.0); //Assert.AreEqual(expected, n.CumulativeDistribution(x)); //Assert.AreEqual(expected, Chi.CDF(dof, x)); }