Mat Det Command

Purpose

Calculates the determinant of a two-dimensional floating point array which is interpreted as a matrix.

Syntax

Mat Det x=a([i, j])[,n]

a():name of a two-dimensional floating point array

x:aexp

i, j, n:integer expression

Description

Mat Det x=a([i, j])[,n] calculates the determinant of a square matrix of type (n,n). A determinant of a square section of a matrix can also be calculated. This matrix section is defined by i and j for row and column offsets in a() and by n for the number of elements. An internal matrix of (n,n) type is thereby created at i-th row and j-th column.

Example

OpenW # 1

Data 2,4.5,6,3.2,7,1.7,-4,12

Data -3,5,9,-2.1,6,9,11,3

Data 11.4,2.3,6,3.2,6,1.2,-5,7

Data 3,5,6,8.2,4.1,-5.2,6.2,7.9

Data 1,2.3,9,8.1,0,4.2,5,3.7

Data 4.2,7.1,8.3,9.1,-5,-3,-1,0

Data 2.0,3,9.1,0,0,7.1,-3,8.8

Data 2.1,9,3.3,4,5,-1,-2,0

Global Double a(1 .. 8, 1 .. 8), x, y, z

Global Double b(1 .. 4, 1 .. 4), k%

Mat Read a()

Mat Print a(), 5, 2 // original matrix

Print

//to calculate the determinant

Mat Det x = a()

Print "Determinant = "; x

Print

Print "Press any Key"

KeyGet k%

Cls

Mat Det y = a(3, 2), 4//calculates the determinant

//of a matrix segment

Print "Segment determinant= "; y

Print

Mat Cpy b() = a(3, 2), 4, 4

Mat Print b(), 5, 2

Print

Mat Det z = b()

Print "Determinant = "; z

See Also

Mat QDet, Mat Rank, Mat Inv

{Created by Sjouke Hamstra; Last updated: 14/10/2014 by James Gaite}