
On Feb 3, 2010, at 1:15 AM, 조광래 wrote:
define functions
type Matrix=[[Double]]
multMM :: Matrix -> Matrix -> Matrix --multiplies two matrices det :: Matrix -> Double --computes the determinant of a matrix inv :: Matrix -> Matrix --inverts a matrix
i stuck on those problems
Stuck how, exactly? Writing a good matrix inversion procedure is seriously tricky in any programming language (unless you are using rational arithmetic, in which case it's tricky in a different way). Indeed, I think every book I've come across says "DON'T compute multMM x (inv y)" but instead use a "solve" method. You'll find matrix multiplication easy enough if you draw a few diagrams and think in terms of operations on rows and columns rather than in terms of array elements. For matrix inversion, Gaussian elimination with partial pivoting is tedious rather than difficult. The same conversion-to-triangular process will give you determinant.