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 1 2 3 4]<br />

[ 5 6 7 8 9]<br />

[10 11 12 13 14]<br />

Row subdivisions are preserved by stacking, <strong>and</strong> enriched, if subdivisions are requested. (So multiple<br />

stackings can be recorded.)<br />

sage: A = matrix(QQ, 2, 4, range(8))<br />

sage: A.subdivide([1], None)<br />

sage: B = matrix(QQ, 3, 4, range(12))<br />

sage: B.subdivide([2], None)<br />

sage: A.stack(B, subdivide=True)<br />

[ 0 1 2 3]<br />

[-----------]<br />

[ 4 5 6 7]<br />

[-----------]<br />

[ 0 1 2 3]<br />

[ 4 5 6 7]<br />

[-----------]<br />

[ 8 9 10 11]<br />

Column subdivisions can be preserved, but only if they are identical. Otherwise, this information is discarded<br />

<strong>and</strong> must be managed separately.<br />

sage: A = matrix(QQ, 2, 5, range(10))<br />

sage: A.subdivide(None, [2,4])<br />

sage: B = matrix(QQ, 3, 5, range(15))<br />

sage: B.subdivide(None, [2,4])<br />

sage: A.stack(B, subdivide=True)<br />

[ 0 1| 2 3| 4]<br />

[ 5 6| 7 8| 9]<br />

[-----+-----+--]<br />

[ 0 1| 2 3| 4]<br />

[ 5 6| 7 8| 9]<br />

[10 11|12 13|14]<br />

sage: A.subdivide(None, [1,2])<br />

sage: A.stack(B, subdivide=True)<br />

[ 0 1 2 3 4]<br />

[ 5 6 7 8 9]<br />

[--------------]<br />

[ 0 1 2 3 4]<br />

[ 5 6 7 8 9]<br />

[10 11 12 13 14]<br />

The result retains the base ring <strong>of</strong> self by coercing the elements <strong>of</strong> bottom into the base ring <strong>of</strong> self.<br />

sage: A = matrix(QQ, 1, 2, [1,2])<br />

sage: B = matrix(RR, 1, 2, [sin(1.1), sin(2.2)])<br />

sage: C = A.stack(B); C<br />

[ 1 2]<br />

[183017397/205358938 106580492/131825561]<br />

sage: C.parent()<br />

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

sage: D = B.stack(A); D<br />

[0.891207360061435 0.808496403819590]<br />

[ 1.00000000000000 2.00000000000000]<br />

sage: D.parent()<br />

115

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

Saved successfully!

Ooh no, something went wrong!