Subject: What about "conditionnement" of a matrix?
From: Barton Willis
Date: Thu, 9 Aug 2007 06:42:28 -0500
Please correct me if I'm wrong, but I'm guessing that you want to evaluate
|| A || * ||A^-1||, where A is a matrix and || || is a matrix norm
(in English, the 'condition number'). Yes, Maxima can do this (using
version 5.12)
Define a 2 x 2 matrix m
(%i1) m : matrix([1,2],[z,42]);
(%o1) matrix([1,2],[z,42])
The function 'mat_norm' finds the one and infinity norms of a matrix
(%i2) mat_norm(m,1);
(%o2) max(abs(z)+1,44)
(%i3) mat_norm(m,'inf);
(%o3) abs(z)+42
The function 'mat_cond' finds the one and infinity norm condition numbers
(it does not find the two norm condition number)
(%i4) mat_cond(m,'inf);
(%o4)
(abs(z)+42)*max(abs((2*z)/(42-2*z)+1)+2/abs(2*z-42),abs(z)/abs(2*z-42)+1/abs(2*z-42))
If yow are working with floating point matrices, it might be better to
write your own function. Example:
(%i19) m : genmatrix(lambda([i,j], random(1000.0) - 500.0),150,150)$
(%i20) showtime : true$
(%i21) mat_cond(m,'inf);
Evaluation took 28.77 seconds (28.77 elapsed)
(%o21) 4043.755233929853
Here is a condition number function that is specialized to floating
point matrices:
(%i22) my_mat_cond_float(m) := mat_norm(float(m),'inf) *
mat_norm(invert_by_lu(m, 'floatfield),'inf)$
(%i23) my_mat_cond_float(m);
Evaluation took 10.77 seconds (10.77 elapsed)
(%o23) 4043.755233927527
my_mat_cond_float is a bit faster -- it might be more accurate too
(mat_cond doesn't use partial pivoting to invert the matrix,
my_mat_cond_float does).
Barton
-----maxima-bounces at math.utexas.edu wrote: -----
>To: maxima at math.utexas.edu
>From: Patrick Gelin <patrick.gelin at free.fr>
>Sent by: maxima-bounces at math.utexas.edu
>Date: 08/09/2007 03:19AM
>Subject: What about "conditionnement" of a matrix?
>
>Hi,
>
>Is it possible to calculate the "conditionnement" (in french) of a matrix?
>
>Thank you for your help!
>
>Patrick
>_______________________________________________
>Maxima mailing list
>Maxima at math.utexas.edu
>http://www.math.utexas.edu/mailman/listinfo/maxima