public void CauchyFWHM() { // Check that FWHM really is the full-width at half-maximum. CauchyDistribution D = new CauchyDistribution(1.0, 2.0); double p = D.ProbabilityDensity(D.Median); Assert.IsTrue(TestUtilities.IsNearlyEqual(D.ProbabilityDensity(D.Median - D.FullWithAtHalfMaximum / 2.0), p / 2.0)); Assert.IsTrue(TestUtilities.IsNearlyEqual(D.ProbabilityDensity(D.Median + D.FullWithAtHalfMaximum / 2.0), p / 2.0)); }
public void CauchyStudentAgreement() { StudentDistribution S = new StudentDistribution(1); CauchyDistribution C = new CauchyDistribution(); // don't compare moments directly, because NaN != NaN foreach (double P in probabilities) { double xS = S.InverseLeftProbability(P); double xC = C.InverseLeftProbability(P); Console.WriteLine("{0} {1} {2}", P, xS, xC); Assert.IsTrue(TestUtilities.IsNearlyEqual(xS, xC)); Assert.IsTrue(TestUtilities.IsNearlyEqual(S.ProbabilityDensity(xS), C.ProbabilityDensity(xC))); } }