예제 #1
0
파일: Form3.cs 프로젝트: Gourdji19/TerVer2
        private void button1_Click(object sender, EventArgs e)
        {
            dataGridView1.RowCount = 2;
            int cols = 0;

            if (Convert.ToInt32(textBox2.Text) < 500)
            {
                cols = Convert.ToInt32(textBox2.Text);
            }
            else
            {
                cols = 500;
            }
            dataGridView1.ColumnCount = cols;
            elem = new GenValues((float)Convert.ToDouble(textBox1.Text), cols);
            for (int i = 0; i < cols; i++)
            {
                elem.GenVal(elem.GetRandomValue());
            }
            elem.GetVal();
            for (int i = 0; i < cols; i++)
            {
                dataGridView1.Rows[0].Cells[i].Value = "x" + (i + 1);
                dataGridView1.Rows[1].Cells[i].Value = elem.val[i].ToString();
            }
            //заполнение таблицы числовых характеристик
            //значения
            dataGridView2.RowCount               = 2;
            dataGridView2.ColumnCount            = 8;
            dataGridView2.Rows[1].Cells[0].Value = elem.MathExpectation().ToString();
            dataGridView2.Rows[1].Cells[1].Value = elem.SampleMean().ToString();
            dataGridView2.Rows[1].Cells[2].Value = Math.Abs(elem.MathExpectation() - elem.SampleMean()).ToString();
            dataGridView2.Rows[1].Cells[3].Value = elem.SampleDispersion().ToString();
            dataGridView2.Rows[1].Cells[4].Value = elem.TheoreticalDispersion().ToString();
            dataGridView2.Rows[1].Cells[5].Value = Math.Abs(elem.SampleDispersion() - elem.TheoreticalDispersion()).ToString();
            dataGridView2.Rows[1].Cells[6].Value = elem.SampleMedian().ToString();
            dataGridView2.Rows[1].Cells[7].Value = elem.SampleScope().ToString();

            string s1 = "Eη",
                   s2 = "x",
                   s3 = "|Eη - x|",
                   s4 = "Dη",
                   s5 = "S2",
                   s6 = "|Dη - S2|",
                   s7 = "Me",
                   s8 = "R";

            dataGridView2.Rows[0].Cells[0].Value = s1;
            dataGridView2.Rows[0].Cells[1].Value = s2;
            dataGridView2.Rows[0].Cells[2].Value = s3;
            dataGridView2.Rows[0].Cells[3].Value = s4;
            dataGridView2.Rows[0].Cells[4].Value = s5;
            dataGridView2.Rows[0].Cells[5].Value = s6;
            dataGridView2.Rows[0].Cells[6].Value = s7;
            dataGridView2.Rows[0].Cells[7].Value = s8;
        }
예제 #2
0
파일: Form3.cs 프로젝트: Gourdji19/TerVer1
        private void button1_Click(object sender, EventArgs e)
        {
            dataGridView1.RowCount    = 2;
            dataGridView1.ColumnCount = Convert.ToInt32(textBox2.Text);
            elem = new GenValues((float)Convert.ToDouble(textBox1.Text), Convert.ToInt32(textBox2.Text));
            for (int i = 0; i < Convert.ToInt32(textBox2.Text); i++)
            {
                elem.GenVal(elem.GetRandomValue());
            }
            elem.GetVal();

            for (int i = 0; i < Convert.ToInt32(textBox2.Text); i++)
            {
                dataGridView1.Rows[0].Cells[i].Value = "x" + (i + 1);
                dataGridView1.Rows[1].Cells[i].Value = elem.val[i].ToString();
            }
        }