mathnet / mathnet-numerics

Math.NET Numerics

Home Page:http://numerics.mathdotnet.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Some combination of parameter for PERT Distribution may throw exception

jecc1982 opened this issue · comments

Hi

I notice that some combination of parameters of PERT distribution may throw ArgumentException and I am unsure if this is intentional.

        [Theory]
        [InlineData(7.7, 8, 7.9)] // Pass
        [InlineData(7.8, 8, 7.9)] // Exception
        public void TestSamplingFromPertDistribution(double min, double max, double likely)
        {
            double sample = MathNet.Numerics.Distributions.BetaScaled.PERT(min, max, likely).Sample();
            Assert.InRange(sample, min, max);
        }
System.ArgumentException : Invalid parametrization for the distribution.
   at MathNet.Numerics.Distributions.BetaScaled..ctor(Double a, Double b, Double location, Double scale, Random randomSource)
   at MathNet.Numerics.Distributions.BetaScaled.PERT(Double min, Double max, Double likely, Random randomSource)
   at TestSamplingFromPertDistribution(Double min, Double max, Double likely)
   at InvokeStub_ContinuousValueTest.TestSamplingFromPertDistribution(Object, Span`1)
   at System.Reflection.MethodBaseInvoker.InvokeWithFewArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)