Message Boards Message Boards

0
|
4796 Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:
GROUPS:

How to get matrix of coefficients from a set of linear equations?

Posted 10 years ago

Given a set of linear equations, say

2 A[2] + 3 A[3] == 4

5 A[1] + 7 A[2] == 6

How do I program Mathematica to get the matrix

{{0,2,3},{5,7,0}}

and the vector

{4,6}

?

Thank you!

POSTED BY: C L
2 Replies
Posted 10 years ago

Thank you!

POSTED BY: C L
In[2]:= Normal[CoefficientArrays[{2 A[2] + 3 A[3] == 4, 5 A[1] + 7 A[2] == 6}, {A[1], A[2], A[3]}]]

Out[2]= {{-4, -6}, {{0, 2, 3}, {5, 7, 0}}}
POSTED BY: Ilian Gachevski
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