Skip to main content
Tweeted twitter.com/StackMma/status/1067070480715300864
edited tags
Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Source Link
Mikhail
  • 257
  • 1
  • 7

Populate matrix from linear system

What is the strategy to populate a matrix from a linear system of equations?

As a toy example, I have some scary, complicated math, that generates eq1 and eq2. I can solve this, linear, system using Solve. I want to inspect the matrix that is made before the Solve step. In my application I expect this to be a system to be over defined.

eq1 = a x + y;
eq2 = b x - y;
Solve[{eq1 == 7, eq2 == 1}, {x, y}]

In the toy example, it would be this matrix:

( {
   {a, 1},
   {b, -1}
  } ) // MatrixForm

I could imagine parsing the text or something wacky like that.