Beispiel #1
0
        private void BtnOpenFile_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog FileOT = new OpenFileDialog();

            FileOT.Filter = "All files (*.*)|*.*|TXT text (*.txt)|*.txt";
            if (FileOT.ShowDialog() == true)
            {
                Stream ms = new FileStream(FileOT.FileName, FileMode.Open);
                lblNameFile.Content = FileOT.FileName;
                byte[] array = new byte[ms.Length];
                ms.Read(array, 0, array.Length);
                string buf = Encoding.Default.GetString(array);
                s = buf.ToLower();
            }
            sampleSource            = DiscriptiveStatistics.GetSample(s);
            tbDiscrStat_source.Text = DiscriptiveStatistics.Output_descriptive_statistics(sampleSource);
            tblSourceSample.Text    = DiscriptiveStatistics.Output(sampleSource);
        }
Beispiel #2
0
        private void Btn_Click(object sender, RoutedEventArgs e)
        {
            double k        = 43.2;
            int    interval = 31;
            int    colum    = 12;

            double[][] columArray = new double[colum][];
            double[][] points     = new double[colum][];
            double[][] xn         = new double[colum][];
            double[][] m_e        = new double[colum][];
            double[][] m_t        = new double[colum][];
            double[]   x2_arr     = new double[colum];

            for (int i = 0; i < colum; i++)
            {
                columArray[i] = DiscriptiveStatistics.GetSample(File.ReadAllText(@"C:\Users\Данагуль\source\repos\ТВМС\TVMS\Нормированные значения\" + (i + 1).ToString() + ".txt"));

                points[i] = point(columArray[i], interval);
                double[] me_buf = m_e[i] = Get_m_e(columArray[i], points[i], interval);
                xn[i] = Get_xn(columArray[i], points[i], interval);
                double[] mt_buf = m_t[i] = theoretical_freq(columArray[i], m_e[i].Sum(), xn[i], interval);

                for (int j = 0; j < mt_buf.Length; j++)
                {
                    x2_arr[i] += Math.Pow(me_buf[j] - mt_buf[j], 2) / mt_buf[j];
                }
            }
            #region Вывод
            tb0x.Text = x2_arr[1].ToString();
            if (x2_arr[1] < k)
            {
                tb0x.Text += "\nНормальное распределение";
            }
            else
            {
                tb0x.Text += "\nНе нормальное распределение";
            }

            tb1x.Text = x2_arr[2].ToString();
            if (x2_arr[2] < k)
            {
                tb1x.Text += "\nНормальное распределение";
            }
            else
            {
                tb1x.Text += "\nНе нормальное распределение";
            }

            tb2x.Text = x2_arr[3].ToString();
            if (x2_arr[3] < k)
            {
                tb2x.Text += "\nНормальное распределение";
            }
            else
            {
                tb2x.Text += "\nНе нормальное распределение";
            }

            tb3x.Text = x2_arr[4].ToString();
            if (x2_arr[4] < k)
            {
                tb3x.Text += "\nНормальное распределение";
            }
            else
            {
                tb3x.Text += "\nНе нормальное распределение";
            }

            tb4x.Text = x2_arr[5].ToString();
            if (x2_arr[5] < k)
            {
                tb4x.Text += "\nНормальное распределение";
            }
            else
            {
                tb4x.Text += "\nНе нормальное распределение";
            }

            tb5x.Text = x2_arr[6].ToString();
            if (x2_arr[6] < k)
            {
                tb5x.Text += "\nНормальное распределение";
            }
            else
            {
                tb5x.Text += "\nНе нормальное распределение";
            }

            tb6x.Text = x2_arr[7].ToString();
            if (x2_arr[7] < k)
            {
                tb6x.Text += "\nНормальное распределение";
            }
            else
            {
                tb6x.Text += "\nНе нормальное распределение";
            }

            tb7x.Text = x2_arr[8].ToString();
            if (x2_arr[8] < k)
            {
                tb7x.Text += "\nНормальное распределение";
            }
            else
            {
                tb7x.Text += "\nНе нормальное распределение";
            }

            tb8x.Text = x2_arr[9].ToString();
            if (x2_arr[9] < k)
            {
                tb8x.Text += "\nНормальное распределение";
            }
            else
            {
                tb8x.Text += "\nНе нормальное распределение";
            }

            tb9x.Text = x2_arr[10].ToString();
            if (x2_arr[10] < k)
            {
                tb9x.Text += "\nНормальное распределение";
            }
            else
            {
                tb9x.Text += "\nНе нормальное распределение";
            }

            tb10x.Text = x2_arr[11].ToString();
            if (x2_arr[11] < k)
            {
                tb10x.Text += "\nНормальное распределение";
            }
            else
            {
                tb10x.Text += "\nНе нормальное распределение";
            }

            #endregion
        }
Beispiel #3
0
        private void Btn_Click(object sender, RoutedEventArgs e)
        {
            columArray = new double[colum][];
            koeffPair  = new DenseMatrix(colum, colum);
            for (int i = 0; i < colum; i++)
            {
                columArray[i] = DiscriptiveStatistics.GetSample(File.ReadAllText(@"C:\Users\Данагуль\source\repos\ТВМС\TVMS\Нормированные значения\" + (i + 1).ToString() + ".txt"));
            }

            for (int i = 0; i < colum; i++)
            {
                for (int j = 0; j < colum; j++)
                {
                    koeffPair[i, j] = koeffPair[j, i] = DiscriptiveStatistics.PairKoeff(columArray[i], columArray[j]);
                }
            }

            DenseMatrix t_Matrix = T_Matrix_Koeff(koeffPair);

            tbMatrix.Text  = Output_R(koeffPair);
            tbMatrix.Text += "Коэффициент значим при t > 1.96\n";
            tbMatrix.Text += Output_R(t_Matrix);

            var X_Y = new List <KeyValuePair <double, double> >()
            {
                new KeyValuePair <double, double>(150 - 1, 0),
                new KeyValuePair <double, double>(225 - 1, 150 * (2 - Math.Sqrt(3)) / 2 - 1),
                new KeyValuePair <double, double>(300 - 150 * (2 - Math.Sqrt(3)) / 2 - 1, 75 - 1),
                new KeyValuePair <double, double>(300 - 1, 150 - 1),
                new KeyValuePair <double, double>(300 - 150 * (2 - Math.Sqrt(3)) / 2 - 1, 225 - 1),
                new KeyValuePair <double, double>(225 - 1, 300 - 150 * (2 - Math.Sqrt(3)) / 2 - 1),
                new KeyValuePair <double, double>(150 - 1, 300 - 1),
                new KeyValuePair <double, double>(75 - 1, 300 - 150 * (2 - Math.Sqrt(3)) / 2 - 1),
                new KeyValuePair <double, double>(150 * (2 - Math.Sqrt(3)) / 2 - 1, 225 - 1),
                new KeyValuePair <double, double>(0, 150 - 1),
                new KeyValuePair <double, double>(150 * (2 - Math.Sqrt(3)) / 2 - 1, 75 - 1),
                new KeyValuePair <double, double>(75 - 1, 150 * (2 - Math.Sqrt(3)) / 2 - 1)
            };

            foreach (KeyValuePair <double, double> x in X_Y)
            {
                Ellipse l = new Ellipse();
                l.Width = l.Height = 5;
                l.Fill  = Brushes.Red;
                Canvas.SetTop(l, x.Key);
                Canvas.SetLeft(l, x.Value);

                cnvMain.Children.Add(l);
            }
            for (int i = 0; i < colum; i++)
            {
                for (int j = i + 1; j < colum; j++)
                {
                    if (i != j && koeffPair[i, j] > 0.3 && koeffPair[i, j] < 0.5)
                    {
                        Line l = new Line();
                        l.X1              = X_Y[i].Key;
                        l.X2              = X_Y[j].Key;
                        l.Y1              = X_Y[i].Value;
                        l.Y2              = X_Y[j].Value;
                        l.Stroke          = Brushes.Red;
                        l.StrokeThickness = 1;
                        cnvMain.Children.Add(l);
                    }
                    if (i != j && koeffPair[i, j] > 0.5 && koeffPair[i, j] < 0.7)
                    {
                        Line l = new Line();
                        l.X1              = X_Y[i].Key;
                        l.X2              = X_Y[j].Key;
                        l.Y1              = X_Y[i].Value;
                        l.Y2              = X_Y[j].Value;
                        l.Stroke          = Brushes.Yellow;
                        l.StrokeThickness = 1;
                        cnvMain.Children.Add(l);
                    }
                    if (i != j && koeffPair[i, j] > 0.7 && koeffPair[i, j] < 1)
                    {
                        Line l = new Line();
                        l.X1              = X_Y[i].Key;
                        l.X2              = X_Y[j].Key;
                        l.Y1              = X_Y[i].Value;
                        l.Y2              = X_Y[j].Value;
                        l.Stroke          = Brushes.Green;
                        l.StrokeThickness = 1;
                        cnvMain.Children.Add(l);
                    }
                }
            }
        }