Ejemplo n.º 1
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("Матрица должна быть квадратной");
     }
 }
Ejemplo n.º 2
0
        public Table(ref Grid g, ref Matr m, int sp, string zapoln = "") : base(ref g, ref m, sp, zapoln)
        {
            for (int i = 0; i < this.NCol; i++)
            {
                this.txtBxs[0, i].IsEnabled  = false;
                this.txtBxs[0, i].Background = br;
                if (i == 0 || i == 1)
                {
                    for (int j = 1; j < this.NRow; j++)
                    {
                        this.txtBxs[j, i].Background = brc;
                    }
                }
                switch (i)
                {
                case 0:
                    this.txtBxs[0, i].Text = "X";
                    break;

                case 1:
                    this.txtBxs[0, i].Text = "Y";
                    break;

                case 2:
                    this.txtBxs[0, i].Text = '\u2206' + "Y";
                    break;

                default:
                    this.txtBxs[0, i].Text = '\u2206' + "" + (i - 1) + "Y";
                    break;
                }
            }
        }
Ejemplo n.º 3
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);
     }
 }
Ejemplo n.º 4
0
 private void SystUr_Orto_Click(object sender, RoutedEventArgs e)
 {
     myM1.MatrWrite();
     myM2.MatrWrite();
     SystUrav sr = new SystUrav((QuadMatr)myM1.matr, myM2.MyMatrToMatr());
     Matr     r  = sr.OrtoRoots();
 }
Ejemplo n.º 5
0
        public MyMatr(ref Grid g, ref Matr m, int sp, string zapoln = "")
        {
            g.Children.Clear();
            this.zapoln = zapoln;
            this.g      = g;
            this.matr   = m;
            this.nRow   = m.NRow;
            this.nCol   = m.NCol;
            this.sp     = sp;
            double hMar, vMar, bW, bH;

            bW = (g.Width - (nCol + 1) * sp) / nCol;
            bH = (g.Height - (nRow + 1) * sp) / nRow;
            if (bH > bW)
            {
                bH = bW;
            }
            else
            {
                bW = bH;
            }
            hMar   = (g.Width - sp * (nCol + 1) - bW * nCol) / 2;
            vMar   = (g.Height - sp * (nRow + 1) - bH * nRow) / 2;
            txtBxs = new TextBox[nRow, nCol];
            for (int i = 1; i <= nRow; i++)
            {
                for (int j = 1; j <= nCol; j++)
                {
                    TextBox txtBx = new TextBox();
                    txtBx.LostFocus     += new RoutedEventHandler(TextBox_LostFocus);
                    txtBx.GotFocus      += new RoutedEventHandler(TextBox_GotFocus);
                    txtBxs[i - 1, j - 1] = txtBx;
                    txtBx.Name           = g.Name + "_txtBx" + i + "_" + j;
                    if (this.isDouble)
                    {
                        txtBx.Text = "" + matr.A[i - 1, j - 1].ToDouble();
                    }
                    else
                    {
                        txtBx.Text = matr.A[i - 1, j - 1].FractTxt;
                    }
                    txtBx.Width                    = bW;
                    txtBx.Height                   = bH;
                    txtBx.VerticalAlignment        = VerticalAlignment.Top;
                    txtBx.HorizontalAlignment      = HorizontalAlignment.Left;
                    txtBx.TextAlignment            = TextAlignment.Center;
                    txtBx.VerticalContentAlignment = VerticalAlignment.Center;
                    txtBx.TextWrapping             = TextWrapping.Wrap;
                    txtBx.FontSize                 = txtBx.Height / FontMult;
                    Thickness myTh = new Thickness();
                    myTh.Left    = hMar + sp * j + txtBx.Width * (j - 1);
                    myTh.Top     = vMar + sp * i + txtBx.Height * (i - 1);
                    txtBx.Margin = myTh;

                    g.Children.Add(txtBx);
                }
            }
        }
Ejemplo n.º 6
0
 public PriblWindow()
 {
     InitializeComponent();
     tblMatr          = new Matr(int.Parse(tblRows.Text) + 1, int.Parse(tblRows.Text) + 1);
     tabl             = new Table(ref GrdFunc, ref tblMatr, 2);
     tblIspRow.maxVal = tabl.NRow - 1;
     Poryadok.maxVal  = tabl.NCol - 2;
     myWeb.NavigateToString("<h1>Test</h1>");
     txtPolynom.Text = MyFuncs.diffUr("y(1)=(2/x)*y+x", new Fraction(), new Fraction(1, 1), new Fraction(1, 20), new Fraction(3, 2)).FractTxt;
 }
Ejemplo n.º 7
0
        private void SwapMatr_Click(object sender, RoutedEventArgs e)
        {
            myM1.MatrWrite();
            myM2.MatrWrite();
            Matr ms = myM1.matr;

            myM1.matr = myM2.matr;
            myM2.matr = ms;
            myM1.Redraw();
            myM2.Redraw();
        }
Ejemplo n.º 8
0
        public Matr GetGaussRootsMatr()
        {
            Matr x  = new Matr(this.nUr, 1);
            Matr rt = GaussRoots();

            for (int i = 0; i < this.nUr; i++)
            {
                x.A[i, 0] = rt.A[i + 1, 0].CopyFr;
            }
            return(x);
        }
Ejemplo n.º 9
0
        public Matr GaussRoots()
        {
            //начало
            Matr x = new Matr(this.nUr + 1, 3);
            //этап 1
            Fraction m = new Fraction();

            for (int shag = 0; shag < this.nUr - 1; shag++)
            {
                for (int i = shag + 1; i < this.nUr; i++)
                {
                    m = this.a.A[i, shag] / this.a.A[shag, shag];
                    for (int j = 0; j < this.nUr; j++)
                    {
                        this.a.A[i, j] = this.a.A[i, j] - m * this.a.A[shag, j];
                    }
                    this.b.A[i, 0] = this.b.A[i, 0] - m * this.b.A[shag, 0];
                }
            }
            //этап 2
            m.FractTxt       = "0";
            x.A[this.nUr, 0] = this.b.A[this.nUr - 1, 0] / this.a.A[this.nUr - 1, this.nUr - 1];
            for (int i = 0; i <= this.nUr - 1; i++)
            {
                for (int j = 0; j < i; j++)
                {
                    m += this.a.A[this.nUr - i - 1, this.nUr - j - 1] * x.A[this.nUr - j, 0];
                }
                x.A[this.nUr - i, 0] = (this.b.A[this.nUr - i - 1, 0] - m) / this.a.A[this.nUr - i - 1, this.nUr - i - 1];
                m.FractTxt           = "0";
            }
            //этап 3
            for (int i = 0; i < this.nUr; i++)
            {
                m.FractTxt = "0";
                for (int k = 0; k < this.nUr; k++)
                {
                    m += this.a.A[i, k] * x.A[k + 1, 0];
                }
                x.A[i + 1, 1] = m - this.b.A[i, 0];

                if (x.A[i + 1, 1] == 0 || Abs(x.A[i + 1, 1].ToDouble()) < 0.001)
                {
                    x.A[i + 1, 2].FractTxt = "1";
                }
                else
                {
                    x.A[i + 1, 2].FractTxt = "0";
                }
            }
            return(x);
        }
Ejemplo n.º 10
0
        public Matr MyMatrToMatr()
        {
            Matr m = new Matr(this.NRow, this.nCol);

            for (int i = 0; i < this.NRow; i++)
            {
                for (int j = 0; j < this.nCol; j++)
                {
                    m.A[i, j].FractTxt = this.txtBxs[i, j].Text;
                }
            }
            return(m);
        }
Ejemplo n.º 11
0
        public Matr CopyMatr()
        {
            Matr rez = new Matr(this.nRow, this.nCol);

            for (int i = 0; i < this.nRow; i++)
            {
                for (int j = 0; j < this.nCol; j++)
                {
                    rez.A[i, j] = this.A[i, j].CopyFr;
                }
            }
            return(rez);
        }
Ejemplo n.º 12
0
        public static Matr operator *(Fraction fr, Matr m1)
        {
            Matr rez = new Matr(m1.nRow, m1.nCol);

            for (int i = 0; i < m1.nRow; i++)
            {
                for (int j = 0; j < m1.nCol; j++)
                {
                    rez.A[i, j] = m1.A[i, j] * fr;
                }
            }
            return(rez);
        }
Ejemplo n.º 13
0
 public SystUrav(QuadMatr m1, Matr m2)
 {
     if (m1.NRow == m1.NCol && m2.NCol == 1 && m1.NRow == m2.NRow)
     {
         this.a   = m1.CopyMatr();
         this.b   = m2.CopyMatr();
         this.nUr = m1.NRow;
     }
     else
     {
         throw new Exception("Неверная компоновка матриц для системы уравнений!");
     }
 }
Ejemplo n.º 14
0
        public Matr InverseIterMetod(Fraction lambda, Matr x0)
        {
            Matr     rez = new Matr(this.nRow, 1);
            QuadMatr em  = new QuadMatr(this.nRow);

            em.setEMatr();
            rez = x0.CopyMatr();
            for (int i = 0; i < 2; i++)
            {
                SystUrav su = new SystUrav(this - lambda * em, rez);
                rez = su.GetGaussRootsMatr();
            }
            return(rez);
        }
Ejemplo n.º 15
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;
 }
Ejemplo n.º 16
0
        public Matr OrtoRoots()
        {
            QuadMatr t   = new QuadMatr(this.nUr);
            QuadMatr r   = new QuadMatr(this.nUr);
            Matr     rR  = new Matr(1, this.nUr);
            Matr     rR2 = new Matr(1, this.nUr);
            Matr     rC  = new Matr(this.nUr, 1);
            Matr     aC  = new Matr(this.nUr, 1);
            Matr     aR  = new Matr(this.nUr, 1);

            t.setEMatr();
            try
            {
                for (int j = 0; j < this.nUr; j++)
                {
                    aC = Matr.CopyColMatr(this.a, j);
                    for (int i = 0; i < this.nUr; i++)
                    {
                        r.A[i, j]  = this.a.A[i, j].CopyFr;
                        rR.A[0, j] = r.A[i, j].CopyFr;
                        rC.A[i, 0] = this.a.A[i, j].CopyFr;
                    }

                    for (int i = j + 1; i < this.nUr; i++)
                    {
                        aC = Matr.CopyColMatr(this.a, i);
                        for (int n = 0; n < this.nUr; n++)
                        {
                            aR.A[0, n] = aC.A[n, 0].CopyFr;
                        }
                        aC = Matr.CopyColMatr(this.a, i);

                        if (j == 0)
                        {
                            t.A[j, i] = (rR * aC).A[0, 0] / (rR * rC).A[0, 0];
                        }
                        else
                        {
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show(ex.Message);
            }
            return(new Matr());
        }
Ejemplo n.º 17
0
 public static Matr CopyRowMatr(Matr m, int Row)
 {
     if (Row <= m.nRow)
     {
         Matr rez = new Matr(1, m.nCol);
         for (int j = 0; j < m.nCol; j++)
         {
             rez.A[0, j] = m.A[Row, j].CopyFr;
         }
         return(rez);
     }
     else
     {
         throw new Exception("Номер строки должен быть не больше количества строк матрицы!");
     }
 }
Ejemplo n.º 18
0
 public static Matr CopyColMatr(Matr m, int Col)
 {
     if (Col <= m.nCol)
     {
         Matr rez = new Matr(m.nRow, 1);
         for (int i = 0; i < m.nRow; i++)
         {
             rez.A[i, 0] = m.A[i, Col].CopyFr;
         }
         return(rez);
     }
     else
     {
         throw new Exception("Номер столбца должен быть не больше количества столбцов матрицы!");
     }
 }
Ejemplo n.º 19
0
        public static Matr operator-(Matr m1, Matr m2)
        {
            if (m1.nCol != m2.nCol || m1.nRow != m2.nRow)
            {
                throw new Exception("Размерности матриц не совпадают");
            }
            Matr rez = new Matr(m2.nRow, m2.nCol);

            for (int i = 0; i < m2.nRow; i++)
            {
                for (int j = 0; j < m2.nCol; j++)
                {
                    rez.A[i, j] = m1.A[i, j] - m2.A[i, j];
                }
            }
            return(rez);
        }
Ejemplo n.º 20
0
 private void SobstChisla_Click(object sender, RoutedEventArgs e)
 {
     myM1.MatrWrite();
     myM2.MatrWrite();
     try
     {
         //SystUrav s = new SystUrav(m1.MyMatrToQuadMatr(), m2.MyMatrToMatr());
         QuadMatr x  = myM1.matr.toQuadMatr();
         Fraction fr = new Fraction();
         fr.FractTxt = MyFuncs.convertToFract(lambda.Text);
         Matr lbd = x.InverseIterMetod(fr, myM2.MyMatrToMatr());
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Ejemplo n.º 21
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);
            }
        }
Ejemplo n.º 22
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);
            }
        }
Ejemplo n.º 23
0
 public static Matr operator *(Matr m1, Matr m2)
 {
     if (m1.nCol == m2.nRow)
     {
         Matr rez = new Matr(m1.nRow, m2.nCol);
         for (int i = 0; i < m1.nRow; i++)
         {
             for (int j = 0; j < m2.nCol; j++)
             {
                 for (int g = 0; g < m2.nRow; g++)
                 {
                     rez.A[i, j] += m1.A[i, g] * m2.A[g, j];
                 }
             }
         }
         return(rez);
     }
     else
     {
         throw new Exception("Количество столбцов матрицы1 должно быть равно количеству строк матрицы2!");
     }
 }
Ejemplo n.º 24
0
        public void DrawCircles(Matr m)
        {
            double   mult = 1;
            Fraction r    = new Fraction();
            Fraction a    = new Fraction();

            for (int i = 0; i < m.NCol; i++)
            {
                for (int j = 0; j < m.NCol; j++)
                {
                    if (i != j)
                    {
                        a = m.A[i, j].CopyFr;
                        if (a < 0)
                        {
                            a = -1 * a;
                        }
                        r += a;
                    }
                }
                a = m.A[i, i].CopyFr;
                if (Math.Min((grdGraf.Width - 40) / (2 * (r + (a < 0 ? -1 * a : a))).ToDouble(), (grdGraf.Height - 40) / (2 * r).ToDouble()) <= mult || mult == 1)
                {
                    mult = Math.Min((grdGraf.Width - 40) / (2 * (r + (a < 0 ? -1 * a : a))).ToDouble(), (grdGraf.Height - 40) / (2 * r).ToDouble());
                }
                r.FractTxt = "0";
                a.FractTxt = "0";
            }

            for (int i = 0; i < m.NCol; i++)
            {
                for (int j = 0; j < m.NCol; j++)
                {
                    if (i != j)
                    {
                        a = m.A[i, j].CopyFr;
                        if (a < 0)
                        {
                            a = -1 * a;
                        }
                        r += a;
                    }
                }
                a = m.A[i, i].CopyFr;
                Ellipse   el   = new Ellipse();
                TextBlock xVal = new TextBlock();
                TextBlock rT   = new TextBlock();
                Line      rad  = new Line();
                el.Stroke                = Brushes.Black;
                rad.Stroke               = Brushes.Red;
                rad.StrokeThickness      = 3;
                xVal.Width               = 60;
                el.HorizontalAlignment   = HorizontalAlignment.Left;
                xVal.HorizontalAlignment = HorizontalAlignment.Left;
                rT.HorizontalAlignment   = HorizontalAlignment.Left;
                el.VerticalAlignment     = VerticalAlignment.Top;
                xVal.VerticalAlignment   = VerticalAlignment.Top;
                rT.VerticalAlignment     = VerticalAlignment.Top;
                el.Margin                = new Thickness(grdGraf.Width / 2 - mult * r.ToDouble() + mult * a.ToDouble(), grdGraf.Height / 2 - mult * r.ToDouble(), 0, 0);
                xVal.Margin              = new Thickness(grdGraf.Width / 2 + mult * a.ToDouble() - xVal.Width / 2, grdGraf.Height / 2 + 10, 0, 0);
                rT.Margin                = new Thickness(grdGraf.Width / 2 + mult * a.ToDouble(), grdGraf.Height / 2 - mult * r.ToDouble() - 20, 0, 0);
                rad.X1 = rad.X2 = grdGraf.Width / 2 + mult * a.ToDouble();
                rad.Y1 = grdGraf.Height / 2;
                rad.Y2 = grdGraf.Height / 2 - mult * r.ToDouble();

                xVal.Text          = "" + a.ToDouble();
                rT.Text            = "r" + (i + 1) + " = " + r.ToDouble();
                xVal.TextAlignment = TextAlignment.Center;
                el.Width           = mult * r.ToDouble() * 2;
                el.Height          = mult * r.ToDouble() * 2;
                grdGraf.Children.Add(el);
                grdGraf.Children.Add(xVal);
                grdGraf.Children.Add(rad);
                grdGraf.Children.Add(rT);
                r.FractTxt = "0";
            }
        }
Ejemplo n.º 25
0
        public Matr SimpleIterRoots(Fraction eps, long nIter = 0)
        {
            Matr     beta  = new Matr(this.b.NRow, this.b.NCol);
            Matr     alfa  = new Matr(this.a.NRow, this.a.NCol);
            Matr     x     = new Matr(this.b.NRow + 1, 3);
            Matr     x2    = new Matr(this.b.NRow, 1);
            Fraction norm  = new Fraction();
            Fraction delta = new Fraction();
            Fraction err   = new Fraction();

            for (int i = 0; i < this.b.NRow; i++)
            {
                beta.A[i, 0].FractTxt  = (this.b.A[i, 0] / this.a.A[i, i]).FractTxt;
                x.A[i + 1, 0].FractTxt = (this.b.A[i, 0] / this.a.A[i, i]).FractTxt;
                for (int j = 0; j < this.b.NRow; j++)
                {
                    if (i == j)
                    {
                        alfa.A[i, j].FractTxt = beta.A[i, 0].FractTxt;;
                    }
                    else
                    {
                        alfa.A[i, j].FractTxt = (-1 * this.a.A[i, j] / this.a.A[i, i]).FractTxt;
                        delta += alfa.A[i, j].frAbs();
                    }
                }
                if (norm == 0)
                {
                    norm.FractTxt = delta.FractTxt;
                }
                else
                {
                    if (norm < delta)
                    {
                        norm.FractTxt = delta.FractTxt;
                    }
                }
                delta.FractTxt = "0";
            }
            delta = eps * (1 - norm) / norm;
            if (nIter == 0)
            {
                while (err > delta || err == 0)
                {
                    for (int i = 0; i < this.a.NRow; i++)
                    {
                        for (int j = 0; j < this.a.NCol; j++)
                        {
                            if (i != j)
                            {
                                x2.A[i, 0] += alfa.A[i, j] * x.A[j + 1, 0];
                            }
                            else
                            {
                                x2.A[i, 0] += alfa.A[i, j];
                            }
                        }
                    }
                    ///////////////////////////////////////////////////
                    err.FractTxt = "0";
                    for (int i = 0; i < this.a.NRow; i++)
                    {
                        if (err == 0)
                        {
                            err = (x2.A[i, 0] - x.A[i + 1, 0]).frAbs();
                        }
                        else
                        {
                            if (err < (x2.A[i, 0] - x.A[i + 1, 0]).frAbs())
                            {
                                err = (x2.A[i, 0] - x.A[i + 1, 0]).frAbs();
                            }
                        }
                    }
                    ///////////////////////////////////////////////////
                    for (int i = 0; i < this.a.NRow; i++)
                    {
                        x.A[i + 1, 0].FractTxt = x2.A[i, 0].FractTxt;
                        x.A[i + 1, 2].FractTxt = err.FractTxt;

                        x2.A[i, 0].FractTxt = "0";
                    }
                    nIter++;
                    x.A[0, 2].FractTxt = "" + nIter;
                }
            }
            else
            {
                for (int n = 0; n < nIter; n++)
                {
                    for (int i = 0; i < this.a.NRow; i++)
                    {
                        for (int j = 0; j < this.a.NCol; j++)
                        {
                            if (i != j)
                            {
                                x2.A[i, 0] += alfa.A[i, j] * x.A[j + 1, 0];
                            }
                            else
                            {
                                x2.A[i, 0] += alfa.A[i, j];
                            }
                        }
                    }
                    ///////////////////////////////////////////////////
                    err.FractTxt = "0";
                    for (int i = 0; i < this.a.NRow; i++)
                    {
                        if (err == 0)
                        {
                            err = (x2.A[i, 0] - x.A[i + 1, 0]).frAbs();
                        }
                        else
                        {
                            if (err < (x2.A[i, 0] - x.A[i + 1, 0]).frAbs())
                            {
                                err = (x2.A[i, 0] - x.A[i + 1, 0]).frAbs();
                            }
                        }
                    }
                    ///////////////////////////////////////////////////
                    for (int i = 0; i < this.a.NRow; i++)
                    {
                        x.A[i + 1, 0].FractTxt = x2.A[i, 0].FractTxt;
                        x.A[i + 1, 2].FractTxt = err.FractTxt;

                        x2.A[i, 0].FractTxt = "0";
                    }
                }
            }
            for (int i = 0; i < this.a.NRow; i++)
            {
                x.A[i + 1, 1].FractTxt = delta.FractTxt;
            }
            x.A[0, 2].FractTxt = "" + nIter;
            return(x);
        }