/usr/share/calc/help/det is in apcalc-common 2.12.5.0-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | NAME
det - determinant
SYNOPSIS
det(m)
TYPES
m square matrix with elements of suitable type
return zero or value of type determined by types of elements
DESCRIPTION
The matrix m has to be square, i.e. of dimension 2 with:
matmax(m,1) - matmin(m,1) == matmax(m,2) - matmin(m,2).
If the elements of m are numbers (real or complex), det(m)
returns the value of the determinant of m.
If some or all of the elements of m are not numbers, the algorithm
used to evaluate det(m) assumes the definitions of *, unary -, binary -,
being zero or nonzero, are consistent with commutative ring structure,
and if the m is larger than 2 x 2, division by nonzero elements is
consistent with integral-domain structure.
If m is a 2 x 2 matrix with elements a, b, c, d, where a tests as
nonzero, det(m) is evaluated by
det(m) = (a * d) - (c * b).
If a tests as zero, det(m) = - ((c * b) - (a * d)) is used.
If m is 3 * 3 with elements a, b, c, d, e, f, g, h, i, where a and
a * e - d * b test as nonzero, det(m) is evaluated by
det(m) = ((a * e - d * b) * (a * i - g * c)
- (a * h - g * b) * (a * f - d * c))/a.
EXAMPLE
; mat A[3,3] = {2, 3, 5, 7, 11, 13, 17, 19, 23}
; c = config("mode", "frac")
; print det(A), det(A^2), det(A^3), det(A^-1)
-78 6084 -474552 -1/78
; obj res {r}
; global md
; define res_test(a) = !ismult(a.r, md)
; define res_sub(a,b) {local obj res v = {(a.r - b.r) % md}; return v;}
; define res_mul(a,b) {local obj res v = {(a.r * b.r) % md}; return v;}
; define res_neg(a) {local obj res v = {(-a.r) % md}; return v;}
; define res(x) {local obj res v = {x % md}; return v;}
; md = 0
; mat A[2,2] = {res(2), res(3), res(5), res(7)}
; md = 5
; print det(A)
obj res {4}
; md = 6
; print det(A)
obj res {5}
Note that if A had been a 3 x 3 or larger matrix, res_div(a,b) for
non-zero b would have had to be defined (assuming at least one
division is necessary); for consistent results when md is composite,
res_div(a,b) should be defined only when b and md are relatively
prime; there is no problem when md is prime.
LIMITS
none
LINK LIBRARY
VALUE matdet(MATRIX *m)
SEE ALSO
matdim, matmax, matmin, inverse
## Copyright (C) 1999 Landon Curt Noll
##
## Calc is open software; you can redistribute it and/or modify it under
## the terms of the version 2.1 of the GNU Lesser General Public License
## as published by the Free Software Foundation.
##
## Calc is distributed in the hope that it will be useful, but WITHOUT
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
## Public License for more details.
##
## A copy of version 2.1 of the GNU Lesser General Public License is
## distributed with calc under the filename COPYING-LGPL. You should have
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
##
## @(#) $Revision: 30.1 $
## @(#) $Id: det,v 30.1 2007/03/16 11:10:42 chongo Exp $
## @(#) $Source: /usr/local/src/bin/calc/help/RCS/det,v $
##
## Under source code control: 1995/11/28 11:17:47
## File existed as early as: 1995
##
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|