private void InitInterpolantModel()
        {
            var xData = ProbabilityFunctionValues.Select(p => p.X).ToArray();
            var yData = ProbabilityFunctionValues.Select(p => p.Y).ToArray();

            alglib.spline1dinterpolant spline1Dinterpolant;
            alglib.spline1dbuildcubic(xData, yData, out spline1Dinterpolant);
            InterpolantModel = spline1Dinterpolant;
        }
        private double GetProbabilityFunctionValueAtPoint(double x)
        {
            var existingPoint = ProbabilityFunctionValues.SingleOrDefault(p => p.X.Equals(x));

            if (existingPoint != null)
            {
                return(existingPoint.Y);
            }

            var interpolatedValue = alglib.spline1dcalc(InterpolantModel, x);

            return(interpolatedValue);
        }