public void FitTest1()
        {
            double[] values =
            {
                0, 1, 2, 4, 2, 3, 5, 7, 4, 3, 2, 1, 4,
            };

            var exp = new ExponentialDistribution();

            exp.Fit(values);

            string actual;

            var cultureInfo = CultureInfo.GetCultureInfo("fr-FR");

#if NETCORE
            System.Globalization.CultureInfo.DefaultThreadCurrentCulture   = cultureInfo;
            System.Globalization.CultureInfo.DefaultThreadCurrentUICulture = cultureInfo;
#else
            Thread.CurrentThread.CurrentCulture = cultureInfo;
#endif
            actual = exp.ToString("G3", CultureInfo.InvariantCulture);
            Assert.AreEqual("Exp(x; λ = 0.342)", actual);

            actual = exp.ToString("G3");
            Assert.AreEqual("Exp(x; λ = 0,342)", actual);

            actual = exp.ToString(CultureInfo.InvariantCulture);
            Assert.AreEqual("Exp(x; λ = 0.342105263157895)", actual);

            actual = exp.ToString();
            Assert.AreEqual("Exp(x; λ = 0,342105263157895)", actual);
        }
Exemple #2
0
        public void FitTest1()
        {
            double[] values =
            {
                0, 1, 2, 4, 2, 3, 5, 7, 4, 3, 2, 1, 4,
            };

            var exp = new ExponentialDistribution();

            exp.Fit(values);

            string actual;

            Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("fr-FR");

            actual = exp.ToString("G3", CultureInfo.InvariantCulture);
            Assert.AreEqual("Exp(x; λ = 0.342)", actual);

            actual = exp.ToString("G3");
            Assert.AreEqual("Exp(x; λ = 0,342)", actual);

            actual = exp.ToString(CultureInfo.InvariantCulture);
            Assert.AreEqual("Exp(x; λ = 0.342105263157895)", actual);

            actual = exp.ToString();
            Assert.AreEqual("Exp(x; λ = 0,342105263157895)", actual);
        }
 private UnivariateContinuousDistribution FitDistribution(double [] samples)
 {
     if (samples.Length < 10)
     {
         return(new EmpiricalDistribution(samples));
     }
     else
     {
         var exp = new ExponentialDistribution(); // new LognormalDistribution(); //
         exp.Fit(samples);
         return(exp);
     }
 }
 public FuncionExponencial(double[] eventos) : base(eventos)
 {
     try
     {
         DistribucionContinua = new ExponentialDistribution();
         DistribucionContinua.Fit(eventos);
         this.L    = ((ExponentialDistribution)DistribucionContinua).Rate.ToString("0.0000");
         Resultado = new ResultadoAjuste(StringFDP, StringInversa, DistribucionContinua.StandardDeviation, DistribucionContinua.Mean, DistribucionContinua.Variance, this);
     }
     catch (Exception)
     {
         Resultado = null;
     }
 }
        public void FitTest1()
        {
            double[] values = 
            {
                0, 1, 2, 4, 2, 3, 5, 7, 4, 3, 2, 1, 4,
            };

            var exp = new ExponentialDistribution();

            exp.Fit(values);

            string actual;

            Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("fr-FR");

            actual = exp.ToString("G3", CultureInfo.InvariantCulture);
            Assert.AreEqual("Exp(x; λ = 0.342)", actual);

            actual = exp.ToString("G3");
            Assert.AreEqual("Exp(x; λ = 0,342)", actual);

            actual = exp.ToString(CultureInfo.InvariantCulture);
            Assert.AreEqual("Exp(x; λ = 0.342105263157895)", actual);

            actual = exp.ToString();
            Assert.AreEqual("Exp(x; λ = 0,342105263157895)", actual);
        }