Message Boards Message Boards

0
|
5854 Views
|
4 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Could you please help me out to get equations from augmented matrix

Posted 9 years ago

Hi, I am trying to derive equations from an augmented matrix, but i'm not been able to, could anyone please help me out to convert these printed equations into real algebraic equations. Regards.

Clear[a, b, c, d, e];
For[j = 1, j <= 5, j++,
 a = RandomInteger[{-5, 5}, {5, 6}];
 b = a[[1 ;; 5, 1 ;; 5]];
 c = Table[Subscript["x", i], {i, 1, 5}];
 d = b.c;
 e = 
\!\(\*SubscriptBox[\(a\), \(\(\[LeftDoubleBracket]\)\(All, 
   6\)\(\[RightDoubleBracket]\)\)]\);
 For[i = 1, i <= 5, i++,
   Print[
\!\(\*SubscriptBox[\(d\), \(\(\[LeftDoubleBracket]\)\(i\)\(\
\[RightDoubleBracket]\)\)]\), " = ", 
\!\(\*SubscriptBox[\(e\), \(\(\[LeftDoubleBracket]\)\(i\)\(\
\[RightDoubleBracket]\)\)]\)];]
  Print[" "];]

the notebook file is also attached.

Attachments:
POSTED BY: Muzahoo jee
4 Replies

I was curious to see if I could get Muzahoo jee's subscripted form. Combining his and Daniel Lichtblau's code, I came up with this:

Table[a = RandomInteger[{-5, 5}, {5, 6}];
 b = a[[1 ;; 5, 1 ;; 5]];
 c = Table[Subscript[x, i], {i, 1, 5}];
 d = b.c;
 e = a[[All, 6]];
 Thread[d == e], {j, 5}]

Hey, for me that's a big deal!

Cheers, Eric

POSTED BY: Eric Johnstone
Posted 9 years ago

that is really good regards

POSTED BY: Muzahoo jee

Use Table to actually create and return a list rather than simply print it.

Table[
 a = RandomInteger[{-5, 5}, {5, 6}];
 b = a[[1 ;; 5, 1 ;; 5]];
 c = Array[x, 5];
 d = b.c;
 e = a[[All, 6]];
 Thread[d == e], {j, 5}]

(* Out[10]= {{5 x[1] - 2 x[2] - 3 x[3] - 4 x[4] - 4 x[5] == -2, 
  x[2] + 3 x[3] - 4 x[5] == -4, -2 x[1] + 5 x[2] - 4 x[3] - 3 x[5] == 
   1, 2 x[1] - 4 x[2] - 3 x[3] + 3 x[4] == -4, -3 x[1] - x[3] + 
    3 x[4] - 4 x[5] == 
   3}, {x[1] + 4 x[2] - 4 x[3] + 5 x[4] + 2 x[5] == 
   4, -5 x[1] + x[3] + 3 x[5] == 
   2, -x[1] - 2 x[2] + 5 x[3] - 3 x[4] + x[5] == -5, -2 x[1] + 
    4 x[2] - x[3] - 5 x[4] + 3 x[5] == -4, 
  5 x[1] + 2 x[2] - x[4] + 4 x[5] == 
   1}, {-x[1] - 4 x[2] + 3 x[3] + 2 x[4] - 4 x[5] == -4, -5 x[1] - 
    5 x[2] - 3 x[3] + x[4] - 3 x[5] == -3, -x[2] + 3 x[3] + 5 x[4] == 
   1, -4 x[1] - 3 x[3] - x[4] + 2 x[5] == -1, -5 x[1] + x[2] + 
    2 x[3] + 5 x[4] + x[5] == -5}, {x[1] + 5 x[2] + 2 x[3] - 4 x[4] ==
    3, 2 x[1] - 5 x[2] + 4 x[3] - 4 x[4] + 3 x[5] == -4, -3 x[1] + 
    x[2] - 4 x[3] - 4 x[4] - 4 x[5] == -5, 
  x[1] - 5 x[2] + x[3] - 3 x[4] - 2 x[5] == 0, 
  x[1] - x[2] - 2 x[4] - x[5] == 
   0}, {2 x[1] - 4 x[2] + 5 x[3] - 2 x[4] - x[5] == 
   1, -x[1] + 2 x[2] - 5 x[3] - 4 x[4] - x[5] == 
   2, -x[1] + x[2] - 3 x[3] - 3 x[5] == 5, 
  3 x[1] - 5 x[2] + 5 x[3] + x[4] - 5 x[5] == -5, -3 x[1] + x[2] + 
    2 x[3] + 5 x[4] - 3 x[5] == -3}} *)
POSTED BY: Daniel Lichtblau
Posted 9 years ago

That is a great help, Regards

POSTED BY: Muzahoo jee
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