Lesson 16 Linear Systems - Bruce E. Shapiro
Lesson 16 Linear Systems - Bruce E. Shapiro
Lesson 16 Linear Systems - Bruce E. Shapiro
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
108 LESSON <strong>16</strong>. LINEAR SYSTEMS<br />
x = Prepend[x, x1];<br />
Return[x];<br />
]<br />
For example, to solve the system<br />
⎛<br />
⎞ ⎛ ⎞ ⎛ ⎞<br />
0.1<strong>16</strong>093 0.2306<strong>16</strong> 0.34202 x 1 3<br />
⎝0.461232 0.897598 1.28558⎠<br />
⎝x 2<br />
⎠ = ⎝17⎠ (<strong>16</strong>.14)<br />
1.02606 1.92836 2.59808 x 3 5<br />
One could use this function by typing<br />
In:=<br />
Out:=<br />
A={{0.1<strong>16</strong>093, 0.2306<strong>16</strong>, 0.34202},<br />
{0.461232, 0.897598, 1.28558},<br />
{1.02606, 1.92836, 2.59808}};<br />
b={3, 17, 5};<br />
gauss[A, b]<br />
{-33612.9, 27351.9, -7024.58}<br />
In Mathematicawe can also solve the system directly by using the built in function<br />
<strong>Linear</strong>Solve[A,b].<br />
Gaussian elimination can fail if we divide by zero, and is susceptible to large errors or<br />
possible overflow if we divide by a very small number (relative to the other numbers in<br />
the matrix). Division occurs in two places in the algorithm: during the row reduction<br />
phase where we define m = a k1 /a 11 and during the back-substitution step at the end<br />
of the algorithm, where we solve for x 1 (here we also divide by a 11 , but its usually<br />
a different a 11 ). These numbers are called pivots. The solution is to rearrange the<br />
matrix (and the corresponding elements of b): if at any step along the way the pivot<br />
is zero, then the entire row is exchanged with a row that does not have zero in that<br />
column. If all of the remaining elements in that column are zero then the matrix is<br />
singular and there is no unique solution (or no solution at all).<br />
Math 481A<br />
California State University Northridge<br />
2008, B.E.<strong>Shapiro</strong><br />
Last revised: November <strong>16</strong>, 2011