Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            ExperimentalDataProvider data = new ExperimentalDataProvider();

            ExperimentalDataRecord r = data.getExperimentalData();
            double        pDov       = r.getP();
            List <double> m          = r.getArr();

            textBox1.Text = pDov.ToString();

            for (int i = 0; i < m.Count; i++)
            {
                textBox2.Text += m[i].ToString() + "\r\n";
            }

            List <double> xNew = Statistika.Calculation(data);

            for (int i = 0; i < xNew.Count; i++)
            {
                textBox3.Text += xNew[i].ToString() + "\r\n";
            }

            List <double> gran = Statistika.Bin(xNew);

            for (int i = 0; i < gran.Count; i++)
            {
                textBox4.Text += gran[i].ToString() + "\r\n";
            }

            Evaluation ev = Statistika.Probability(gran, xNew);

            List <double> mi = ev.getM();

            for (int i = 0; i < mi.Count; i++)
            {
                textBox5.Text += mi[i].ToString() + "\r\n";
            }

            List <double> Pi = ev.getP();

            for (int i = 0; i < Pi.Count; i++)
            {
                textBox6.Text += Pi[i].ToString() + "\r\n";
            }

            List <double> pi = ev.getp();

            for (int i = 0; i < pi.Count; i++)
            {
                textBox7.Text += pi[i].ToString() + "\r\n";
            }
        }
Example #2
0
        // ExperimentalDataProvider p = new ExperimentalDataProvider();

        public static List <double> Calculation(ExperimentalDataProvider data)
        {
            ExperimentalDataRecord r = data.getExperimentalData();
            double        pDov       = r.getP();
            List <double> x          = r.getArr();
            double        z          = 1.65;//не забудь реализовать подборку z
            List <double> xNew       = new List <double>();

            // List<double> xNew = x;

            //while (xNew.Count != x.Count)
            for (int j = 0; j < 4; j++)
            {
                xNew.Clear();
                int           n      = x.Count;
                double        xAvg   = 0;                   //среднее массива Х
                double        sigma  = 0;                   //среднеквадратическое значение х
                List <double> xDelta = new List <double>(); //разница м/у значениями х и средним

                for (int i = 0; i < n; i++)
                {
                    xAvg += x[i];
                }
                xAvg = xAvg / n;

                for (int i = 0; i < n; i++)
                {
                    xDelta.Add(0);
                }

                for (int i = 0; i < n; i++)
                {
                    xDelta[i] = x[i] - xAvg;
                }

                for (int i = 0; i < n; i++)
                {
                    sigma += (x[i] - xAvg) * (x[i] - xAvg);
                }
                sigma = Math.Sqrt(sigma / (n - 1));

                double zs = z * sigma;
                for (int i = 0; i < n; i++)
                {
                    if (Math.Abs(xDelta[i]) < zs)
                    {
                        xNew.Add(x[i]);
                    }
                }

                x.Clear();
                for (int i = 0; i < xNew.Count; i++)
                {
                    x.Add(xNew[i]);
                }
            }

            x.Sort();

            return(x);
        }