Symbolic and Exact MatricesLinearSolve works for all the different types of matrices that can be represented in Mathematica. These are described in more detail in Matrix Types. Here is an example of working with purely symbolic matrices. In[1]:=  |
Out[2]//MatrixForm=
|
In[3]:=  |
Out[4]=
|
The original matrix can be multiplied into the solution. In[5]:=  |
Out[5]=
|
The result of multiplication needs some post-processing with Simplify to reach the expected value. This demonstrates the need for intermediate processing in symbolic linear algebra computation. Without care these intermediate results can become extremely large and make the computation run slowly. In[6]:=  |
Out[6]=
|
In order to simplify the intermediate expressions, the ZeroTest option might be useful. LinearSolve can also be used to solve exact problems. In[7]:=  |
Out[8]//MatrixForm=
|
In[9]:=  |
Out[10]=
|
In[11]:=  |
Out[11]=
|
There are a number of methods that are specific to symbolic and exact computation: CofactorExpansion, DivisionFreeRowReduction, and OneStepRowReduction. These are discussed in the section on Symbolic Methods. Row ReductionRow reduction involves adding multiples of rows together so as to produce zero elements when possible. The final matrix is in reduced row echelon form as described previously. If the input matrix is a non-singular square matrix, the result will be an identity matrix. In[1]:=  |
Out[1]=
|
This can be used as a way to solve a system of equations. In[2]:=  |
Out[2]=
|
This can be compared with the following use of LinearSolve. In[3]:=  |
Out[3]=
|
|