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

sage: A = matrix(ZZ, 4, 10, range(40)); A<br />

[ 0 1 2 3 4 5 6 7 8 9]<br />

[10 11 12 13 14 15 16 17 18 19]<br />

[20 21 22 23 24 25 26 27 28 29]<br />

[30 31 32 33 34 35 36 37 38 39]<br />

sage: E = elementary_matrix(4, row1=1, row2=3); E<br />

[1 0 0 0]<br />

[0 0 0 1]<br />

[0 0 1 0]<br />

[0 1 0 0]<br />

sage: E*A<br />

[ 0 1 2 3 4 5 6 7 8 9]<br />

[30 31 32 33 34 35 36 37 38 39]<br />

[20 21 22 23 24 25 26 27 28 29]<br />

[10 11 12 13 14 15 16 17 18 19]<br />

sage: E = elementary_matrix(4, row1=2, scale=10); E<br />

[ 1 0 0 0]<br />

[ 0 1 0 0]<br />

[ 0 0 10 0]<br />

[ 0 0 0 1]<br />

sage: E*A<br />

[ 0 1 2 3 4 5 6 7 8 9]<br />

[ 10 11 12 13 14 15 16 17 18 19]<br />

[200 210 220 230 240 250 260 270 280 290]<br />

[ 30 31 32 33 34 35 36 37 38 39]<br />

sage: E = elementary_matrix(4, row1=2, row2=1, scale=10); E<br />

[ 1 0 0 0]<br />

[ 0 1 0 0]<br />

[ 0 10 1 0]<br />

[ 0 0 0 1]<br />

sage: E*A<br />

[ 0 1 2 3 4 5 6 7 8 9]<br />

[ 10 11 12 13 14 15 16 17 18 19]<br />

[120 131 142 153 164 175 186 197 208 219]<br />

[ 30 31 32 33 34 35 36 37 38 39]<br />

Over the rationals, now as column operations. Recall that row <strong>and</strong> column numbering begins at zero. Checks<br />

now have the elementary matrix on the right.<br />

sage: A = matrix(QQ, 5, 4, range(20)); A<br />

[ 0 1 2 3]<br />

[ 4 5 6 7]<br />

[ 8 9 10 11]<br />

[12 13 14 15]<br />

[16 17 18 19]<br />

sage: E = elementary_matrix(QQ, 4, col1=1, col2=3); E<br />

[1 0 0 0]<br />

[0 0 0 1]<br />

[0 0 1 0]<br />

[0 1 0 0]<br />

sage: A*E<br />

[ 0 3 2 1]<br />

[ 4 7 6 5]<br />

[ 8 11 10 9]<br />

32 Chapter 2. Matrix Constructor

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

Saved successfully!

Ooh no, something went wrong!