08.02.2015 Views

Sage Reference Manual: Matrices and Spaces of Matrices - Mirrors

Sage Reference Manual: Matrices and Spaces of Matrices - Mirrors

Sage Reference Manual: Matrices and Spaces of Matrices - Mirrors

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Sage</strong> <strong>Reference</strong> <strong>Manual</strong>: <strong>Matrices</strong> <strong>and</strong> <strong>Spaces</strong> <strong>of</strong> <strong>Matrices</strong>, Release 6.1.1<br />

sage: m.log_determinant()<br />

0.69314718056<br />

sage: m = matrix(RDF,0,0,[]); m<br />

[]<br />

sage: m.log_determinant()<br />

0.0<br />

sage: m = matrix(CDF,2,2,range(4)); m<br />

[0.0 1.0]<br />

[2.0 3.0]<br />

sage: RDF(log(abs(m.determinant())))<br />

0.69314718056<br />

sage: m.log_determinant()<br />

0.69314718056<br />

sage: m = matrix(CDF,0,0,[]); m<br />

[]<br />

sage: m.log_determinant()<br />

0.0<br />

norm(p=None)<br />

Returns the norm <strong>of</strong> the matrix.<br />

INPUT:<br />

•p - default: ‘frob’ - controls which norm is computed, allowable values are ‘frob’ (for the Frobenius<br />

norm), integers -2, -1, 1, 2, positive <strong>and</strong> negative infinity. See output discussion for specifics. The<br />

default (p=’frob’) is deprecated <strong>and</strong> will change to a default <strong>of</strong> p=2 soon.<br />

OUTPUT:<br />

Returned value is a double precision floating point value in RDF. Row <strong>and</strong> column sums described below<br />

are sums <strong>of</strong> the absolute values <strong>of</strong> the entries, where the absolute value <strong>of</strong> the complex number a + bi is<br />

√<br />

a2 + b 2 . Singular values are the “diagonal” entries <strong>of</strong> the “S” matrix in the singular value decomposition.<br />

•p = ’frob’: the Frobenius norm, which for a matrix A = (a ij ) computes<br />

⎛<br />

⎝ ∑ i,j<br />

⎞1/2<br />

|a i,j | 2 ⎠<br />

•p = Infinity or p = oo: the maximum row sum.<br />

•p = -Infinity or p = -oo: the minimum column sum.<br />

•p = 1: the maximum column sum.<br />

•p = -1: the minimum column sum.<br />

•p = 2: the induced 2-norm, equal to the maximum singular value.<br />

•p = -2: the minimum singular value.<br />

ALGORITHM:<br />

Computation is performed by the norm() function <strong>of</strong> the SciPy/NumPy library.<br />

EXAMPLES:<br />

First over the reals.<br />

sage: A = matrix(RDF, 3, range(-3, 6)); A<br />

[-3.0 -2.0 -1.0]<br />

[ 0.0 1.0 2.0]<br />

378 Chapter 19. Dense matrices using a NumPy backend.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!