public void GetInverseCdfValue_ResultOfCdfValue_InputValue([Range(-5.0, 5.0, 0.1)] double x)
        {
            double expected = x;

            double probability = StandardNormalDistribution.GetCdfValue(x);
            double actual      = StandardNormalDistribution.GetInverseCdfValue(probability);

            Assert.That(actual, Is.EqualTo(expected).Within(1E-8));
        }
        public void GetCdfValue_ResultOfInverseCdfValue_InputValue([Range(0.0, 1.0, 0.01)] double probability)
        {
            Assume.That(probability, Is.LessThanOrEqualTo(1.0));
            double expected = probability;

            double x      = StandardNormalDistribution.GetInverseCdfValue(probability);
            double actual = StandardNormalDistribution.GetCdfValue(x);

            Assert.That(actual, Is.EqualTo(expected).Within(1E-9));
        }
//        [TestCase(0.99999999999999999, 8.4937932241095980744447188132289548161213991737094E+0)]
        public void GetInverseCdfValue_TestCase_BenchmarkResult(double probability, double expected)
        {
            double actual = StandardNormalDistribution.GetInverseCdfValue(probability);

            Assert.That(actual, Is.EqualTo(expected).Within(1E-7));  // low tolerance only!
        }
예제 #4
0
 /// <summary>Gets a specific value of the inverse of the cumulative distribution function.
 /// </summary>
 /// <param name="probability">The probability where to evaluate.</param>
 /// <returns>The specified value of the inverse of the cumulative distribution function.</returns>
 public double GetInverseCdfValue(double probability)
 {
     return(Math.Exp(StandardNormalDistribution.GetInverseCdfValue(probability) * Sigma + Mu) + Shift);
 }