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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<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 />

[0.750000000000000 0.800000000000000 0.833333333333333]<br />

[0.857142857142857 0.875000000000000 0.888888888888889]<br />

[0.900000000000000 0.909090909090909 0.916666666666667]<br />

sage: matrix(SR, 2, 2, range(4)).n()<br />

[0.000000000000000 1.00000000000000]<br />

[ 2.00000000000000 3.00000000000000]<br />

sage: numerical_approx(M)<br />

[0.000000000000000 0.500000000000000 0.666666666666667]<br />

[0.750000000000000 0.800000000000000 0.833333333333333]<br />

[0.857142857142857 0.875000000000000 0.888888888888889]<br />

[0.900000000000000 0.909090909090909 0.916666666666667]<br />

norm(p=2)<br />

Return the p-norm <strong>of</strong> this matrix, where p can be 1, 2, inf, or the Frobenius norm.<br />

INPUT:<br />

•self - a matrix whose entries are coercible into CDF<br />

•p - one <strong>of</strong> the following options:<br />

•1 - the largest column-sum norm<br />

•2 (default) - the Euclidean norm<br />

•Infinity - the largest row-sum norm<br />

•’frob’ - the Frobenius (sum <strong>of</strong> squares) norm<br />

OUTPUT: RDF number<br />

See Also:<br />

•sage.misc.functional.norm()<br />

EXAMPLES:<br />

sage: A = matrix(ZZ, [[1,2,4,3],[-1,0,3,-10]])<br />

sage: A.norm(1)<br />

13.0<br />

sage: A.norm(Infinity)<br />

14.0<br />

sage: B = r<strong>and</strong>om_matrix(QQ, 20, 21)<br />

sage: B.norm(Infinity) == (B.transpose()).norm(1)<br />

True<br />

sage: Id = identity_matrix(12)<br />

sage: Id.norm(2)<br />

1.0<br />

sage: A = matrix(RR, 2, 2, [13,-4,-4,7])<br />

sage: A.norm()<br />

15.0<br />

Norms <strong>of</strong> numerical matrices over high-precision reals are computed by this routine. Faster routines for<br />

double precision entries from RDF or CDF are provided by the Matrix_double_dense class.<br />

sage: A = matrix(CC, 2, 3, [3*I,4,1-I,1,2,0])<br />

sage: A.norm(’frob’)<br />

5.65685424949<br />

sage: A.norm(2)<br />

216 Chapter 7. Base class for matrices, part 2

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

Saved successfully!

Ooh no, something went wrong!