# Message Boards

0
|
6436 Views
|
4 Replies
|
1 Total Likes
View groups...
Share
GROUPS:

Posted 10 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:
4 Replies
Sort By:
Posted 10 years ago
 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 10 years ago
 that is really good regards
Posted 10 years ago
 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 10 years ago
 That is a great help, Regards