LinEqu190504
System of Linear Equations
Introduction
This applet permits
the solution
of a set of n equations with n
unknowns to be found using various
standard numerical techniques. Besides determining the solution to a
set of
linear equations, the main purpose of the applet is to demonstrate the
processes involved in each of the numerical techniques that it
utilizes. This
is done by stepping through each of the key processes and displaying
the interim
results as they occur, whilst moving towards the solution.
To support the applet,
considerable theory (for an applet) is presented in various documents.
Besides
this document, which shows how to operate the applet and each of the
numerical
techniques used, there exists a main overlying document
on matrices. In addition, each numerical technique used by the
applet has a
hyperlinked document that presents the theory, a worked example, which
is also
provided by the applet, and the key features of the Java2 code.
The screen shots shown
in this
document are inverted. The background is white. The actual applet,
which has
been designed for ease of reading, has a black background. The reason
for the
inversion is to save on black ink when printing.
Figure 1 shows a
screen shot of
the applet controls.

Figure 1
Applet menus, radio button, step button and input text
fields
For best results, your
screen size
should be 1024 x 768 pixels. This will allow a size 7 x 7 matrix to fit
on the
screen without moving sidebars. If an 800 x 600 screen size is used
only a 5 x
5 size matrix can fit on the screen.
In order of operation,
-
First,
select the
matrix size. The default is 4 x 4. However, this does not take effect
until the
4 x 4 screen size is selected and “enter” is pressed. This is the same
for all
the pull down menus and text fields. YOU MUST PRESS ENTER AFTER
ENTERING AN
INPUT. THIS APPLIES ALSO, EVEN IF THE INPUT IS ALREADY SHOWN. If say,
the 4 x 4
matrix is selected and “enter” pressed, then Figure 2 shows the result.
The
matrix sizes are 2 x 2, 3 x 3, 4 x 4, 5 x 5,
6 x 6, 7
x 7 and 8 x 8. The code is not limited to size 8 x 8. The limitation of
8 x 8 comes
from the display. The code limitation possibly would be sizes ranging
from 200
x 200 to 300 x 300 using the present numerical techniques. For larger
sizes,
iterative methods must be used. This is not discussed in this applet
and the
reader is referred to the many excellent texts available on numerical
methods
for engineering and science.
Figure 2
The applet displays a 4 x 4 matrix after the size 4 x 4
has been selected
and “Enter” pressed.
-
Second,
select the
type of fill from the “Fill” pull down menu, shown in Figure 3. The
fills that
may be selected are random fills for square and triangular matrices,
square
symmetric, random diagonal and sub-diagonal, zero, manual and a
selection of
designed matrices to follow the notes for the various numerical
techniques used
in this applet.

Figure 3
The
applet displays a pull-down menu showing the various fills that may
be selected.
-
Third,
after the fill
has been selected the numerical technique is chosen as shown in Figure
4. The
numerical methods used in this applet are Choleski, LU decomposition,
and QR
decomposition.

Figure 4
The
applet displays a pull-down menu showing the various numerical
methods
to choose from when solving a system of linear equations.
Manual Fill
A manual fill will be
selected to
demonstrate how to manually enter matrix data into the applet. Figure
5, shows
how to select a manual fill.
Figure 5
Selection of “Manual” fill.
After the
“Manual” fill has been chosen, the text fields become active,
permitting data
to be entered into the matrix. To enter data into the matrix,
-
In the
row number text
field, enter the number “0” for the first row. Zero is chosen to follow
Java 2
array convention and all documents relating to this applet follow this
convention.
-
In the
“Column Value”
text fields, enter the data for each matrix element
.
As we have chosen in this case, a 4 x 4 matrix, the last four
Column Value text fields leave at the default value of “0.00”.
-
In the
“b vector” text
field enter the value of “b” for that row. In this case it is 14.
-
Press
enter and all
data will be transferred to the matrix and properly displayed.
-
Commence
with the next
row by entering “1” into the “Row Number” and following the above
sequence.
-
This is
continued
until the matrix is full with its elements as shown in Figure 7.

Figure 6
Entering data values into the matrix.

Figure 7
Data values manually entered into the matrix.
Having completed the
manual entry
of the data into the matrix, the method of solving the system of linear
equations is next chosen. For this example, the LU Decomposition is
chosen as
shown in Figure 8.

Figure 8
Selection of the LU Decomposition numerical technique
which is to be
used to solve the system of linear equations.
Once the data has been
entered,
either manually or by choosing a fill from the “Fill” pull down menu
and a
numerical method for solving the system of equations has been chosen,
the
applet has all of its required inputs and is ready to provide some
output. To
give the command to the applet to start processing, the radio button
for
“Calculate inverse?” has to be selected to be “Yes”. Figure 9 shows the
position
of the radio button on the applet. The “Calculate inverse?” does not
mean to
calculate the inverse of the matrix, but to calculate inverses for all
of the
intermediate steps required to solve the system of linear equations.

Figure 9
Selection of the “Yes” radio button to commence
processing of data
according to the decomposition method selected.
Should you wish to
continue with
an explanation of how to set up the Choleski method, this can be found
at
Choleski.Method.html
Alternatively, should you wish to continue
with an explanation of how to set up the LU Decomposition Method, this
can be
found at LUDecomp.html.
For your comments and suggestions,
mail the author:
A.A.R.Townsend