Пример #1
0
 /// <inheritdoc />
 public override double LeftProbability(double x)
 {
     if (x <= 0.0)
     {
         return(0.0);
     }
     else
     {
         double s  = Math.Sqrt(lambda / x);
         double z1 = s * (x - mu) / mu;
         double z2 = s * (x + mu) / mu;
         return(NormalDistribution.Phi(z1) + Math.Exp(2.0 * lambda / mu) * NormalDistribution.Phi(-z2));
     }
 }
Пример #2
0
 /// <inheritdoc />
 public override double RightProbability(double x)
 {
     if (x <= 0.0)
     {
         return(1.0);
     }
     else
     {
         // Start from the left probability formula and use 1-\Phi(z) = \Phi(-z)
         // This formula accurately reproduces very small probabilities in the right tail.
         double s  = Math.Sqrt(lambda / x);
         double z1 = s * (x - mu) / mu;
         double z2 = s * (x + mu) / mu;
         return(NormalDistribution.Phi(-z1) - Math.Exp(2.0 * lambda / mu) * NormalDistribution.Phi(-z2));
     }
 }