12.07.2015 Views

Sage Reference Manual: Matrices and Spaces of Matrices

Sage Reference Manual: Matrices and Spaces of Matrices

Sage Reference Manual: Matrices and Spaces of Matrices

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.2[-----------+-----------][-5/12 3/8| 300 900][ 1/4 -1/8| 600 1000]If the number <strong>of</strong> submatrices in each row is the same, you can specify the submatrices as a single list too:sage: block_matrix(2, 2, [ A, A, A, A ])[ 3 9| 3 9][ 6 10| 6 10][-----+-----][ 3 9| 3 9][ 6 10| 6 10]One can use constant entries:sage: block_matrix([ [1, A], [0, 1] ])[ 1 0| 3 9][ 0 1| 6 10][-----+-----][ 0 0| 1 0][ 0 0| 0 1]A zero entry may represent any square or non-square zero matrix:sage: B = matrix(QQ, 1, 1, [ 1 ] )sage: C = matrix(QQ, 2, 2, [ 2, 3, 4, 5 ] )sage: block_matrix([ [B, 0], [0, C] ])[1|0 0][-+---][0|2 3][0|4 5]One can specify the number <strong>of</strong> rows or columns as keywords too:sage: block_matrix([A, -A, ~A, 100*A], ncols=4)[ 3 9| -3 -9|-5/12 3/8| 300 900][ 6 10| -6 -10| 1/4 -1/8| 600 1000]sage: block_matrix([A, -A, ~A, 100*A], nrows=1)[ 3 9| -3 -9|-5/12 3/8| 300 900][ 6 10| -6 -10| 1/4 -1/8| 600 1000]It h<strong>and</strong>les base rings nicely too:sage: R. = ZZ[’x’]sage: block_matrix(2, 2, [1/2, A, 0, x-1])[ 1/2 0| 3 9][ 0 1/2| 6 10][-----------+-----------][ 0 0|x - 1 0][ 0 0| 0 x - 1]sage: block_matrix(2, 2, [1/2, A, 0, x-1]).parent()Full MatrixSpace <strong>of</strong> 4 by 4 dense matrices over Univariate Polynomial Ring in x over Rational FieSubdivisions are optional. If they are disabled, the columns need not line up:sage: B = matrix(QQ, 2, 3, range(6))sage: block_matrix([ [~A, B], [B, ~A] ], subdivide=False)[-5/12 3/8 0 1 2]23

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

Saved successfully!

Ooh no, something went wrong!