Exemple #1
0
        public void ValidateDensity(int shape, double invScale, double x, double pdf)
        {
            var n = new Erlang(shape, invScale);

            AssertHelpers.AlmostEqual(pdf, n.Density(x), 14);
            AssertHelpers.AlmostEqual(pdf, Erlang.PDF(shape, invScale, x), 14);
        }
Exemple #2
0
        private Dictionary <double, double> GetOverlayData(double step, Chart cherte)
        {
            var min         = cherte.Series[0].Points.Min(x => x.XValue);
            var max         = cherte.Series[0].Points.Max(x => x.XValue);
            var overlayData = new Dictionary <double, double>();
            Func <int, double, double> g = (tb, x) =>
            {
                switch (tabControl.SelectedIndex)
                {
                case 0:
                    return(1);

                case 1:
                    return(1 / (max - min));

                case 2:
                    return(Triangular.PDF(Convert.ToDouble(tb_tre_max.Text), Convert.ToDouble(tb_tre_min.Text), Convert.ToDouble(tb_tre_moda.Text), x));

                case 3:
                    return(Erlang.PDF(Convert.ToInt32(nUD_erl_kol_norm.Value), 1.0 / Convert.ToDouble(tb_erl_moda.Text), x));

                case 4:
                    return(Poisson.PMF(Convert.ToDouble(tb_puas_lambd.Text), (int)x));

                case 5:
                    return(Normal.PDF(Convert.ToDouble(tb_norm_m.Text), Convert.ToDouble(tb_norm_d.Text), x));

                case 6:
                    return(Exponential.PDF(1.0 / Convert.ToDouble(tb_exp_m.Text), x));

                default:
                    return(double.NaN);
                }
            };

            for (var x = min; x <= max; x += step)
            {
                overlayData[x] = g(tabControl.SelectedIndex, x);
            }
            return(overlayData);
        }