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

TypeError: similarity requires a matrix as an argument, not garbage<br />

sage: B = copy(A)<br />

sage: A.is_similar(B, transformation=’junk’)<br />

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

...<br />

ValueError: transformation keyword must be True or False, not junk<br />

is_unitary()<br />

Returns True if the columns <strong>of</strong> the matrix are an orthonormal basis.<br />

For a matrix with real entries this determines if a matrix is “orthogonal” <strong>and</strong> for a matrix with complex<br />

entries this determines if the matrix is “unitary.”<br />

OUTPUT:<br />

True if the matrix is square <strong>and</strong> its conjugate-transpose is its inverse, <strong>and</strong> False otherwise. In other<br />

words, a matrix is orthogonal or unitary if the product <strong>of</strong> its conjugate-transpose times the matrix is the<br />

identity matrix.<br />

For numerical matrices a specialized routine available over RDF <strong>and</strong> CDF is a good choice.<br />

EXAMPLES:<br />

sage: A = matrix(QQbar, [[(1/sqrt(5))*(1+i), (1/sqrt(55))*(3+2*I), (1/sqrt(22))*(2+2*I)],<br />

... [(1/sqrt(5))*(1-i), (1/sqrt(55))*(2+2*I), (1/sqrt(22))*(-3+I)],<br />

... [ (1/sqrt(5))*I, (1/sqrt(55))*(3-5*I), (1/sqrt(22))*(-2)]])<br />

sage: A.is_unitary()<br />

True<br />

A permutation matrix is always orthogonal.<br />

sage: sigma = Permutation([1,3,4,5,2])<br />

sage: P = sigma.to_matrix(); P<br />

[1 0 0 0 0]<br />

[0 0 0 0 1]<br />

[0 1 0 0 0]<br />

[0 0 1 0 0]<br />

[0 0 0 1 0]<br />

sage: P.is_unitary()<br />

True<br />

sage: P.change_ring(GF(3)).is_unitary()<br />

True<br />

sage: P.change_ring(GF(3)).is_unitary()<br />

True<br />

A square matrix far from unitary.<br />

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

sage: A.is_unitary()<br />

False<br />

Rectangular matrices are never unitary.<br />

sage: A = matrix(QQbar, 3, 4)<br />

sage: A.is_unitary()<br />

False<br />

jordan_form(base_ring=None, sparse=False, subdivide=True, transformation=False, eigenvalues=None,<br />

check_input=True)<br />

Compute the Jordan normal form <strong>of</strong> this square matrix A, if it exists.<br />

195

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

Saved successfully!

Ooh no, something went wrong!