linalg(deprecated)/randmatrix - Help

linalg(deprecated)

 randmatrix
 random matrix generator

 Calling Sequence randmatrix(m, n, options)

Parameters

 m, n - positive integers options - (optional) names or equations

Description

 • Important: The linalg package has been deprecated. Use the superseding command LinearAlgebra[RandomMatrix], instead.
 - For information on migrating linalg code to the new packages, see examples/LinearAlgebraMigration.
 • The randmatrix function generates a random matrix of dimension m by n.  It is intended to be used for generating examples for debugging, testing, and demonstration purposes.  Several options are available.  The options determine the form of the matrix and the entries in the matrix.
 • The first two arguments specify the row dimension and column dimension. The remaining arguments are interpreted as options and are input as equations or names in any order. The names sparse, dense (default), symmetric, antisymmetric, and unimodular specify the structure of the matrix.  The equation entries = f specifies that the nullary function f is to be used to generate the matrix entries.  The default is rand(-99..99).  Thus the matrix entries are random two digit integers.
 • The command with(linalg,randmatrix) allows the use of the abbreviated form of this command.

Examples

Important: The linalg package has been deprecated. Use the superseding command LinearAlgebra[RandomMatrix], instead.

 > $\mathrm{with}\left(\mathrm{linalg}\right):$
 > $\mathrm{randmatrix}\left(3,3\right)$
 $\left[\begin{array}{ccc}{-7}& {22}& {-55}\\ {-94}& {87}& {-56}\\ {0}& {-62}& {97}\end{array}\right]$ (1)
 > $\mathrm{randmatrix}\left(3,3,\mathrm{unimodular}\right)$
 $\left[\begin{array}{ccc}{1}& {-73}& {-4}\\ {0}& {1}& {-83}\\ {0}& {0}& {1}\end{array}\right]$ (2)
 > poly := proc() Randpoly(3, x) mod 3 end proc;
 ${\mathrm{poly}}{:=}{\mathbf{proc}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{Randpoly}}{}\left({3}{,}{x}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{3}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (3)
 > $\mathrm{randmatrix}\left(2,2,\mathrm{entries}=\mathrm{poly}\right)$
 $\left[\begin{array}{cc}{{x}}^{{3}}{+}{{x}}^{{2}}{+}{2}{}{x}{+}{1}& {2}{}{{x}}^{{3}}{+}{2}{}{{x}}^{{2}}{+}{1}\\ {2}{}{{x}}^{{3}}{+}{x}{+}{1}& {2}{}{{x}}^{{3}}{+}{{x}}^{{2}}{+}{x}\end{array}\right]$ (4)