SharedLygciu_sistemos_1.sagewsOpen in CoCalc
Author: Paulius Drungilas
Views : 11
Išspręsime lygčių sistemą {x1+x2+2x3+x4=73x1+4x2+8x3+5x4=29x1+3x2+7x3+8x4=302x1+2x2+5x3+6x4=23 \left\{\begin{array}{ll} x_{1}+x_{2}+2x_{3}+x_{4} &=7\\ 3x_{1}+4x_{2}+8x_{3}+5x_{4} &=29\\ x_{1}+3x_{2}+7x_{3}+8x_{4} &=30\\ 2x_{1}+2x_{2}+5x_{3}+6x_{4} &=23 \end{array}\right. Gauso metodu.
Sukuriame sistemos matricą AA:
A = matrix(QQ, 4, 4, [[1, 1, 2, 1], [3, 4, 8, 5], [1, 3, 7, 8], [2, 2, 5, 6]]) show(A)
(1121348513782256)\displaystyle \left(\begin{array}{rrrr} 1 & 1 & 2 & 1 \\ 3 & 4 & 8 & 5 \\ 1 & 3 & 7 & 8 \\ 2 & 2 & 5 & 6 \end{array}\right)
latex(A)
\left(\begin{array}{rrrr} 1 & 1 & 2 & 1 \\ 3 & 4 & 8 & 5 \\ 1 & 3 & 7 & 8 \\ 2 & 2 & 5 & 6 \end{array}\right)
Dabar prie matricos prijungiame laisvųjų narių stulpelį:
laisvieji_nariai = vector(QQ, [7, 29, 30, 23]) show(laisvieji_nariai)
(7,29,30,23)\displaystyle \left(7,\,29,\,30,\,23\right)
B = A.augment(laisvieji_nariai, subdivide = True) show(B)
(11217348529137830225623)\displaystyle \left(\begin{array}{rrrr|r} 1 & 1 & 2 & 1 & 7 \\ 3 & 4 & 8 & 5 & 29 \\ 1 & 3 & 7 & 8 & 30 \\ 2 & 2 & 5 & 6 & 23 \end{array}\right)
Dabar matricai BB taikysime elementariąsias eilučių operacijas:
B.add_multiple_of_row(1,0,-3) show(B)
(1121701228137830225623)\displaystyle \left(\begin{array}{rrrr|r} 1 & 1 & 2 & 1 & 7 \\ 0 & 1 & 2 & 2 & 8 \\ 1 & 3 & 7 & 8 & 30 \\ 2 & 2 & 5 & 6 & 23 \end{array}\right)
B.add_multiple_of_row(2,0,-1) show(B)
(1121701228025723225623)\displaystyle \left(\begin{array}{rrrr|r} 1 & 1 & 2 & 1 & 7 \\ 0 & 1 & 2 & 2 & 8 \\ 0 & 2 & 5 & 7 & 23 \\ 2 & 2 & 5 & 6 & 23 \end{array}\right)
B.add_multiple_of_row(3,0,-2) show(B)
(112170122802572300149)\displaystyle \left(\begin{array}{rrrr|r} 1 & 1 & 2 & 1 & 7 \\ 0 & 1 & 2 & 2 & 8 \\ 0 & 2 & 5 & 7 & 23 \\ 0 & 0 & 1 & 4 & 9 \end{array}\right)
B.add_multiple_of_row(2,1,-2) show(B)
(11217012280013700149)\displaystyle \left(\begin{array}{rrrr|r} 1 & 1 & 2 & 1 & 7 \\ 0 & 1 & 2 & 2 & 8 \\ 0 & 0 & 1 & 3 & 7 \\ 0 & 0 & 1 & 4 & 9 \end{array}\right)
B.add_multiple_of_row(3,2,-1) show(B)
(11217012280013700012)\displaystyle \left(\begin{array}{rrrr|r} 1 & 1 & 2 & 1 & 7 \\ 0 & 1 & 2 & 2 & 8 \\ 0 & 0 & 1 & 3 & 7 \\ 0 & 0 & 0 & 1 & 2 \end{array}\right)
B.add_multiple_of_row(2,3,-3) show(B)
(11217012280010100012)\displaystyle \left(\begin{array}{rrrr|r} 1 & 1 & 2 & 1 & 7 \\ 0 & 1 & 2 & 2 & 8 \\ 0 & 0 & 1 & 0 & 1 \\ 0 & 0 & 0 & 1 & 2 \end{array}\right)
B.add_multiple_of_row(1,3,-2) show(B)
(11217012040013700012)\displaystyle \left(\begin{array}{rrrr|r} 1 & 1 & 2 & 1 & 7 \\ 0 & 1 & 2 & 0 & 4 \\ 0 & 0 & 1 & 3 & 7 \\ 0 & 0 & 0 & 1 & 2 \end{array}\right)
B.add_multiple_of_row(0,3,-1) show(B)
(11205012040010100012)\displaystyle \left(\begin{array}{rrrr|r} 1 & 1 & 2 & 0 & 5 \\ 0 & 1 & 2 & 0 & 4 \\ 0 & 0 & 1 & 0 & 1 \\ 0 & 0 & 0 & 1 & 2 \end{array}\right)
B.add_multiple_of_row(1,2,-2) show(B)
(11205010020010100012)\displaystyle \left(\begin{array}{rrrr|r} 1 & 1 & 2 & 0 & 5 \\ 0 & 1 & 0 & 0 & 2 \\ 0 & 0 & 1 & 0 & 1 \\ 0 & 0 & 0 & 1 & 2 \end{array}\right)
B.add_multiple_of_row(0,2,-2) show(B)
(11003010020010100012)\displaystyle \left(\begin{array}{rrrr|r} 1 & 1 & 0 & 0 & 3 \\ 0 & 1 & 0 & 0 & 2 \\ 0 & 0 & 1 & 0 & 1 \\ 0 & 0 & 0 & 1 & 2 \end{array}\right)
B.add_multiple_of_row(0,1,-1) show(B)
(10001010020010100012)\displaystyle \left(\begin{array}{rrrr|r} 1 & 0 & 0 & 0 & 1 \\ 0 & 1 & 0 & 0 & 2 \\ 0 & 0 & 1 & 0 & 1 \\ 0 & 0 & 0 & 1 & 2 \end{array}\right)
Taigi sistemos sprendinys yra x1=1,  x2=2,  x3=1,  x4=2. x_1 = 1,\; x_2 = 2,\; x_3 = 1,\; x_4 = 2.
Šią lygčių sistemą galima buvo spręsti kitu būdu. Lygčių sistema ekvivalenti tokiai matricų lygčiai: (1121348513782256)(x1x2x3x4)=(7293023) \left(\begin{array}{rrrr} 1 & 1 & 2 & 1 \\ 3 & 4 & 8 & 5 \\ 1 & 3 & 7 & 8 \\ 2 & 2 & 5 & 6 \end{array}\right) \left(\begin{array}{r} x_1 \\ x_2 \\ x_3 \\ x_4 \end{array}\right) = \left(\begin{array}{r} 7 \\ 29 \\ 30 \\ 23 \end{array}\right)
kintamieji = vector(QQ, [7, 29, 30, 23]) show(laisvieji_nariai) 92143d02-7c7d-4e3e-9861-52531d939d8e