Exemple #1
0
        private void OK_Click(object sender, EventArgs e)
        {
            bool t = true;

            try
            {
                for (int i = 0; i < n; i++)
                {
                    for (int j = 0; j < n; j++)
                    {
                        MainMatrix[i, j] = Convert.ToDouble(dataGridView1[j, i].Value);
                    }
                }
                for (int i = 0; i < n; i++)
                {
                    MainVector[i] = Convert.ToDouble(dataGridView1[n, i].Value);
                }
            }
            catch { MessageBox.Show("Ошибка!!! введите все ячейки в формате Double!!! пустых быть не должно!"); t = false; }
            if (t)
            {
                this.Hide();
                PrIterMethod pr = new PrIterMethod();
                Form2        f2 = new Form2(n, epsilon, pr.IterForm(MainMatrix, MainVector, n), pr.C2);

                f2.ShowDialog();
            }
        }
Exemple #2
0
        private void OK2_Click(object sender, EventArgs e)
        {
            PrIterMethod pr = new PrIterMethod();

            Double[,] C = MainMatrix;

            Double[] X = new Double[n];
            Double[] d = MainVector;

            if (!pr.ProverkaShod(C, n))
            {
                MessageBox.Show("Данная система не удовлетворяет условию сходимости!!");
            }
            else
            {
                X = pr.MethodI(C, d, n, epsilon);
                // Form2 f2 = new Form2(n, epsilon,C,X);
                //f2.ShowDialog();
                string s = "решение системы равно вектору: {";
                for (int i = 0; i < n; i++)
                {
                    s += X[i] + "; ";
                }
                s += "}";
                MessageBox.Show(s);
                this.Close();
            }
        }