Group Abstract Group Abstract

Message Boards Message Boards

0
|
14.7K Views
|
6 Replies
|
2 Total Likes
View groups...
Share
Share this post:

How to create an augmented matrix form a system of equations in mathematica

Posted 11 years ago

I've tried Normal[CoefficientArrays to create the matrix from the coefficients, but then i'm completely lost . Any help would be greatly appreciated.

POSTED BY: Dave Jeudy
6 Replies
Posted 11 years ago

Thank you, very helpful.

POSTED BY: Dave Jeudy
Posted 11 years ago
POSTED BY: David Keith
Posted 11 years ago

Can you please explain the syntax? specifically the s[] and -s[] Thank you

POSTED BY: Dave Jeudy
Posted 11 years ago

I don't follow you with regard to "system assignment."

There may be a more abbreviated way to append a column, but the code below constructs the traditional augmented matrix form the coefficients.

In[5]:= (* an augmented matrix *)
am = Transpose[Append[Transpose[s[[2]]], -s[[1]]]]

Out[5]= {{a, b, k1}, {c, d, k2}}
POSTED BY: David Keith
Posted 11 years ago

SoQ

(-19 u-19 w+6 x-18 y+10 z==-2,
-15 u-17 w-16 x-11 y+11 z==-15,
14 u-8 w+13 x-11 y==16,
13 u-17 w-10 x+18 y+12 z==17,
4 u+9 w+20 x-16 y-9 z==13)

i'm simply trying to construct the augmented matrix. Looking at the instructions, it's actually asking to use the system assignment. Thank you for your help.

POSTED BY: Dave Jeudy
Posted 11 years ago

Are you trying to do something like this?

In[1]:= (* some equations *)
eqs = {a x + b y == k1, c x + d y == k2};

In[2]:= (* this contains same information as augmented array *)
s = Normal[CoefficientArrays[eqs, {x, y}]]

Out[2]= {{-k1, -k2}, {{a, b}, {c, d}}}

In[3]:= (* LinearSolve can use it *)
LinearSolve[s[[2]], -s[[1]]]

Out[3]= {(d k1 - b k2)/(-b c + a d), (c k1 - a k2)/(b c - a d)}

In[4]:= (* Solve gives the same answer *)
Solve[eqs, {x, y}]

Out[4]= {{x -> -((d k1 - b k2)/(b c - a d)), 
  y -> -((-c k1 + a k2)/(b c - a d))}}
POSTED BY: David Keith
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard