예제 #1
0
 public TruncatedDistribution(ITruncatableDistribution <double> distribution, double lowerBound, double upperBound)
 {
     if (lowerBound > upperBound)
     {
         throw new ArgumentOutOfRangeException($"lowerBound ({lowerBound}) > upperBound ({upperBound})");
     }
     this.Distribution     = distribution;
     this.LowerBound       = lowerBound;
     this.UpperBound       = upperBound;
     this.TotalProbability = distribution.GetProbBetween(lowerBound, upperBound);
     this.LowerProbability = distribution.GetProbLessThan(lowerBound);
 }
예제 #2
0
 /// <inheritdoc/>
 public double GetProbLessThan(double x)
 {
     return(Math.Min(1, Math.Max(0, Distribution.GetProbLessThan(x) - LowerProbability) / TotalProbability));
 }