Previous Page Next Page Contents

numeric::det -- determinant of a matrix

Introduction

numeric::det(A, ..) returns the determinant of the matrix A.

Call(s)

numeric::det(A <, Symbolic> <, MinorExpansion>)

Parameters

A - a square matrix of domain type DOM_ARRAY or of category Cat::Matrix

Options

Symbolic - prevents conversion of input data to floats
MinorExpansion - computes the determinant by a minor expansion along the first column

Returns

By default the determinant is returned as a floating point number. With the option Symbolic an expression is returned.

Side Effects

Without the option Symbolic the function is sensitive to the environment variable DIGITS, which determines the numerical working precision.

Related Functions

linalg::det

Details

Option: Symbolic

Option: MinorExpansion

Example 1

Numerical matrices can be processed with or without the option Symbolic:

>> A := array(1..3, 1..3,[[1, 1, I], [1, exp(1), I], [1, 2, 2]]): 
>> numeric::det(A), numeric::det(A, Symbolic)
           3.436563657 - 1.718281829 I, (2 - I) exp(1) - (2 - I)

Option Symbolic must be used, when the matrix has non-numerical entries:

>> A := array(1..2, 1..2, [[1/(x + 1),  1], [1/(x + 2), PI]]):
>> numeric::det(A, Symbolic)
                            2 PI - x + x PI - 1
                            -------------------
                                      2
                               3 x + x  + 2

If the option MinorExpansion is used, then symbolic entries are accepted, even if the option Symbolic is not specified:

>> numeric::det(A, MinorExpansion),
   numeric::det(A, Symbolic, MinorExpansion)
                   3.141592654     1.0     PI       1
                   ----------- - -------, ----- - -----
                     x + 1.0     x + 2.0  x + 1   x + 2
>> delete A:

Example 2

The following matrix has domain components:

>> A := Dom::Matrix(Dom::IntegerMod(7))([[6, -1], [1, 6]])
                          +-                  -+
                          |  6 mod 7, 6 mod 7  |
                          |                    |
                          |  1 mod 7, 6 mod 7  |
                          +-                  -+

Note that numeric::det computes the determinant of the following matrix:

>> A::dom::expr(A), numeric::det(A)
                             +-      -+
                             |  6, 6  |
                             |        |, 30.0
                             |  1, 6  |
                             +-      -+

The routine linalg::det must be used, if the determinant is to be computed over the component domain Dom::IntegerMod(7):

>> linalg::det(A)
                                  2 mod 7
>> delete A:

Background

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000