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: r<strong>and</strong>om_matrix(RR, 40, 88, algorithm=’echelon_form’, num_pivots=39)<br />

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

...<br />

TypeError: the base ring must be exact.<br />

<strong>Matrices</strong> must have the number <strong>of</strong> pivot columns be less than or equal to the number <strong>of</strong> rows.<br />

sage: C=r<strong>and</strong>om_matrix(ZZ, 6,4, algorithm=’echelon_form’, num_pivots=7); C<br />

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

...<br />

ValueError: number <strong>of</strong> pivots cannot exceed the number <strong>of</strong> rows or columns.<br />

<strong>Matrices</strong> must have the number <strong>of</strong> pivot columns be less than or equal to the number <strong>of</strong> columns.<br />

sage: D=r<strong>and</strong>om_matrix(QQ, 1,3, algorithm=’echelon_form’, num_pivots=5); D<br />

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

...<br />

ValueError: number <strong>of</strong> pivots cannot exceed the number <strong>of</strong> rows or columns.<br />

<strong>Matrices</strong> must have the number <strong>of</strong> pivot columns be greater than zero.<br />

sage: r<strong>and</strong>om_matrix(QQ, 5, 4, algorithm=’echelon_form’, num_pivots=-1)<br />

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

...<br />

ValueError: the number <strong>of</strong> pivots must be zero or greater.<br />

AUTHOR:<br />

Billy Wonderly (2010-07)<br />

sage.matrix.constructor.r<strong>and</strong>om_subspaces_matrix(parent, rank=None)<br />

This function is available as r<strong>and</strong>om_subspaces_matrix(...) <strong>and</strong> matrix.r<strong>and</strong>om_subspaces(...).<br />

Create a matrix <strong>of</strong> the designated size <strong>and</strong> rank whose right <strong>and</strong> left null spaces, column space, <strong>and</strong> row space<br />

have desirable properties that simplify the subspaces.<br />

INPUT:<br />

•parent - A matrix space specifying the base ring, dimensions, <strong>and</strong> representation (dense/sparse) for the<br />

result. The base ring must be exact.<br />

•rank - The desired rank <strong>of</strong> the return matrix (default: None).<br />

OUTPUT:<br />

A matrix whose natrual basis vectors for its four subspaces, when computed, have reasonably sized, integral<br />

valued, entries.<br />

Note: It is easiest to use this function via a call to the r<strong>and</strong>om_matrix() function with the<br />

algorithm=’subspaces’ keyword. We provide one example accessing this function directly, while the<br />

remainder will use this more general function.<br />

EXAMPLES:<br />

A 6x8 matrix with designated rank <strong>of</strong> 3. The four subspaces are determined using one simple routine in which<br />

we augment the original matrix with the equal row dimension identity matrix. The resulting matrix is then put in<br />

reduced row-echelon form <strong>and</strong> the subspaces can then be determined by analyzing subdivisions <strong>of</strong> this matrix.<br />

See the four subspaces routine in [BEEZER] for more.<br />

53

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

Saved successfully!

Ooh no, something went wrong!