[MATRIX-SIG] Matrix class (obviously)

Paul F. Dubois Paul F. Dubois" <dubois1@llnl.gov
Fri, 7 Nov 1997 08:05:17 -0800


Eeek! This is not how to find a determinant! It not only is not going to
work for matrices of big numbers, it won't work for big matrices of small
numbers.  I'm sure there must be stuff in the Linear Algebra file to find an
LU-decomposition. Then the determinant is the product of the diagonals of L.
For example, given

M =  3,  2
       -2,  1

M = 3,   0   *  1, 2/3
      -2, 7/3      0, 1

so D = 3 * (7/3) = 7.

(An LU decomposition is writing M as a product of a lower triangular matrix
times an upper triangular matrix with a diagonal of 1. The work involved is
the same as the first stage of solving MX = B. No extra storage is actually
involved since you can store L and U in the same n**2 locations as M. The
determinant of a triangular matrix is the product of its diagonal elements.)

The rules you learned in school for finding determinants are fine
theoretically but have bad numerical properties on
a computer.

-----Original Message-----
From: Jim Rucker <jim.rucker@jpl.nasa.gov>
To: 'matrix-sig@python.org' <matrix-sig@python.org>
Date: Thursday, November 06, 1997 3:28 PM
Subject: [MATRIX-SIG] Matrix class (obviously)


I looked at the Matrix class in Matrix.py, and didn't see anything relating
to the determinant of a matrix, so I wrote one myself. After I discovered
the determinant function in the Linear Algebra file, I compared our
implementations. I noticed that your implementation required the Matrix to
be square, and was not made a member function of the Matrix class. My
implemetation did both of these. I'm attaching a file that has this code,
plus exp(M), which is inacurate for Matrixes with large numbers. It still
needs more work, but I'm afraid I don't have the time. Let me know what you
think of these functions. I haven't written much of a test though. Thank
you,

-Jim Rucker




_______________
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
_______________