12.07.2015 Views

Sage Reference Manual: Matrices and Spaces of Matrices

Sage Reference Manual: Matrices and Spaces of Matrices

Sage Reference Manual: Matrices and Spaces of Matrices

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.2[0 2 0]Full MatrixSpace <strong>of</strong> 2 by 3 sparse matrices over Rational Fieldsage: import numpysage: n=numpy.array([[1,2],[3,4]],float)sage: m=matrix(n); m; m.parent()[1.0 2.0][3.0 4.0]Full MatrixSpace <strong>of</strong> 2 by 2 dense matrices over Real Double Fieldsage: v = vector(ZZ, [1, 10, 100])sage: m=matrix(v); m; m.parent()[ 1 10 100]Full MatrixSpace <strong>of</strong> 1 by 3 dense matrices over Integer Ringsage: m=matrix(GF(7), v); m; m.parent()[1 3 2]Full MatrixSpace <strong>of</strong> 1 by 3 dense matrices over Finite Field <strong>of</strong> size 7sage: g = graphs.PetersenGraph()sage: m = matrix(g); m; m.parent()[0 1 0 0 1 1 0 0 0 0][1 0 1 0 0 0 1 0 0 0][0 1 0 1 0 0 0 1 0 0][0 0 1 0 1 0 0 0 1 0][1 0 0 1 0 0 0 0 0 1][1 0 0 0 0 0 0 1 1 0][0 1 0 0 0 0 0 0 1 1][0 0 1 0 0 1 0 0 0 1][0 0 0 1 0 1 1 0 0 0][0 0 0 0 1 0 1 1 0 0]Full MatrixSpace <strong>of</strong> 10 by 10 dense matrices over Integer Ringsage: matrix(ZZ, 10, 10, range(100), sparse=True).parent()Full MatrixSpace <strong>of</strong> 10 by 10 sparse matrices over Integer Ringsage: R = PolynomialRing(QQ, 9, ’x’)sage: A = matrix(R, 3, 3, R.gens()); A[x0 x1 x2][x3 x4 x5][x6 x7 x8]sage: det(A)-x2*x4*x6 + x1*x5*x6 + x2*x3*x7 - x0*x5*x7 - x1*x3*x8 + x0*x4*x8TESTS:sage: m=matrix(); m; m.parent()[]Full MatrixSpace <strong>of</strong> 0 by 0 dense matrices over Integer Ringsage: m=matrix(QQ); m; m.parent()[]Full MatrixSpace <strong>of</strong> 0 by 0 dense matrices over Rational Fieldsage: m=matrix(QQ,2); m; m.parent()[0 0][0 0]Full MatrixSpace <strong>of</strong> 2 by 2 dense matrices over Rational Fieldsage: m=matrix(QQ,2,3); m; m.parent()[0 0 0][0 0 0]17

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

Saved successfully!

Ooh no, something went wrong!