Message Boards Message Boards

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

How on Mathematica would you use the Gaussian elimination for say below

Anonymous User
Anonymous User
Posted 11 years ago

Using gaussian elimination to find inverse

({
  {1, 7, 5, 0},
  {5, 8, 6, 9},
  {2, 1, 6, 4},  
  {8, 1, 2, 4}
 })

I have started, but I get nothing but errors.

POSTED BY: Anonymous User
2 Replies
elimmat = 
 RowReduce[
  Join[{{1, 7, 5, 0}, {5, 8, 6, 9}, {2, 1, 6, 4}, {8, 1, 2, 4}}, 
   IdentityMatrix[4], 2]]

(* Out[206]= {{1, 0, 0, 0, 46/993, -(56/993), -(73/1986), 325/1986}, {0, 
  1, 0, 0, 86/993, 68/993, -(133/993), -(20/993)}, {0, 0, 1, 0, 23/
  331, -(28/331), 129/662, -(3/662)}, {0, 0, 0, 1, -(148/993), 137/
  993, 19/1986, -(139/1986)}} *)

inv = elimmat[[All, 5 ;; -1]]

(* Out[207]= {{46/993, -(56/993), -(73/1986), 325/1986}, {86/993, 68/
  993, -(133/993), -(20/993)}, {23/331, -(28/331), 129/
  662, -(3/662)}, {-(148/993), 137/993, 19/1986, -(139/1986)}} *)
POSTED BY: Daniel Lichtblau

Those who are interested in step-by-step solution of linear equation systems might find the Student's Linear Equations section of my Presentations Application useful. It allows matrix structures to be composed in detail with row and column names and dividers, You can display any intermediate or final result in the notebook and there is also a side window that displays the current state of the matrix structure. The display elements can be used as paste buttons to paste the structure locations into the commands.

Duplicating Daniel's example would look like the following. The LEWhiteboard gives the window display and LEPrint gives the notebook display.

<< Presentations`

case1 = LECreate[4, 8];
LEWhiteboard[case1]

Then composing the matrix

LEInsertColumnNames[case1, 5, {R1, R2, R3, R4}]
LEColumnDividers[case1, {4}]
LEInsertMatrix[case1, {1, 1}, {{1, 7, 5, 0}, {5, 8, 6, 9}, {2, 1, 6, 4}, {8, 1, 2, 4}}]
LEInsertMatrix[case1, {1, 5}, IdentityMatrix[4]]
LEPrint[case1]

This gives:

enter image description here

Then the standard Gaussian reduction can be done with:

LEMakeEchelonForm[case1, {1, 1}, {4, 4}]
LEPrint[case1]

which gives:

enter image description here

It's also possible to specify that only the below diagonal elements are to be zeroed. This example was fairly simple and I won't give other examples here but the system allows much more detail.

The commands for composing structures are: LECreate, LEInsertRowNames, LEInsertColumnNames, LEInsertMatrix, LERowDividers, LEColumnDividers, LEContravariant, LESetIOptions, LENumberFunction.

The commands for displaying the structures are: LEPrint and LEWhiteboard.

The commands for operating on structures are: LEScaleRow, LEAddToRow, LESumRows, LETargetValue, LESwapRows, LESwapColumns, LEPivot, LESimplexPivot, LEMakeExhelonForm, LEMaxFeasibleAddition, LEMakeInteger.

The commands for extracting from structures are: LEExtractRowNames, LEExtractColumnNames, LEExtractMatrix, LERowExpression, LEColumnExpressions, LEReactionEquation, LEChemicalFormula.

One novel feature in the commands is the facility for contravariant columns (covariant being the standard practice). Some columns can be covariant and some contravariant. Contravariant columns roughly correspond to packages of things so if you put more items in a package you need fewer of the packages.

This is mainly useful for didactic purposes and solving small systems, or maybe just for seeing what the heck is going on. One of the troubles with calculating with matrices is that they don't automatically carry context. Are you dealing with the matrix, or its inverse, or its transpose or its inverse transpose? Carrying row and column names adds context and helps to keep things straight.

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