Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Standard view
Full view
of .
0 of .
Results for:
P. 1
LU Factorisation and Forward and Back Substitution_Excel

LU Factorisation and Forward and Back Substitution_Excel

Ratings: (0)|Views: 28|Likes:
A guide to an Excel spreadsheet that contains code in visual basic that implements the LU factorisation (with pivoting) algorithm and the forward and back substitution algorithms. The spreadsheet has a number of demonstration matrix-vector systems that can be used to illustrate the method. Your own matrix-vector system may be tried too.
A guide to an Excel spreadsheet that contains code in visual basic that implements the LU factorisation (with pivoting) algorithm and the forward and back substitution algorithms. The spreadsheet has a number of demonstration matrix-vector systems that can be used to illustrate the method. Your own matrix-vector system may be tried too.

Categories:Types, School Work

Availability:

See more
See less

07/17/2014

pdf

text

original

LU factorisation and back substitution
1

This spreadsheet contains the VBA source files for carrying out the LU factorisation and back-substitution of a general square
matrix, which is useful in solving general linear systems of equations
2
. Several test problems that demonstrate the computation of LU factors are given and these are followed up by examples of solving matrix-vector systems by backward and forward substitution. The spreadsheet implements two algorithms as VBA subroutines that can be viewed or downloaded; the LU factorisation method LUfac
3
and the LU back and forward substitution method LUfbsub
4
. The spreadsheet consists of three sheets; the first sheet demonstrates the methods on a 3x3 matrix and matrix-vector problem, the second sheets similarly on a 5x5 problem and the third sheet similarly on a similar 10x10 problem. Two algorithms are implemented in VBA in order to carry out the objectives of this spreadsheet; LU factorisation and backward and forward substitution. All three spreadsheets find the LU
factorisation of a matrix ‘
A
’, giving
L
and
. The LU factorisation method also requires and also a permutation matrix is allowed, to record row exchanges (as a result of pivoting)
throughout the method, necessary to avoid division by zero or ‘small’
numbers. In summary, the spreadsheet returns the lower-triangular matrix
L
, the upper-triangular matrix U and the permutation matrix P so that
Since the three sheets have a similar format then it is suffice to consider the first sheet in this document. An image of the top half of page one of the spreadsheet is shown below. The 3x3 matrix is placed in the 3x3 yellow square and h. The sheet is able to solve any 3x3 system, by pacing the matrix in the yellow 3x3 grid and the vector in the yellow 1x3 column. However the following sample test problem is included and this can be restored by using the button.
()(
)()

1
2
3
4

The test data is on the right of the spreadsheet. The default test data is shown as follows. The matrix and vector can be cleared using the button and the vector alone can be cleared using the button. The LU factorisation of the matrix can be found by pressing the button, by executing the
LUfac
5

subroutine . For the matrix in test 1 above, this gives From the results above the permutation matrix in the row index in this ase indicates that no rows have interchanged; the permutation matrix is
() 
As a check, in green, the matrices
L
and
are multiplied to give
LU
and
LU. P
LU
should be equal to the matrix
A
, as shown in the example. On pressing the button, the matrix-vector system is solved from the LU factors and by using the
LUfbsub
6
subroutine. The results are given, as follows:;

 


5

Test 2 _ Pivotting required
The second test problem can be introduced by pressing . The test data from the right of the screen is then placed in the yellow cells. In this case the zero in the first row and column would cause a division by zero error if the LU factorisation method was applied without pivoting. The LU factors can be found by pressing the, to give the following. Hence the LU factorisation in terms of

is as follows:
()()()()
As before, the solution to the matrix-vector system can be obtained by pressing the button
.
Test 3
Singular matrix
T
he third test problem can be introduced by pressing . The following test data from the right of the screen is then placed in the yellow cells.
6