A system of linear equations:
$\left\{\begin{aligned} x_{1}+3 x_{2}+x_{3} &=2 \\ 3 x_{1}+4 x_{2}+2 x_{3} &=9 \\-x_{1}-5 x_{2}+4 x_{3} &=10 \\ 2 x_{1}+7 x_{2}+x_{3} &=1 \end{aligned}\right.$
I know how to get its coefficient matrix.
Clear["Global`*"];
eqns = {\!\(TraditionalForm\`
\*SubscriptBox[\(x\), \(1\)] + 3
\*SubscriptBox[\(x\), \(2\)] +
\*SubscriptBox[\(x\), \(3\)]\[AlignmentMarker] ==
2\), \!\(TraditionalForm\`3
\*SubscriptBox[\(x\), \(1\)] + 4
\*SubscriptBox[\(x\), \(2\)] + 2
\*SubscriptBox[\(x\), \(3\)]\[AlignmentMarker] ==
9\), \!\(TraditionalForm\`\(\[Minus]
\*SubscriptBox[\(x\), \(1\)]\) \[Minus] 5
\*SubscriptBox[\(x\), \(2\)] + 4
\*SubscriptBox[\(x\), \(3\)]\[AlignmentMarker] ==
10\), \!\(TraditionalForm\`2
\*SubscriptBox[\(x\), \(1\)] + 7
\*SubscriptBox[\(x\), \(2\)] +
\*SubscriptBox[\(x\), \(3\)]\[AlignmentMarker] == 1\)};
c = CoefficientArrays[eqns, Variables@eqns];
mc = MatrixForm@c[[2]]
$\left(\begin{array}{ccc}1 & 3 & 1 \\ 3 & 4 & 2 \\ -1 & -5 & 4 \\ 2 & 7 & 1\end{array}\right)$
How to get the list of constant terms of these linear equations, i.e {2,9,10,1}
?
eqns[[All, -1]]
? $\endgroup${2, 9, 10, 1}
both in version 11.3 (Windows 64b) and in version 13.0.0 (Wolfram Cloud) $\endgroup$CoefficientArrays
, why are you still having difficulty in obtaining the list of constant terms? Or you just obtain this code sample from somewhere without understanding it? $\endgroup$