Numerical Methods Library in Excel VBA

9 downloads 0 Views 504KB Size Report
Numerical Methods Library in Excel VBA. Module LUfac.bas. Descript ion. This spreadsheet contains the VBA source files for carrying out a LU factorisation.
www.numerical-methods.com

Numerical Methods Library in Excel VBA Module

LUfac.bas

Descript ion

This spreadsheet contains the VBA source files for carrying out a LU factorisation of a real square 𝑛 × 𝑛 matrix 𝐴, so that 𝑃𝐴 = 𝐿𝑈 where 𝐿 is a lower-triangular matrix (with diagonal elements set to 1) and 𝑈 is an upper-triangular matrix and 𝑃 is a permutation matrix.

Interfac e

Sub LUfac(a, n, perm, lfail) real a: on input the nxn matrix A, on output L and U integer n: the dimension of the matrix/vector integer perm: an n-vector, the column index of the permutation matrix P logical lfail: returns 'true' if the method fails, otherwise 'false' Note the output matrix ‘a’ is such that the diagonal and upper-triangular elements is the ‘U’ matrix and the lower-triangular elements together with 1s on the diagonal is the matrix ‘U’. On exit ‘perm’ records the row exchanges that have occurred as a result of pivoting, otherwise known as a permutation matrix P. It would be wasteful of computer memory to store the permutation matrix as an nxn array. P is taken to be made up of all zeros, except for P[j,i]=1 when perm(i)=j.

Web source of code.

https://www.researchgate.net/publication/325808019_LU_factorisation_Demonstr ated_in_Excel_and_coded_in_VBA (key ‘Developer’ then ‘Visual Basic’ and then ‘LUfac_module’)

Web source of this guide

www.numerical-methods.com/lineq/LUfac_bas.htm

Web source of the algorith m

http://www.numerical-methods.com/lineq/LU Factorisation.htm

Licence

This is ‘open source’; the software may be used and applied within other systems as long as its provenance is appropriately acknowledged. See the GNU Licence for more information or contact webmaster@numerical-

www.numerical-methods.com methods.com

Test problem s

The Excel file contains spreadsheet test programs that demonstrate the LU factorisation of either a set of test matrices of various dimensions or a chosen matrix. https://www.researchgate.net/publication/325808019_LU_factorisation_Demonstr ated_in_Excel_and_coded_in_VBA

Bibilogr aphy

Solution of Linear Systems of Equations (Matlab/Freemat/Scilab/Octave) Linear Systems and 2x2 Matrices Tutorials on Matlab/Freemat Numerical Methods