Analysis of Algorithms : An Active Learning Approach

(Ron) #1
4.3 LINEAR EQUATIONS 119

The final matrix gives us the x values of x 1 = 2, x 2 = 4, x 3 = 3, and x 4 = 7.
The problem with this process is that on a computer, we will get round-off
errors that may give inaccurate results. Round-off errors can multiply within a
computer program so that a minor round-off difference in one calculation will
cause the next to be more inaccurate than the last. In a large system of linear
equations, round-off errors can be rather significant. There are other algo-
rithms to solve or at least control these round-off errors, but the description of
those algorithms is more appropriate for a text on numerical analysis and will
not be discussed further.
A second concern with this process is what happens if two rows are just
multiples of each other. In that case, we will wind up with one row that is
entirely zero, and that will lead to a divide by zero error in our algorithm. This
problem is called singularity, and modifying this algorithm to handle singular-
ity is beyond the scope of this book.

4.3.2



  1. Show the steps in the Gauss-Jordan algorithm for the following system of
    linear equations:

  2. Show the steps in the Gauss-Jordan algorithm for the following system of
    linear equations:

  3. From the description of Section 4.2.1, do an analysis of the Gauss-Jordan
    method for solving a system of N linear equations with N unknowns. Your
    analysis should determine the number of multiplications and the number of
    additions that are done.


■4.3.2 EXERCISES

3 x 1 ++ + 6 x 2 12 x 3 9 x 4 = 78
2 x 1 ++ + 3 x 2 5 x 3 7 x 4 = 48
1 x 1 ++ + 7 x 2 2 x 3 3 x 4 = 27
4 x 1 ++ + 9 x 2 1 x 3 2 x 4 = 45

2 x 1 ++ 4 x 2 5 x 3 = 23
1 x 1 ++ 5 x 2 3 x 3 = 16
3 x 1 ++ 1 x 2 6 x 3 = 25
Free download pdf