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: x,y = var(’x,y’)<br />

sage: v = vector((x,y))<br />

sage: vector_on_axis_rotation_matrix(v, 1)<br />

[ y/sqrt(x^2 + y^2) -x/sqrt(x^2 + y^2)]<br />

[ x/sqrt(x^2 + y^2) y/sqrt(x^2 + y^2)]<br />

sage: vector_on_axis_rotation_matrix(v, 0)<br />

[ x/sqrt(x^2 + y^2) y/sqrt(x^2 + y^2)]<br />

[-y/sqrt(x^2 + y^2) x/sqrt(x^2 + y^2)]<br />

sage: vector_on_axis_rotation_matrix(v, 0) * v<br />

(x^2/sqrt(x^2 + y^2) + y^2/sqrt(x^2 + y^2), 0)<br />

sage: vector_on_axis_rotation_matrix(v, 1) * v<br />

(0, x^2/sqrt(x^2 + y^2) + y^2/sqrt(x^2 + y^2))<br />

sage: v = vector((1,2,3,4))<br />

sage: vector_on_axis_rotation_matrix(v, 0) * v<br />

(sqrt(30), 0, 0, 0)<br />

sage: vector_on_axis_rotation_matrix(v, 0, ring=RealField(10))<br />

[ 0.18 0.37 0.55 0.73]<br />

[-0.98 0.068 0.10 0.14]<br />

[ 0.00 -0.93 0.22 0.30]<br />

[ 0.00 0.00 -0.80 0.60]<br />

sage: vector_on_axis_rotation_matrix(v, 0, ring=RealField(10)) * v<br />

(5.5, 0.00098, 0.00098, 0.00)<br />

AUTHORS:<br />

Sebastien Labbe (April 2010)<br />

sage.matrix.constructor.zero_matrix(ring, nrows, ncols=None, sparse=False)<br />

This function is available as zero_matrix(...) <strong>and</strong> matrix.zero(...).<br />

Return the nrows × ncols zero matrix over the given ring.<br />

The default ring is the integers.<br />

EXAMPLES:<br />

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

[0 0]<br />

[0 0]<br />

sage: M.parent()<br />

Full MatrixSpace <strong>of</strong> 2 by 2 dense matrices over Rational Field<br />

sage: M = zero_matrix(2, 3); M<br />

[0 0 0]<br />

[0 0 0]<br />

sage: M.parent()<br />

Full MatrixSpace <strong>of</strong> 2 by 3 dense matrices over Integer Ring<br />

sage: M.is_mutable()<br />

True<br />

sage: M = zero_matrix(3, 1, sparse=True); M<br />

[0]<br />

[0]<br />

[0]<br />

sage: M.parent()<br />

Full MatrixSpace <strong>of</strong> 3 by 1 sparse matrices over Integer Ring<br />

sage: M.is_mutable()<br />

True<br />

58 Chapter 2. Matrix Constructor

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

Saved successfully!

Ooh no, something went wrong!