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.2sage: ones_matrix(CC)Traceback (most recent call last):...ValueError: constructing an all ones matrix requires at least one dimensionsage.matrix.constructor.prepare(w)Given a list w <strong>of</strong> numbers, find a common ring that they all canonically map to, <strong>and</strong> return the list <strong>of</strong> images <strong>of</strong>the elements <strong>of</strong> w in that ring along with the ring.This is for internal use by the matrix function.INPUT:•w - listOUTPUT:list, ringEXAMPLES:sage: sage.matrix.constructor.prepare([-2, Mod(1,7)])([5, 1], Ring <strong>of</strong> integers modulo 7)Notice that the elements must all canonically coerce to a common ring (since Sequence is called):sage: sage.matrix.constructor.prepare([2/1, Mod(1,7)])Traceback (most recent call last):...TypeError: unable to find a common ring for all elementssage.matrix.constructor.prepare_dict(w)Given a dictionary w <strong>of</strong> numbers, find a common ring that they all canonically map to, <strong>and</strong> return the dictionary<strong>of</strong> images <strong>of</strong> the elements <strong>of</strong> w in that ring along with the ring.This is for internal use by the matrix function.INPUT:•w - dictOUTPUT:dict, ringEXAMPLES:sage: sage.matrix.constructor.prepare_dict({(0,1):2, (4,10):Mod(1,7)})({(0, 1): 2, (4, 10): 1}, Ring <strong>of</strong> integers modulo 7)sage.matrix.constructor.r<strong>and</strong>om_diagonalizable_matrix(parent, eigenvalues=None, dimensions=None)This function is available as r<strong>and</strong>om_diagonalizable_matrix(...) <strong>and</strong> matrix.r<strong>and</strong>om_diagonalizable(...).Create a r<strong>and</strong>om matrix that diagonalizes nicely.To be used as a teaching tool. Return matrices have only real eigenvalues.INPUT:If eigenvalues <strong>and</strong> dimensions are not specified in a list, they will be assigned r<strong>and</strong>omly.•parent - the desired size <strong>of</strong> the square matrix.•eigenvalues - the list <strong>of</strong> desired eigenvalues (default=None).41

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

Saved successfully!

Ooh no, something went wrong!