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

[1]<br />

[2]<br />

act_on_polynomial(f )<br />

Returns the polynomial f(self*x).<br />

INPUT:<br />

•self - an nxn matrix<br />

•f - a polynomial in n variables x=(x1,...,xn)<br />

OUTPUT: The polynomial f(self*x).<br />

EXAMPLES:<br />

sage: R. = QQ[]<br />

sage: x, y = R.gens()<br />

sage: f = x**2 - y**2<br />

sage: M = MatrixSpace(QQ, 2)<br />

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

sage: A.act_on_polynomial(f)<br />

-8*x^2 - 20*x*y - 12*y^2<br />

add_multiple_<strong>of</strong>_column(i, j, s, start_row=0)<br />

Add s times column j to column i.<br />

EXAMPLES: We add -1 times the third column to the second column <strong>of</strong> an integer matrix, remembering<br />

to start numbering cols at zero:<br />

sage: a = matrix(ZZ,2,3,range(6)); a<br />

[0 1 2]<br />

[3 4 5]<br />

sage: a.add_multiple_<strong>of</strong>_column(1,2,-1)<br />

sage: a<br />

[ 0 -1 2]<br />

[ 3 -1 5]<br />

To add a rational multiple, we first need to change the base ring:<br />

sage: a = a.change_ring(QQ)<br />

sage: a.add_multiple_<strong>of</strong>_column(1,0,1/3)<br />

sage: a<br />

[ 0 -1 2]<br />

[ 3 0 5]<br />

If not, we get an error message:<br />

sage: a.add_multiple_<strong>of</strong>_column(1,0,i)<br />

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

...<br />

TypeError: Multiplying column by Symbolic Ring element cannot be done over Rational Field, u<br />

add_multiple_<strong>of</strong>_row(i, j, s, start_col=0)<br />

Add s times row j to row i.<br />

EXAMPLES: We add -3 times the first row to the second row <strong>of</strong> an integer matrix, remembering to start<br />

numbering rows at zero:<br />

sage: a = matrix(ZZ,2,3,range(6)); a<br />

[0 1 2]<br />

[3 4 5]<br />

70 Chapter 5. Base class for matrices, part 0

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

Saved successfully!

Ooh no, something went wrong!