Example #1
0
        private void SystUr_simple_Click(object sender, RoutedEventArgs e)
        {
            myM1.MatrWrite();
            myM2.MatrWrite();
            try
            {
                SystUrav s  = new SystUrav(myM1.matr.toQuadMatr(), myM2.matr);
                Fraction ep = new Fraction();
                ep.FractTxt = MyFuncs.convertToFract(eps.Text);
                Matr m = s.SimpleIterRoots(ep, int.Parse(SimpleIterTxt.Text));
                RezWnd          = new RezWindow();
                RezWnd.Owner    = this;
                RezWnd.Title    = "Корни системы уравнений";
                myMRez          = new MyMatr(ref RezWnd.MatrRezGrid, ref m, 5);
                myMRez.isDouble = (bool)isDbl.IsChecked;
                myMRez.Redraw();
                RezWnd.btnCopyTo1.Visibility = Visibility.Hidden;
                RezWnd.btnCopyTo2.Visibility = Visibility.Hidden;
                TextBox[,] b       = myMRez.GetMatrBx();
                b[0, 0].Text       = "корни";
                b[0, 0].FontWeight = FontWeights.Bold;
                b[0, 1].Text       = "" + '\x03B4';
                b[0, 1].FontWeight = FontWeights.Bold;
                b[0, 2].Text       = '\x03B4' + "(" + m.A[0, 2].FractTxt + ")";
                b[0, 2].FontWeight = FontWeights.Bold;
                //for (int i = 1; i < mRez.NRow; i++)
                //{
                //    if (b[i, 2].Text == "1")
                //    {
                //        b[i, 2].Text = "верно";
                //    }
                //    else
                //    {
                //        b[i, 2].Text = "неверно";
                //    }

                //}

                RezWnd.ShowDialog();
                myMRez = null;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #2
0
        private void SystUr_Click(object sender, RoutedEventArgs e)
        {
            myM1.MatrWrite();
            myM1.Redraw();
            myM2.MatrWrite();
            myM2.Redraw();
            try
            {
                SystUrav s = new SystUrav(myM1.matr.toQuadMatr(), myM2.matr);
                Matr     m = s.GaussRoots();
                RezWnd          = new RezWindow();
                RezWnd.Owner    = this;
                RezWnd.Title    = "Корни системы уравнений";
                myMRez          = new MyMatr(ref RezWnd.MatrRezGrid, ref m, 5);
                myMRez.isDouble = (bool)isDbl.IsChecked;
                myMRez.Redraw();
                RezWnd.btnCopyTo1.Visibility = Visibility.Hidden;
                RezWnd.btnCopyTo2.Visibility = Visibility.Hidden;
                TextBox[,] b       = myMRez.GetMatrBx();
                b[0, 0].Text       = "корни";
                b[0, 0].FontWeight = FontWeights.Bold;
                b[0, 1].Text       = "невязка";
                b[0, 1].FontWeight = FontWeights.Bold;
                b[0, 2].Text       = "верность";
                b[0, 2].FontWeight = FontWeights.Bold;
                for (int i = 1; i < myMRez.NRow; i++)
                {
                    if (b[i, 2].Text == "1")
                    {
                        b[i, 2].Text = "верно";
                    }
                    else
                    {
                        b[i, 2].Text = "неверно";
                    }
                }

                RezWnd.ShowDialog();
                myMRez = null;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }