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

A matrix over the number Field in y with defining polynomial y 2 − 2y − 2.<br />

sage: y = var(’y’)<br />

sage: K=NumberField(y^2-2*y-2,’y’)<br />

sage: C=r<strong>and</strong>om_matrix(K, 3, algorithm=’unimodular’);C # r<strong>and</strong>om<br />

[ 2*y - 33 681*y - 787 31*y - 37]<br />

[ y + 6 -155*y + 83 -7*y + 4]<br />

[ -y 24*y + 51 y + 3]<br />

sage: det(C)<br />

1<br />

TESTS:<br />

Unimodular matrices are square.<br />

sage: r<strong>and</strong>om_matrix(QQ, 5, 6, algorithm=’unimodular’)<br />

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

...<br />

TypeError: a unimodular matrix must be square.<br />

Only matrices over ZZ <strong>and</strong> QQ can have size control.<br />

sage: F.=GF(5^7)<br />

sage: r<strong>and</strong>om_matrix(F, 5, algorithm=’unimodular’, upper_bound=20)<br />

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

...<br />

TypeError: only matrices over ZZ or QQ can have size control.<br />

AUTHOR:<br />

Billy Wonderly (2010-07)<br />

sage.matrix.constructor.vector_on_axis_rotation_matrix(v, i, ring=None)<br />

This function is available as vector_on_axis_rotation_matrix(...) <strong>and</strong> matrix.vector_on_axis_rotation(...).<br />

Return a rotation matrix M such that det(M) = 1 sending the vector v on the i-th axis so that all other<br />

coordinates <strong>of</strong> Mv are zero.<br />

Note: Such a matrix is not uniquely determined. This function returns one such matrix.<br />

INPUT:<br />

•v‘ - vector<br />

•i - integer<br />

•ring - ring (optional, default: None) <strong>of</strong> the resulting matrix<br />

OUTPUT:<br />

A matrix<br />

EXAMPLES:<br />

sage: from sage.matrix.constructor import vector_on_axis_rotation_matrix<br />

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

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

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

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

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

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

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

57

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

Saved successfully!

Ooh no, something went wrong!