[plt-scheme] Matrix Determinants
On Mar 27, 2008, at 9:25 PM, Henk Boom wrote:
> So, when I get bored doing math assignments, I write short programs to
> double-check my answers. It's somewhat of a bad habit actually, as it
> often ends up taking long enough that I don't have enough time to
> finish the assignment...
>
> Anyways, during my last assignment I came up with the following for
> taking matrix determinants and multiplying matrices. Matrices are
> lists of rows, rows are lists of numbers, all rows of a matrix are the
> same length. I wasn't really worrying about numerical error, since the
> matrices I gave it consisted of exact numbers. I'm pretty happy with
> how simple matrix-mult is ((apply map list m) is neat!), but taking
> the determinant of a matrix proved messy. I add multiples of the first
> row to the rest to zero out the rest of the first column, so I only
> need to do ~n recursive calls. It gets messy when I need to deal with
> the case that the first row has a zero as the first element, swapping
> list elements is tricky!
>
> Can anyone come up with a simple matrix determinant implementation?
Wikipedia suggests gaussian elimination...
John Clements
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2223 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20080327/c30d6b3d/attachment.p7s>