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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<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(QQ, 3, 4, algorithm=’echelonizable’, rank=-1)<br />

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

...<br />

ValueError: matrices must have rank zero or greater.<br />

sage: r<strong>and</strong>om_matrix(QQ, 3, 8, algorithm=’echelonizable’, rank=4)<br />

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

...<br />

ValueError: matrices cannot have rank greater than min(ncols,nrows).<br />

sage: r<strong>and</strong>om_matrix(QQ, 8, 3, algorithm=’echelonizable’, rank=4)<br />

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

...<br />

ValueError: matrices cannot have rank greater than min(ncols,nrows).<br />

The base ring must be exact.<br />

sage: r<strong>and</strong>om_matrix(RR, 3, 3, algorithm=’echelonizable’, rank=2)<br />

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

...<br />

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

Works for rank==1, too.<br />

sage: r<strong>and</strong>om_matrix( QQ, 3, 3, algorithm=’echelonizable’, rank=1).ncols()<br />

3<br />

AUTHOR:<br />

Billy Wonderly (2010-07)<br />

sage.matrix.constructor.r<strong>and</strong>om_matrix(ring, nrows, ncols=None, algorithm=’r<strong>and</strong>omize’,<br />

*args, **kwds)<br />

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

Return a r<strong>and</strong>om matrix with entries in a specified ring, <strong>and</strong> possibly with additional properties.<br />

INPUT:<br />

•ring - base ring for entries <strong>of</strong> the matrix<br />

•nrows - Integer; number <strong>of</strong> rows<br />

•ncols - (default: None); number <strong>of</strong> columns; if None defaults to nrows<br />

•algorithm - (default: r<strong>and</strong>omize); determines what properties the matrix will have. See examples<br />

below for possible additional arguments.<br />

–r<strong>and</strong>omize - r<strong>and</strong>omize the elements <strong>of</strong> the matrix, possibly controlling the density <strong>of</strong> non-zero<br />

entries.<br />

–echelon_form - creates a matrix in echelon form<br />

–echelonizable - creates a matrix that has a predictable echelon form<br />

–subspaces - creates a matrix whose four subspaces, when explored, have reasonably sized, integral<br />

valued, entries.<br />

–unimodular - creates a matrix <strong>of</strong> determinant 1.<br />

–diagonalizable - creates a diagonalizable matrix whose eigenvectors, if computed by h<strong>and</strong>, will<br />

have only integer entries.<br />

•*args, **kwds - arguments <strong>and</strong> keywords to describe additional properties. See more detailed documentation<br />

below.<br />

46 Chapter 2. Matrix Constructor

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

Saved successfully!

Ooh no, something went wrong!