根据方程系数创建矩阵

pen*_*nny 6 wolfram-mathematica

给出方程式

eqn1 = 5 x1 + 2 x2 + 3 x3 == 8
eqn2 = 4 x1 + 7 x2 + 9 x3 == 5
eqn3 = 6 x1 +   x2 + 9 x3 == 2
Run Code Online (Sandbox Code Playgroud)

如何提取系数x1, x2, x3以形成矩阵?

我试过使用,CoefficientArrays但输出是作为一个SparseArray.

Nas*_*ser 11

尝试 Normal

(Normal[CoefficientArrays[{eqn1, eqn2, eqn3}, {x1, x2, x3}]][[2]]) // MatrixForm
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述