[next] [prev] [prev-tail] [tail] [up]
Problem: Given \[{\begin {array} [c]{ccc}4x+4y+2z & = & 12\\ 5x+6y+3z & = & 7\\ 9x+7y+10z & = & 9 \end {array}} \]
Automatically convert it to the form \(Ax=b\) and solve
Mathematica
Remove["Global`*"] eqs = {4x+3y+2z==12, 5x+6y+3z ==7, 9x+7y+10z ==9}; {b,a} = CoefficientArrays[eqs,{x,y,z}]; Normal[a]//MatrixForm
\[ \left ( {\begin {array}{ccc} 4 & 3 & 2 \\ 5 & 6 & 3 \\ 9 & 7 & 10 \\ \end {array}} \right ) \]
Normal[b]//MatrixForm
\[ \{-12,-7,-9\} \]
LinearSolve[a,-b]//N
{6.71429,-2.85714,-3.14286}
Maple
restart; eqs:=[4*x+3*y+2*z=12,5*x+6*y+3*z=7,9*x+7*y+10*z=9]; A,b := LinearAlgebra:-GenerateMatrix(eqs,[x,y,z]); LinearAlgebra:-LinearSolve(A,b)
\[ \left [\begin {array}{c} \frac {47}{7} \\ -\frac {20}{7} \\ -\frac {22}{7} \end {array}\right ] \]
[next] [prev] [prev-tail] [front] [up]