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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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

•zero - string (default: None); if not None use the value <strong>of</strong> zero as the representation <strong>of</strong> the zero<br />

element.<br />

•plus_one - string (default: None); if not None use the value <strong>of</strong> plus_one as the representation<br />

<strong>of</strong> the one element.<br />

•minus_one - string (default: None); if not None use the value <strong>of</strong> minus_one as the representation<br />

<strong>of</strong> the negative <strong>of</strong> the one element.<br />

EXAMPLES:<br />

sage: R = PolynomialRing(QQ,6,’z’)<br />

sage: a = matrix(2,3, R.gens())<br />

sage: a.__repr__()<br />

’[z0 z1 z2]\n[z3 z4 z5]’<br />

sage: M = matrix([[1,0],[2,-1]])<br />

sage: M.str()<br />

’[ 1 0]\n[ 2 -1]’<br />

sage: M.str(plus_one=’+’,minus_one=’-’,zero=’.’)<br />

’[+ .]\n[2 -]’<br />

sage: M.str({1:"not this one",2:"II"},minus_one="*",plus_one="I")<br />

’[ I 0]\n[II *]’<br />

sage: def print_entry(x):<br />

... if x>0:<br />

... return ’+’<br />

... elif x

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

Saved successfully!

Ooh no, something went wrong!