Exemplo n.º 1
0
 private void btnMult_Click(object sender, RoutedEventArgs e)
 {
     myM1.MatrWrite();
     myM1.Redraw();
     myM2.MatrWrite();
     myM2.Redraw();
     try
     {
         Matr m = myM1.MyMatrToMatr() * myM2.MyMatrToMatr();
         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.Click += btnCopyTo1_Click;
         RezWnd.btnCopyTo2.Click += btnCopyTo2_Click;
         RezWnd.ShowDialog();
         myMRez = null;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 2
0
 private void btnFrobMatr_Click(object sender, RoutedEventArgs e)
 {
     myM1.MatrWrite();
     myM1.Redraw();
     if (myM1.NCol == myM1.NRow)
     {
         try
         {
             Matr m = myM1.matr.toQuadMatr().getFrobeniusMatr();
             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.Click += btnCopyTo1_Click;
             RezWnd.btnCopyTo2.Click += btnCopyTo2_Click;
             RezWnd.ShowDialog();
             myMRez = null;
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
     else
     {
         MessageBox.Show("Матрица должна быть квадратной");
     }
 }
Exemplo n.º 3
0
 public MatrWindow()
 {
     InitializeComponent();
     m1            = new Matr(int.Parse(Sp1_1Txt.Text), int.Parse(Sp1_2Txt.Text));
     m2            = new Matr(int.Parse(Sp2_1Txt.Text), int.Parse(Sp2_2Txt.Text));
     myM1          = new MyMatr(ref Matr1Grid, ref m1, 5);
     myM2          = new MyMatr(ref Matr2Grid, ref m2, 5);
     myM1.isDouble = (bool)isDbl.IsChecked;
     myM2.isDouble = (bool)isDbl.IsChecked;
     Sp1_1Txt.Text = "" + myM1.NRow;
     Sp1_2Txt.Text = "" + myM1.NCol;
     Sp2_1Txt.Text = "" + myM2.NRow;
     Sp2_2Txt.Text = "" + myM2.NCol;
 }
Exemplo n.º 4
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);
            }
        }
Exemplo n.º 5
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);
            }
        }