Determinant of 3-by-3 matrices
Jun 7, 2008
The determinant of 3-by-3 matrices is defined as follows:

And no difference with the code:
<script type="text/javascript"> function det3x3(m) { d = m[0][0] * ( m[1][1] * m[2][2] - m[1][2] * m[2][1] ) - m[0][1] * ( m[1][0] * m[2][2] - m[1][2] * m[2][0] ) + m[0][2] * ( m[1][0] * m[2][1] - m[1][1] * m[2][0] ); return(d); } /* always test */ var m = [ [-2, -1, -3], [ 5, -2, 3], [ 4, -3, 7] ]; alert( det3x3(m) ); /* will print: 54 */ </script>
Keywords: determinant, 3 by 3 matrix, javascript
Share:
Save to del.icio.us
Digg this!

Add your comment