Message Boards Message Boards

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

Could you please help me out to fix this code?

Posted 9 years ago

Hi, I'm converting a system of linear equations in augmented matrix, after that i want to perform RowReduce command on it, but its not working. Can any one help me out plz?

eq1 = 5 Subscript[x, 2] + 4 Subscript[x, 4] == 1 ;
eq2 = Subscript[x, 1] + 3 Subscript[x, 2] + Subscript[x, 3] + 
    3 Subscript[x, 4] == 3;
eq3 = Subscript[x, 3] + 4 Subscript[x, 4] == 5;
eq4 = 4 Subscript[x, 1] + 2 Subscript[x, 2] == 5;
Clear[A];
A = Coefficient[
     First@#, {Subscript[x, 1], Subscript[x, 2], Subscript[x, 3], 
      Subscript[x, 4]}] & /@ {eq1, eq2, eq3, eq4};
B = {{1}, {3}, {5}, {5}};
Aug1 = Normal[ArrayFlatten[{{A, B}}]] // MatrixForm
Attachments:
POSTED BY: Muhammad Afzal
2 Replies
Posted 9 years ago

Get rid of that

//MatrixForm

and then you can successfully

In[1]:= ...
    Aug1 = Normal[ArrayFlatten[{{A, B}}]];
    RowReduce[Aug1]

Out[9]= {{1, 0, 0, 0, 33/20}, {0, 1, 0, 0, -(4/5)}, {0, 0, 1, 0, 0}, {0, 0, 0, 1, 5/4}}

//MatrixForm might make an expression cute to look at, but you cannot then do any calculations on your cute result.

If all Mathematica functions would look at anything that was a MatrixForm or any of the other *Form, strip that off and then do the calculation as if it were never present then this would avoid repeated confusion and questions like this. Users seem to be like that, every new pretty printing feature starts getting used and then the questions begin asking why they then can't compute using that pretty result.

The same could be said of much of the desktop publishing functionality. Unfortunately, the things users can do with that seems like will make it far harder for Mathematica to make sense of and correctly remove to enable sensible calculations.

POSTED BY: Bill Simpson
Posted 9 years ago

Thank you Bill , its really a great help and i like your style of explaining, Regards

POSTED BY: Muhammad Afzal
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