Example #1
0
        public void CanSampleSequence()
        {
            var n   = new Laplace();
            var ied = n.Samples();

            GC.KeepAlive(ied.Take(5).ToArray());
        }
Example #2
0
        //public void ApplySobel(int xorder=1, int yorder =1, int apetureSize =17,int gray_threshold=124, int white_threshold=255)
        //{
        //    if (_ImageInput == null)
        //    {
        //        return;
        //    }
        //    Image<Gray, byte> imgGray = _ImageInput.Convert<Gray, byte>();
        //    Image<Gray, float> imgSobel = new Image<Gray, float>(_ImageInput.Width, _ImageInput.Height, new Gray(0));
        //    imgSobel = imgGray.Sobel(xorder,yorder,apetureSize);
        //    var imgBinarize = imgSobel.Convert<Gray, byte>().ThresholdBinary(new Gray(gray_threshold), new Gray(white_threshold));
        //    imageBox1.Image = imgBinarize;

        //}
        private void laplacianToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Laplace laplace = new Laplace();

            laplace.setLaplaceInput(_ImageInput);
            imageBox1.Image = laplace.ApplyLaplace();
        }
Example #3
0
        private static double Noise(double S, double eps)
        {
            var scale = (S / eps);
            var L     = new Laplace(0, scale);

            return(L.Sample());
        }
Example #4
0
        public void CanCreateLaplace(double location, double scale)
        {
            var n = new Laplace(location, scale);

            Assert.AreEqual(location, n.Location);
            Assert.AreEqual(scale, n.Scale);
        }
Example #5
0
        /// <summary>
        ///     The calculation Of the dimensionless wellbore pressure drop  with skin for homogeneous reservoir.
        /// </summary>
        /// <param name="td">dimensionless time</param>
        /// <param name="cd">dimensionless wellbore storage</param>
        /// <param name="skinFactor">skin factor</param>
        /// <returns></returns>
        public static double PwdR(double td, double cd, double skinFactor)
        {
            Condition.Requires(td, nameof(td)).IsGreaterOrEqual(0.0);
            Condition.Requires(cd, nameof(cd)).IsGreaterOrEqual(0.0);

            return(Laplace.InverseTransform((x) => PwdRinLaplaceSpace(x, cd, skinFactor), td));
        }
Example #6
0
        public void CanCreateLaplace()
        {
            var n = new Laplace();

            Assert.AreEqual(0.0, n.Location);
            Assert.AreEqual(1.0, n.Scale);
        }
Example #7
0
        public void ValidateToString()
        {
            System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
            var n = new Laplace(-1d, 2d);

            Assert.AreEqual("Laplace(μ = -1, b = 2)", n.ToString());
        }
Example #8
0
        public void Laplacian(OpenFOAMGrid grid, int DgDegree)
        {
            // grid, etc
            // =========

            GridData grd = grid.GridData;

            var b   = new Basis(grd, DgDegree);
            var map = new UnsetteledCoordinateMapping(b);

            var L  = new Laplace(1.3, grd.Cells.cj);
            var op = new SpatialOperator(1, 0, 1, QuadOrderFunc.Linear(), "T", "c1");

            op.EquationComponents["c1"].Add(L);
            op.Commit();

            // evaluate operator
            // =================

            var Mtx = new BlockMsrMatrix(map, map);

            double[] B = new double[map.LocalLength];

            var eval = op.GetMatrixBuilder(map, null, map);

            eval.ComputeMatrix(Mtx, B);

            // return data
            // ===========

            throw new NotImplementedException("todo");
        }
            private static void SolveEq(DataSet data)
            {
                if (data.XVals.Length == 0 || data.Variables.Count == 0)
                {
                    return;
                }

                double R    = data.Variables[0].ConstValue;
                double w    = data.Variables[1].ConstValue;
                double Kon  = data.Variables[2].ConstValue;
                double Koff = data.Variables[3].ConstValue;
                double Df   = data.Variables[4].ConstValue;
                double Ceq  = data.Variables[5].ConstValue;
                double Feq  = 1 - Ceq;

                data.FitYVals = new double[data.XVals.Length];

                Laplace lap = new Laplace();

                lap.InitStehfest(14);

                for (int t = 1; t < data.XVals.Length; t++)
                {
                    //data.FitYVals[0][t] = MathNet.Numerics.SpecialFunctions.BesselK1(data.XVals[t]);
                    //data.YVals[0][t] = MathNet.Numerics.SpecialFunctions.BesselI1(data.XVals[t]);
                    //data.FitYVals[0][t] = Accord.Math.Bessel.I(data.XVals[t]);

                    //data.FitYVals[0][t] = Accord.Math.Bessel.Y(data.XVals[t]); - it is not modified!!!
                    data.FitYVals[t] = (R)*lap.InverseTransform(R, w, Feq, Ceq, Kon, Koff, Df, data.XVals[t]);
                }
            }
Example #10
0
        public void CanCreateLaplace([Values(Double.NegativeInfinity, -5.0 - 1.0, 0.0, 1.0, 5.0, Double.PositiveInfinity)] double location, [Values(0.1, 1.0, 10.0, Double.PositiveInfinity)] double scale)
        {
            var n = new Laplace(location, scale);

            Assert.AreEqual(location, n.Location);
            Assert.AreEqual(scale, n.Scale);
        }
            private double FunctionValueHalfTime(INonlinearModel model, int rowVid,
                                                 ValuesByIndex values, bool newValues)
            {
                foreach (Variable c in data.Variables)
                {
                    if (c.ConstName == "T1/2")
                    {
                        c.ConstValue = values[model.GetIndexFromKey(c.ConstName)];
                        break;
                    }
                }

                double R    = data.Variables[0].ConstValue;
                double w    = data.Variables[1].ConstValue;
                double Kon  = data.Variables[2].ConstValue;
                double Koff = data.Variables[3].ConstValue;
                double Df   = data.Variables[4].ConstValue;
                double Ceq  = data.Variables[5].ConstValue;
                double Feq  = 1 - Ceq;
                double Tht  = data.Variables[6].ConstValue;

                data.FitYVals = new double[data.XVals.Length];

                Laplace lap = new Laplace();

                lap.InitStehfest(14);

                return(Math.Abs((R)*lap.InverseTransform(R, w, Feq, Ceq, Kon, Koff, Df, Tht) - 0.5 * R));
            }
Example #12
0
        public void ValidateDensity(double location, double scale, double x)
        {
            var    n        = new Laplace(location, scale);
            double expected = Math.Exp(-Math.Abs(x - location) / scale) / (2.0 * scale);

            Assert.AreEqual(expected, n.Density(x));
            Assert.AreEqual(expected, Laplace.PDF(location, scale, x));
        }
Example #13
0
        public void ValidateCumulativeDistribution(double location, double scale, double x)
        {
            var    n        = new Laplace(location, scale);
            double expected = 0.5 * (1.0 + (Math.Sign(x - location) * (1.0 - Math.Exp(-Math.Abs(x - location) / scale))));

            Assert.AreEqual(expected, n.CumulativeDistribution(x));
            Assert.AreEqual(expected, Laplace.CDF(location, scale, x));
        }
Example #14
0
        public void ValidateDensityLn(double location, double scale, double x)
        {
            var    n        = new Laplace(location, scale);
            double expected = -Math.Log(2.0 * scale) - (Math.Abs(x - location) / scale);

            Assert.AreEqual(expected, n.DensityLn(x));
            Assert.AreEqual(expected, Laplace.PDFLn(location, scale, x));
        }
Example #15
0
        private void apeturesize_trackbar_Scroll(object sender, EventArgs e)
        {
            int apeturesize = apeturesize_trackbar.Value;

            apeturesize_label.Text = apeturesize.ToString("ApetureSize :" + apeturesize);
            Laplace laplace = new Laplace();

            laplace.ApplyLaplace(apeturesize);
        }
Example #16
0
        public void ValidateDensityLn(
            [Values(0.0, 1.0, -1.0, 5.0, -5.0, Double.PositiveInfinity, Double.NegativeInfinity, 0.0, 1.0, -1.0, 5.0, -5.0, Double.PositiveInfinity, Double.NegativeInfinity, 0.0, 1.0, -1.0, 5.0, -5.0, Double.PositiveInfinity, Double.NegativeInfinity)] double location,
            [Values(0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, Double.PositiveInfinity, Double.PositiveInfinity, Double.PositiveInfinity, Double.PositiveInfinity, Double.PositiveInfinity, Double.PositiveInfinity, Double.PositiveInfinity)] double scale,
            [Values(1.5, 2.8, -5.4, -4.9, 2.0, 5.5, -0.0, Double.PositiveInfinity, 5.0, -1.0, -1.0, 2.5, 2.0, 15.0, 89.3, -0.1, 0.1, -6.1, -10.0, 2.0, -5.1)] double x)
        {
            var n = new Laplace(location, scale);

            Assert.AreEqual(-Math.Log(2.0 * scale) - (Math.Abs(x - location) / scale), n.DensityLn(x));
        }
Example #17
0
        public void ValidateCumulativeDistribution(
            [Values(0.0, 1.0, -1.0, 5.0, -5.0, Double.PositiveInfinity, Double.NegativeInfinity, 0.0, 1.0, -1.0, 5.0, -5.0, Double.PositiveInfinity, Double.NegativeInfinity, 0.0, 1.0, -1.0, 5.0, -5.0, Double.PositiveInfinity, Double.NegativeInfinity)] double location,
            [Values(0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, Double.PositiveInfinity, Double.PositiveInfinity, Double.PositiveInfinity, Double.PositiveInfinity, Double.PositiveInfinity, Double.PositiveInfinity, Double.PositiveInfinity)] double scale,
            [Values(1.5, 2.8, -5.4, -4.9, 2.0, 5.5, -0.0, Double.PositiveInfinity, 5.0, -1.0, -1.0, 2.5, 2.0, 15.0, 89.3, -0.1, 0.1, -6.1, -10.0, 2.0, -5.1)] double x)
        {
            var n = new Laplace(location, scale);

            Assert.AreEqual(0.5 * (1.0 + (Math.Sign(x - location) * (1.0 - Math.Exp(-Math.Abs(x - location) / scale)))), n.CumulativeDistribution(x));
        }
Example #18
0
        public void ValidateLaplaceDensityEquivalence(double location, double scale, double x)
        {
            var n = new SkewedGeneralizedT(location, scale, 0, 1, double.PositiveInfinity);

            var b = scale / Math.Sqrt(2.0);
            var l = new Laplace(location, b);

            AssertHelpers.AlmostEqualRelative(l.Density(x), n.Density(x), 8);
            AssertHelpers.AlmostEqualRelative(l.DensityLn(x), n.DensityLn(x), 8);
        }
    public static void laplace_cdf_values_test()
    //****************************************************************************80
    //
    //  Purpose:
    //
    //    LAPLACE_CDF_VALUES_TEST tests LAPLACE_CDF_VALUES.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    12 June 2007
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        double beta = 0;
        double fx   = 0;
        double mu   = 0;
        double x    = 0;

        Console.WriteLine("");
        Console.WriteLine("LAPLACE_CDF_VALUES_TEST:");
        Console.WriteLine("  LAPLACE_CDF_VALUES returns values of ");
        Console.WriteLine("  the Laplace Cumulative Density Function.");
        Console.WriteLine("");
        Console.WriteLine("     Mu      Beta         X   CDF(X)");
        Console.WriteLine("");
        int n_data = 0;

        for (;;)
        {
            Laplace.laplace_cdf_values(ref n_data, ref mu, ref beta, ref x, ref fx);
            if (n_data == 0)
            {
                break;
            }

            Console.WriteLine("  "
                              + mu.ToString(CultureInfo.InvariantCulture).PadLeft(8) + "  "
                              + beta.ToString(CultureInfo.InvariantCulture).PadLeft(8) + "  "
                              + x.ToString(CultureInfo.InvariantCulture).PadLeft(8) + "  "
                              + fx.ToString("0.################").PadLeft(24) + "");
        }
    }
Example #20
0
        protected override void InitializeDecoding(string src, int passHash, int lsbIndicator)
        {
            base.InitializeDecoding(src, passHash, lsbIndicator);
            var filter = new Laplace(Bitmap, LsbIndicator, 8);
            IDictionary <Pixel, int> filtered = new Dictionary <Pixel, int>();

            for (var x = 0; x < Bitmap.Width; x++)
            {
                for (var y = 0; y < Bitmap.Height; y++)
                {
                    filtered.Add(new Pixel(x, y), filter.GetValue(x, y));
                }
            }
            mLaplaceValues = filtered.OrderByDescending(key => key.Value);
        }
Example #21
0
        private void GenerateShips()
        {
            var filter = new Laplace(Bitmap, LsbIndicator, 8);
            IDictionary <Pixel, int> filtered = new Dictionary <Pixel, int>();

            for (var x = 0; x < Bitmap.Width; x++)
            {
                for (var y = 0; y < Bitmap.Height; y++)
                {
                    filtered.Add(new Pixel(x, y), filter.GetValue(x, y));
                }
            }
            var ordered = filtered.OrderByDescending(key => key.Value);

            //TODO: dynamic maybe? Top 100
            mShips = new HashSet <Pixel>(ordered.Select((x, y) => x.Key).Take(50));
        }
        protected override double Calculation(LockBitmap originalBmp, LockBitmap steganoBmp)
        {
            var origFiltered  = new Laplace(originalBmp, 0, 8);
            var stegoFiltered = new Laplace(steganoBmp, 0, 8);
            var originalDiff  = 0.0;
            var totalDiff     = 0.0;

            for (var y = 0; y < originalBmp.Height; y++)
            {
                for (var x = 0; x < originalBmp.Width; x++)
                {
                    //TODO Shouldnt that be the other direction? First TOTAL and second ORIGINAL?
                    originalDiff += Math.Pow(origFiltered.GetValue(x, y) - stegoFiltered.GetValue(x, y), 2);
                    totalDiff    += Math.Pow(origFiltered.GetValue(x, y), 2);
                }
            }

            return(originalDiff / totalDiff);
        }
Example #23
0
        unsafe public static void Laplacian(ref int GridRef,
                                            ref int DgDegree,

                                            out int ierr)
        {
            try {
                // grid, etc
                // =========

                GridData grd = null;// (GridData)(Infrastructure.GetObject(GridRef));

                var b   = new Basis(grd, DgDegree);
                var map = new UnsetteledCoordinateMapping(b);

                var L  = new Laplace(1.3, grd.Cells.cj);
                var op = new SpatialOperator(1, 0, 1, QuadOrderFunc.Linear(), "T", "c1");
                op.EquationComponents["c1"].Add(L);
                op.Commit();

                // evaluate operator
                // =================

                var      Mtx = new BlockMsrMatrix(map, map);
                double[] B   = new double[map.LocalLength];

                var eval = op.GetMatrixBuilder(map, null, map);
                eval.ComputeMatrix(Mtx, B);

                // return data
                // ===========

                throw new NotImplementedException("todo");
            } catch (Exception e) {
                ierr = Infrastructure.ErrorHandler(e);
            }
            ierr = 0;
        }
Example #24
0
        public void CanSample()
        {
            var n = new Laplace();

            n.Sample();
        }
 public void ValidateStdDev(double location, double scale)
 {
     var n = new Laplace(location, scale);
     Assert.AreEqual(Math.Sqrt(2.0) * scale, n.StdDev);
 }
Example #26
0
        public void ValidateMinimum()
        {
            var n = new Laplace();

            Assert.AreEqual(Double.NegativeInfinity, n.Minimum);
        }
Example #27
0
        public void ValidateEntropy(double location, double scale)
        {
            var n = new Laplace(location, scale);

            Assert.AreEqual(Math.Log(2.0 * Constants.E * scale), n.Entropy);
        }
Example #28
0
 public void CanSampleSequence()
 {
     var n = new Laplace();
     var ied = n.Samples();
     ied.Take(5).ToArray();
 }
 public void CanCreateLaplace(double location, double scale)
 {
     var n = new Laplace(location, scale);
     Assert.AreEqual(location, n.Location);
     Assert.AreEqual(scale, n.Scale);
 }
Example #30
0
        public void ValidateMean(double location, double scale)
        {
            var n = new Laplace(location, scale);

            Assert.AreEqual(location, n.Mean);
        }
Example #31
0
 public void SetLocationFailsWithNegativeLocation()
 {
     var n = new Laplace();
     Assert.Throws<ArgumentOutOfRangeException>(() => n.Location = Double.NaN);
 }
 public void ValidateSkewness(double location, double scale)
 {
     var n = new Laplace(location, scale);
     Assert.AreEqual(0.0, n.Skewness);
 }
 public void ValidateMedian(double location, double scale)
 {
     var n = new Laplace(location, scale);
     Assert.AreEqual(location, n.Median);
 }
 public void ValidateDensityLn(double location, double scale, double x)
 {
     var n = new Laplace(location, scale);
     Assert.AreEqual(-Math.Log(2.0 * scale) - (Math.Abs(x - location) / scale), n.DensityLn(x));
 }
 public void ValidateCumulativeDistribution(double location, double scale, double x)
 {
     var n = new Laplace(location, scale);
     Assert.AreEqual(0.5 * (1.0 + (Math.Sign(x - location) * (1.0 - Math.Exp(-Math.Abs(x - location) / scale)))), n.CumulativeDistribution(x));
 }
Example #36
0
 public void ValidateMode(double location, double scale)
 {
     var n = new Laplace(location, scale);
     Assert.AreEqual<double>(location, n.Mode);
 }
Example #37
0
 public void SetScaleFailsWithNegativeScale(double scale)
 {
     var n = new Laplace();
     n.Scale = scale;
 }
Example #38
0
 public void SetScaleFailsWithNegativeScale([Values(0.0, -1.0, -5.0, Double.NegativeInfinity, Double.NaN)] double scale)
 {
     var n = new Laplace();
     Assert.Throws<ArgumentOutOfRangeException>(() => n.Scale = scale);
 }
Example #39
0
 public void CanSetLocation(double location)
 {
     var n = new Laplace();
     n.Location = location;
 }
 public void ValidateEntropy(double location, double scale)
 {
     var n = new Laplace(location, scale);
     Assert.AreEqual(Math.Log(2.0 * Constants.E * scale), n.Entropy);
 }
Example #41
0
 public void CanSample()
 {
     var n = new Laplace();
     n.Sample();
 }
Example #42
0
 public void ValidateDensityLn(
     [Values(0.0, 1.0, -1.0, 5.0, -5.0, Double.PositiveInfinity, Double.NegativeInfinity, 0.0, 1.0, -1.0, 5.0, -5.0, Double.PositiveInfinity, Double.NegativeInfinity, 0.0, 1.0, -1.0, 5.0, -5.0, Double.PositiveInfinity, Double.NegativeInfinity)] double location, 
     [Values(0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, Double.PositiveInfinity, Double.PositiveInfinity, Double.PositiveInfinity, Double.PositiveInfinity, Double.PositiveInfinity, Double.PositiveInfinity, Double.PositiveInfinity)] double scale, 
     [Values(1.5, 2.8, -5.4, -4.9, 2.0, 5.5, -0.0, Double.PositiveInfinity, 5.0, -1.0, -1.0, 2.5, 2.0, 15.0, 89.3, -0.1, 0.1, -6.1, -10.0, 2.0, -5.1)] double x)
 {
     var n = new Laplace(location, scale);
     Assert.AreEqual(-Math.Log(2.0 * scale) - (Math.Abs(x - location) / scale), n.DensityLn(x));
 }
Example #43
0
        public void ValidateStdDev(double location, double scale)
        {
            var n = new Laplace(location, scale);

            Assert.AreEqual(Constants.Sqrt2 * scale, n.StdDev);
        }
Example #44
0
 public void ValidateEntropy([Values(Double.NegativeInfinity, -5.0 - 1.0, 0.0, 1.0, 5.0, Double.PositiveInfinity)] double location, [Values(0.1, 1.0, 10.0, Double.PositiveInfinity)] double scale)
 {
     var n = new Laplace(location, scale);
     Assert.AreEqual(Math.Log(2.0 * Constants.E * scale), n.Entropy);
 }
Example #45
0
        public void ValidateSkewness(double location, double scale)
        {
            var n = new Laplace(location, scale);

            Assert.AreEqual(0.0, n.Skewness);
        }
Example #46
0
 public void ValidateMaximum()
 {
     var n = new Laplace();
     Assert.AreEqual(Double.PositiveInfinity, n.Maximum);
 }
Example #47
0
        public void ValidateMaximum()
        {
            var n = new Laplace();

            Assert.AreEqual(Double.PositiveInfinity, n.Maximum);
        }
Example #48
0
 public void ValidateMinimum()
 {
     var n = new Laplace();
     Assert.AreEqual(Double.NegativeInfinity, n.Minimum);
 }
 public void ValidateVariance(double location, double scale)
 {
     var n = new Laplace(location, scale);
     Assert.AreEqual(2.0 * scale * scale, n.Variance);
 }
Example #50
0
 public void ValidateSkewness([Values(Double.NegativeInfinity, -5.0 - 1.0, 0.0, 1.0, 5.0, Double.PositiveInfinity)] double location, [Values(0.1, 1.0, 10.0, Double.PositiveInfinity)] double scale)
 {
     var n = new Laplace(location, scale);
     Assert.AreEqual(0.0, n.Skewness);
 }
 public void SetScaleFailsWithNegativeScale(double scale)
 {
     var n = new Laplace();
     Assert.Throws<ArgumentOutOfRangeException>(() => n.Scale = scale);
 }
Example #52
0
 public void ValidateStdDev([Values(Double.NegativeInfinity, -5.0 - 1.0, 0.0, 1.0, 5.0, Double.PositiveInfinity)] double location, [Values(0.1, 1.0, 10.0, Double.PositiveInfinity)] double scale)
 {
     var n = new Laplace(location, scale);
     Assert.AreEqual(Math.Sqrt(2.0) * scale, n.StdDev);
 }
Example #53
0
 public void ValidateDensity(double location, double scale, double x)
 {
     var n = new Laplace(location, scale);
     Assert.AreEqual<double>(Math.Exp(-Math.Abs(x - location) / scale) / (2.0 * scale), n.Density(x));
 }
Example #54
0
 public void ValidateToString()
 {
     var n = new Laplace(-1.0, 2.0);
     Assert.AreEqual("Laplace(Location = -1, Scale = 2)", n.ToString());
 }
Example #55
0
 public void SetLocationFailsWithNegativeLocation(double location)
 {
     var n = new Laplace();
     n.Location = location;
 }
Example #56
0
 public void ValidateVariance([Values(Double.NegativeInfinity, -5.0 - 1.0, 0.0, 1.0, 5.0, Double.PositiveInfinity)] double location, [Values(0.1, 1.0, 10.0, Double.PositiveInfinity)] double scale)
 {
     var n = new Laplace(location, scale);
     Assert.AreEqual(2.0 * scale * scale, n.Variance);
 }
Example #57
0
 public void CanSetScale(double scale)
 {
     var n = new Laplace();
     n.Scale = scale;
 }
Example #58
0
 public void CanCreateLaplace()
 {
     var n = new Laplace();
     Assert.AreEqual(0.0, n.Location);
     Assert.AreEqual(1.0, n.Scale);
 }
Example #59
0
 public void ValidateCumulativeDistribution(
     [Values(0.0, 1.0, -1.0, 5.0, -5.0, Double.PositiveInfinity, Double.NegativeInfinity, 0.0, 1.0, -1.0, 5.0, -5.0, Double.PositiveInfinity, Double.NegativeInfinity, 0.0, 1.0, -1.0, 5.0, -5.0, Double.PositiveInfinity, Double.NegativeInfinity)] double location, 
     [Values(0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, Double.PositiveInfinity, Double.PositiveInfinity, Double.PositiveInfinity, Double.PositiveInfinity, Double.PositiveInfinity, Double.PositiveInfinity, Double.PositiveInfinity)] double scale, 
     [Values(1.5, 2.8, -5.4, -4.9, 2.0, 5.5, -0.0, Double.PositiveInfinity, 5.0, -1.0, -1.0, 2.5, 2.0, 15.0, 89.3, -0.1, 0.1, -6.1, -10.0, 2.0, -5.1)] double x)
 {
     var n = new Laplace(location, scale);
     Assert.AreEqual(0.5 * (1.0 + (Math.Sign(x - location) * (1.0 - Math.Exp(-Math.Abs(x - location) / scale)))), n.CumulativeDistribution(x));
 }
Example #60
0
 public void CanCreateLaplace([Values(Double.NegativeInfinity, -5.0 - 1.0, 0.0, 1.0, 5.0, Double.PositiveInfinity)] double location, [Values(0.1, 1.0, 10.0, Double.PositiveInfinity)] double scale)
 {
     var n = new Laplace(location, scale);
     Assert.AreEqual(location, n.Location);
     Assert.AreEqual(scale, n.Scale);
 }