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: The following matrix is invertible over Q but not over Z.<br />

sage: A = MatrixSpace(ZZ, 2)(range(4))<br />

sage: A.is_invertible()<br />

False<br />

sage: A.matrix_over_field().is_invertible()<br />

True<br />

The inverse function is a constructor for matrices over the fraction field, so it can work even if A is not<br />

invertible.<br />

sage: ~A # inverse <strong>of</strong> A<br />

[-3/2 1/2]<br />

[ 1 0]<br />

The next matrix is invertible over Z.<br />

sage: A = MatrixSpace(IntegerRing(),2)([1,10,0,-1])<br />

sage: A.is_invertible()<br />

True<br />

sage: ~A<br />

# compute the inverse<br />

[ 1 10]<br />

[ 0 -1]<br />

The following nontrivial matrix is invertible over Z[x].<br />

sage: R. = PolynomialRing(IntegerRing())<br />

sage: A = MatrixSpace(R,2)([1,x,0,-1])<br />

sage: A.is_invertible()<br />

True<br />

sage: ~A<br />

[ 1 x]<br />

[ 0 -1]<br />

is_mutable()<br />

Return True if this matrix is mutable.<br />

See the documentation for self.set_immutable for more details about mutability.<br />

EXAMPLES:<br />

sage: A = Matrix(QQ[’t’,’s’], 2, 2, range(4))<br />

sage: A.is_mutable()<br />

True<br />

sage: A.set_immutable()<br />

sage: A.is_mutable()<br />

False<br />

is_singular()<br />

Returns True if self is singular.<br />

OUTPUT:<br />

A square matrix is singular if it has a zero determinant <strong>and</strong> this method will return True in exactly this<br />

case. When the entries <strong>of</strong> the matrix come from a field, this is equivalent to having a nontrivial kernel, or<br />

lacking an inverse, or having linearly dependent rows, or having linearly dependent columns.<br />

For square matrices over a field the methods is_invertible() <strong>and</strong> is_singular() are logical<br />

opposites. However, it is an error to apply is_singular() to a matrix that is not square, while<br />

is_invertible() will always return False for a matrix that is not square.<br />

EXAMPLES:<br />

75

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

Saved successfully!

Ooh no, something went wrong!