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

OUTPUT:<br />

A new matrix formed by appending right onto the right side <strong>of</strong> self. If right is a vector (or free<br />

module element) then in this context it is appropriate to consider it as a column vector. (The code first<br />

converts a vector to a 1-column matrix.)<br />

EXAMPLES:<br />

sage: A = matrix(ZZ, 4, 5, range(20))<br />

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

sage: A.augment(B)<br />

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

[ 5 6 7 8 9 3 4 5]<br />

[10 11 12 13 14 6 7 8]<br />

[15 16 17 18 19 9 10 11]<br />

A vector may be augmented to a matrix.<br />

sage: A = matrix(ZZ, 3, 5, range(15))<br />

sage: v = vector(ZZ, 3, range(3))<br />

sage: A.augment(v)<br />

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

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

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

The subdivide option will add a natural subdivision between self <strong>and</strong> right.<br />

For more details about how subdivisions are managed when augmenting, see<br />

sage.matrix.matrix1.Matrix.augment().<br />

sage: A = matrix(ZZ, 3, 5, range(15))<br />

sage: B = matrix(ZZ, 3, 3, range(9))<br />

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

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

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

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

Errors are raised if the sizes are incompatible.<br />

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

sage: B = matrix(ZZ, [[10, 20], [30, 40], [50, 60]])<br />

sage: A.augment(B)<br />

Traceback (most recent call last):<br />

...<br />

TypeError: number <strong>of</strong> rows must be the same, not 2 != 3<br />

charpoly(var=’x’, algorithm=’linbox’)<br />

INPUT:<br />

•var - a variable name<br />

•algorithm - ‘linbox’ (default) ‘generic’<br />

Note: Linbox charpoly disabled on 64-bit machines, since it hangs in many cases.<br />

EXAMPLES:<br />

sage: A = matrix(ZZ,6, range(36))<br />

sage: f = A.charpoly(); f<br />

x^6 - 105*x^5 - 630*x^4<br />

sage: f(A) == 0<br />

318 Chapter 17. Dense matrices over the integer ring

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

Saved successfully!

Ooh no, something went wrong!