LOGABSDET Function

LOGABSDET (matrix) ;

The LOGABSDET function computes the natural logarithm of the absolute value of the determinant of a matrix, along with the sign of the determinant. The logarithm value is returned as the first element of the returned matrix, and the sign of the determinant is returned as the second element. The value $-1$ signifies a negative determinant, $+1$ signifies a positive determinant, and $0$ signifies a zero determinant. If the determinant is $0$, a missing value is returned in the first element for the logarithm value. This function works even if the value of the determinant is greater than the maximum value possible on the computer.

The following example computes the value of the log of the absolute value of the determinant and then checks it against the determinant value from the DET function:

 z = {1 2 3,
      4 9 6,
      7 8 9};
 det1 = det(z);
 x = logabsdet(z);
 print z;
 print "Log of the absolute value of det(z) " (x[1]);
 print "sign of det(z) " (x[2]);

 /* use the choose() function to help convert x to det(z) */

 det2 = choose(x[2],exp(x[1]) * x[2], 0);

 print "det(z) = " det1 "determinant from LogAbsDet(z) = " det2;

Figure 24.198: Example LogAbsDet Function Call

z
1 2 3
4 9 6
7 8 9

Log of the absolute value of det(z) 3.871201

sign of det(z) -1

  det1   det2
det(z) = -48 determinant from LogAbsDet(z) = -48