X-Git-Url: http://gitweb.scilab.org/?p=scilab.git;a=blobdiff_plain;f=scilab%2Fmodules%2Flinear_algebra%2Fhelp%2Fen_US%2Fmatrix%2Fdet.xml;h=c6df8626b79fc53ec284c966f5bf4efdbd00a16a;hp=a032d969ef5d7acd0c1d01a40ad022f88f5e3e9d;hb=f1819087c210db1e6b75849406b83cc10c093cf0;hpb=600c8c0bde0167a84d6b9cf50b4ef3916d0c26cc diff --git a/scilab/modules/linear_algebra/help/en_US/matrix/det.xml b/scilab/modules/linear_algebra/help/en_US/matrix/det.xml index a032d96..c6df862 100644 --- a/scilab/modules/linear_algebra/help/en_US/matrix/det.xml +++ b/scilab/modules/linear_algebra/help/en_US/matrix/det.xml @@ -2,8 +2,8 @@ - + det - determinant + determinant of a square matrix Syntax - det(X) - [e,m]=det(X) + + d = det(X) + [e,m] = det(X) @@ -30,19 +34,36 @@ X - real or complex square matrix, polynomial or rational matrix. + square matrix of real or complex numbers, polynomials, or rationals. + Sparse-encoded matrices accepted. + + + + + d + + Scalar of the X's type: the determinant of + X. If X is sparse-encoded, + d is dense. + m - real or complex number, the determinant base 10 mantissae + real or complex number: the determinant base 10 mantissa, with + abs(m) â [1,10). Not supported for X + polynomial or rational. + e - integer, the determinant base 10 exponent + integer: the determinant base 10 exponent, such that + d = m * 10e. + Not supported for X polynomial or rational. + @@ -50,45 +71,165 @@ Description - det(X) ( m*10^e is the determinant of the square matrix X. + d = det(X) yields the determinant of the matrix + X. + + + For a polynomial or rational matrix, d=det(X) uses determ(..) + whose algorithm is based on the FFT. + d=detr(X) can be alternatively used, based on the Leverrier algorithm. + Both methods yield equivalent results. For rational matrices, turning off `simp_mode(%f)` + might be required to get identical results. - For polynomial matrix det(X) is equivalent to determ(X). + [e, m] = det(X) can be used only for a matrix of numbers. + This syntax allows to overcome computation's underflow or overflow, when abs(d) + is smaller than + number_properties("tiny") â 2.23 10-308 or + bigger than number_properties("huge") â 1.80 10308. - For rational matrices det(X) is equivalent to detr(X). + For denses matrices, det(..) is based on the Lapack routines + DGETRF for real matrices and ZGETRF for the complex case. - - The det and detr functions don't use the same algorithm. - For a rational fraction, det(X) is overloaded by %r_det(X) which is based on the determ function. - detr() uses the Leverrier method. - - - Sometimes the det and detr functions may return different values for rational matrices. - In such cases you should set rational simplification mode off by using `simp_mode(%f)` to get the same result. - + For sparse matrices, the determinant is obtained from LU factorization thanks to the umfpack library. - References + Examples + + A = rand(3,3)*5; +--> det(A) + ans = + -10.805163 + +--> [e, m] = det(A) + e = + 1. + m = + -1.0805163 + +--> // Matrix of complex numbers: +--> A = [3+%i, 9+%i*3, 9+%i ; 8+%i*8, 4+%i*3, 7+%i*7 ; 4, 6+%i*2, 6+%i*9] + A = + 3. + i 9. + 3.i 9. + i + 8. + 8.i 4. + 3.i 7. + 7.i + 4. + 0.i 6. + 2.i 6. + 9.i + +--> det(A) + ans = + 745. - 225.i + +--> [e, m] = det(A) + e = + 2. + m = + 7.45 - 2.25i + +--> abs(m) // in [1, 10) + ans = + 7.7823518 +]]> + - det computations are based on the Lapack routines - DGETRF for real matrices and ZGETRF for the complex case. + Very big or small determinants: underflow and overflow handling: + + // Very big determinant: +--> A = rand(n, n); +--> det(A) + ans = + -Inf + +--> [e, m] = det(A) // -3.1199e743 + e = + 743. + m = + -3.1198687 + +--> // Very small determinant (of a sparse-encoded matrix): +--> n = 1000; +--> A = (triu(sprand(n,n,1)) + diag(rand(1,n)))/1.5; +--> det(A) + ans = + 5.21D-236 + +--> prod(diag(A)) + ans = + 5.21D-236 + +--> [e, m] = det(A) + e = + -236. + m = + 5.2119757 + +--> A = A/2; +--> det(A) + ans = + 0. + +--> [e, m] = det(A) + e = + -537. + m = + 4.8641473 +]]> + - Concerning sparse matrices, the determinant is obtained from LU factorization of umfpack library. + Determinant of a polynomial matrix: - - - Examples +s = %s; +det([s, 1+s ; 2-s, s^2]) + +w = ssrand(2,2,4); +roots(det(systmat(w))),trzeros(w) //zeros of linear system + ]]> + det([s, 1+s ; 2-s, s^2]) + ans = + -2 -s +sÂ² +sÂ³ + +--> w = ssrand(2,2,4); +--> roots(det(systmat(w))),trzeros(w) + ans = + -3.1907522 + 0.i + 2.3596502 + 0.i + + ans = + 2.3596502 + 0.i + -3.1907522 + 0.i +]]> See also @@ -104,4 +245,15 @@ det(A), prod(spec(A)) + + History + + + 6.1.1 + + [e,m]=det(X) syntax extended to sparse matrices. + + + +