Start by copying the files LinearSystem.java and SystemDriver.java of source code to your directory either by clicking on the links and saving or by using the following copy commands.

cp ~cpsc/public_html/Spring2006/CPSC402A/LinearSystem.java . cp ~cpsc/public_html/Spring2006/CPSC402A/SystemDriver.java .

Now do the following:

- Compile and run the program to see how it works.
Test the program as follows:
- Read in the 4 by 4 system on page 163. (Choose the read system option.)
- Choose the option to solve by Gaussian elimination with naive pivoting. The solution should be correct.
- Choose to print the LU decomposition. You should note that there was no pivoting.
- Now do the preceding two steps with partial pivoting. Note that there were row swaps so PA, the permuted matrix, has rows in a different order than A.
- Now do the same with scaled partial pivoting. You see a different order of rows (the text does this same system with scaled on pages 166-167).

- Now test the Hilbert matrix option. Systems with the
Hilbert matrix as the coefficient matrix are notoriously
ill-conditioned. The program generates the system described
in problem #18 on page 170 which has exact solution a vector
with all ones.
- Run the program as described in part (a) of #18. Note the solutions. For n = 7 (and each solution strategy) note the number of accurate digits in the most inaccurate entry in the solution vector.
- Run the program as described in part (b). Note the accuracy as above for n = 13.
- Based on your results above approximately what power of 10 would you hypothesize for the condition number of the 7 by 7 Hilbert matrix and the 13 by 13 Hilbert matrix?

- Now implement the option of solving a system using the
LU decomposition.
- Open LinearSystem.java in emacs and type in
the LUSolve() method that we started in class Wednesday. Note that
its signature should be:
public void LUSolve()

- Make sure the program compiles.
- Now open SystemDriver.java and add the call to LUSolve in the appropriate menu option.
- Compile and run the program. Test it using the system in #15 on page 203-204 of the text. Note that there is a menu option for changing just the b vector. The correct solutions are (1,-1,1,-1,1) for b1, (-1,1,1,1,-1) for b2, and (1, -2, 3, -2, 1) for b3.

- Open LinearSystem.java in emacs and type in
the LUSolve() method that we started in class Wednesday. Note that
its signature should be:
- Add a method to the LinearSystem class to compute and return the
determinant of the coefficient matrix. Remember that this can
easily be computed from the LU decomposition. The signature for the
method should be
public double determinant()

Add a menu option to LinearDriver to test your method. - Add a method to the LinearSystem class to compute and return
the infinity norm of the coefficient matrix for the system.
The signature should be
public double normA()

Add a menu option to LinearDriver to test your method.