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); } }
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("Матрица должна быть квадратной"); } }
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); } }
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); } }