RandomTools Flavor: Matrix - Maple Programming Help

Home : Support : Online Help : Programming : Random Objects : RandomTools package : Flavors : RandomTools/flavor/Matrix

RandomTools Flavor: Matrix

describe a Matrix of random objects

 Calling Sequence 'Matrix'(flav, r, c, ... )

Parameters

 flav - random flavor r - positive integer or a flavor that generates a positive integer c - positive integer or a flavor that generates a positive integer density - a numeric value with 0 <= density <= 1 ... - additional options to the Matrix constructor

Description

 • The flavor 'Matrix' describes a Matrix with r rows and c columns.  Each entry is described by the given random flavor, flav.  The default flavor is integer and the default value for r and c is 10.
 • The density value is a probability that an entry will be assigned a value.  By default, this value is 1.
 • Additional arguments can be specified that will be passed to the Matrix constructor.  For example, datatype, shape, etc.
 This flavor can be used as an argument to RandomTools[Generate] or as part of a structured flavor.

Examples

 > $\mathrm{with}\left(\mathrm{RandomTools}\right):$
 > $\mathrm{Generate}\left('\mathrm{Matrix}'\left(\mathrm{integer},3,3\right)\right)$
 $\left[\begin{array}{ccc}{-97285985753}& {327915651053}& {-276532064796}\\ {-112481638417}& {-288425344624}& {459444310976}\\ {-139421155293}& {116576431985}& {-100885603451}\end{array}\right]$ (1)
 > $\mathrm{Generate}\left('\mathrm{Matrix}'\left(\mathrm{rational}\left(\mathrm{denominator}=30\right),2,2\right)\right)$
 $\left[\begin{array}{cc}{-}\frac{{2}}{{15}}& \frac{{29}}{{30}}\\ \frac{{2}}{{15}}& {-}\frac{{2}}{{5}}\end{array}\right]$ (2)
 > $H≔\mathrm{Generate}\left('\mathrm{Matrix}'\left(\mathrm{float}\left(\mathrm{range}=0..10,\mathrm{method}=\mathrm{uniform}\right),5,5,\mathrm{datatype}={\mathrm{float}}_{8}\right)\right)$
 ${H}{≔}\left[\begin{array}{ccccc}{8.23457828327293}& {7.06046088019609}& {7.57740130578333}& {6.55740699156587}& {1.41886338627215}\\ {0.971317812358475}& {1.71186687811562}& {6.78735154857773}& {9.59492426392903}& {8.00280468888800}\\ {0.461713906311539}& {6.55477890177557}& {9.33993247757551}& {7.92207329559554}& {4.85375648722841}\\ {2.76922984960890}& {3.92227019534168}& {8.49129305868777}& {9.15735525189067}& {9.57166948242946}\\ {0.318328463774207}& {7.43132468124916}& {0.357116785741896}& {4.21761282626275}& {9.70592781760616}\end{array}\right]$ (3)

Compatibility

 • The RandomTools Flavor: Matrix command was introduced in Maple 18.