Message Boards Message Boards

Converting linear equation into matrix form?

Posted 8 years ago
CoefficientArrays[{a+b+c+d+e+f==0,2a+4b+5c+6d+7e+8f==0}, {a, b}, {c,d}, {e,f}]

hi i want to convert these into matrix equation like

{{1,1},{2,4}}{a,b}+{{1,1},{5,6}}{c,d}+{{1,1},{7,8}}{e,f}

can anybody help please

POSTED BY: Rajan Prasad

One way is this:

pl = {a + b + c + d + e + f, 2 a + 4 b + 5 c + 6 d + 7 e + 8 f};
abMatrix = Normal@Last@CoefficientArrays[pl, {a, b}]
cdMatrix = Normal@Last@CoefficientArrays[pl, {c, d}]
efMatrix = Normal@Last@CoefficientArrays[pl, {e, f}]
abMatrix.{a, b} + cdMatrix.{c, d} + efMatrix.{e, f} == pl
POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract