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

EXAMPLES:<br />

sage: m=matrix(2); m; m.parent()<br />

[0 0]<br />

[0 0]<br />

Full MatrixSpace <strong>of</strong> 2 by 2 dense matrices over Integer Ring<br />

sage: m=matrix(2,3); m; m.parent()<br />

[0 0 0]<br />

[0 0 0]<br />

Full MatrixSpace <strong>of</strong> 2 by 3 dense matrices over Integer Ring<br />

sage: m=matrix(QQ,[[1,2,3],[4,5,6]]); m; m.parent()<br />

[1 2 3]<br />

[4 5 6]<br />

Full MatrixSpace <strong>of</strong> 2 by 3 dense matrices over Rational Field<br />

sage: m = matrix(QQ, 3, 3, lambda i, j: i+j); m<br />

[0 1 2]<br />

[1 2 3]<br />

[2 3 4]<br />

sage: m = matrix(3, lambda i,j: i-j); m<br />

[ 0 -1 -2]<br />

[ 1 0 -1]<br />

[ 2 1 0]<br />

sage: matrix(QQ,2,3,lambda x, y: x+y)<br />

[0 1 2]<br />

[1 2 3]<br />

sage: matrix(QQ,3,2,lambda x, y: x+y)<br />

[0 1]<br />

[1 2]<br />

[2 3]<br />

sage: v1=vector((1,2,3))<br />

sage: v2=vector((4,5,6))<br />

sage: m=matrix([v1,v2]); m; m.parent()<br />

[1 2 3]<br />

[4 5 6]<br />

Full MatrixSpace <strong>of</strong> 2 by 3 dense matrices over Integer Ring<br />

sage: m=matrix(QQ,2,[1,2,3,4,5,6]); m; m.parent()<br />

[1 2 3]<br />

[4 5 6]<br />

Full MatrixSpace <strong>of</strong> 2 by 3 dense matrices over Rational Field<br />

sage: m=matrix(QQ,2,3,[1,2,3,4,5,6]); m; m.parent()<br />

[1 2 3]<br />

[4 5 6]<br />

Full MatrixSpace <strong>of</strong> 2 by 3 dense matrices over Rational Field<br />

sage: m=matrix({(0,1): 2, (1,1):2/5}); m; m.parent()<br />

[ 0 2]<br />

[ 0 2/5]<br />

Full MatrixSpace <strong>of</strong> 2 by 2 sparse matrices over Rational Field<br />

sage: m=matrix(QQ,2,3,{(1,1): 2}); m; m.parent()<br />

[0 0 0]<br />

16 Chapter 2. Matrix Constructor

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

Saved successfully!

Ooh no, something went wrong!