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

inverse()<br />

Returns the inverse <strong>of</strong> self, without changing self.<br />

Note that one can use the Python inverse operator to obtain the inverse as well.<br />

EXAMPLES:<br />

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

sage: m^(-1)<br />

[ -2 1]<br />

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

sage: m.inverse()<br />

[ -2 1]<br />

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

sage: ~m<br />

[ -2 1]<br />

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

sage: m = matrix([[1,2],[3,4]], sparse=True)<br />

sage: m^(-1)<br />

[ -2 1]<br />

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

sage: m.inverse()<br />

[ -2 1]<br />

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

sage: ~m<br />

[ -2 1]<br />

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

sage: m.I<br />

[ -2 1]<br />

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

TESTS:<br />

sage: matrix().inverse()<br />

[]<br />

is_bistochastic(normalized=True)<br />

Returns True if this matrix is bistochastic.<br />

A matrix is said to be bistochastic if both the sums <strong>of</strong> the entries <strong>of</strong> each row <strong>and</strong> the sum <strong>of</strong> the entries <strong>of</strong><br />

each column are equal to 1.<br />

INPUT:<br />

•normalized – if set to True (default), checks that the sums are equal to 1. When set to False,<br />

checks that the row sums <strong>and</strong> column sums are all equal to some constant possibly different from 1.<br />

EXAMPLES:<br />

The identity matrix is clearly bistochastic:<br />

sage: Matrix(5,5,1).is_bistochastic()<br />

True<br />

The same matrix, multiplied by 2, is not bistochastic anymore, though is verifies the constraints <strong>of</strong><br />

normalized == False:<br />

sage: (2 * Matrix(5,5,1)).is_bistochastic()<br />

False<br />

sage: (2 * Matrix(5,5,1)).is_bistochastic(normalized = False)<br />

True<br />

184 Chapter 7. Base class for matrices, part 2

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

Saved successfully!

Ooh no, something went wrong!