 ArrayTools - Maple Programming Help

Home : Support : Online Help : Programming : Low-level Manipulation : Matrices, Vectors, and Arrays : ArrayTools : ArrayTools/RandomArray

ArrayTools

 RandomArray
 randomly generate scalars, Matrices, and Arrays of values drawn from a uniform or normal distribution

 Calling Sequence RandomArray(); RandomArray(distribution = uniform); RandomArray(n); RandomArray(n, distribution = uniform); RandomArray(m, n); RandomArray(m, n, distribution = uniform); RandomArray(m, n, o, ...); RandomArray(m, n, o, ..., distribution = uniform); RandomArray(distribution = normal); RandomArray(n, distribution = normal); RandomArray(m, n, distribution = normal); RandomArray(m, n, o, ..., distribution = normal);

Parameters

 m, n, o, ... - length of each dimension distribution = uniform, distribution = normal - type of a statistic distribution

Description

 • The RandomArray() and RandomArray(distribution = uniform) functions randomly generate a scalar value drawn from a uniform distribution on the unit interval.
 • The RandomArray(n) and RandomArray(n, distribution = uniform) functions randomly generate an n-by-n matrix of values derived as described above.
 • The RandomArray(m, n) and RandomArray(m, n, distribution = uniform) functions randomly generate an m-by-n matrix of the same.
 • The RandomArray(m, n, o, ...) and RandomArray(m, n, o, ..., distribution = uniform) functions randomly generate an m-by-n-by-o-by-... array of the same.
 • The RandomArray(distribution = normal) function randomly generates a scalar value drawn from a standard normal distribution.
 • The RandomArray(n, distribution = normal) function randomly generates an n-by-n matrix of values derived as described above.
 • The RandomArray(m, n, distribution = normal) function randomly generates an m-by-n matrix of the same.
 • The RandomArray(m, n, o, ..., distribution = normal) function randomly generates an m-by-n-by-o-by-... array of the same.
 • A negative entry for the length of a dimension is treated as zero.
 • This function is part of the ArrayTools package, so it can be used in the short form RandomArray(..) only after executing the command with(ArrayTools). However, it can always be accessed through the long form of the command by using ArrayTools[RandomArray](..).

Examples

 > $\mathrm{with}\left(\mathrm{ArrayTools}\right):$
 > $\mathrm{RandomArray}\left(\right)$
 ${0.2342493224}$ (1)
 > $\mathrm{RandomArray}\left(2\right)$
 $\left[\begin{array}{cc}{0.278498218867048}& {0.632359246225410}\\ {0.0975404049994095}& {0.913375856139019}\end{array}\right]$ (2)
 > $\mathrm{RandomArray}\left(3,2\right)$
 $\left[\begin{array}{cc}{0.957166948242946}& {0.964888535199277}\\ {0.970592781760616}& {0.957506835434298}\\ {0.157613081677548}& {0.546881519204984}\end{array}\right]$ (3)
 > $\mathrm{RandomArray}\left(2,3,4,5,6\right)$
  (4)
 > $\mathrm{RandomArray}\left(\mathrm{distribution}=\mathrm{normal}\right)$
 ${-0.707235932058173}$ (5)
 > $\mathrm{RandomArray}\left(3,\mathrm{distribution}=\mathrm{normal}\right)$
 $\left[\begin{array}{ccc}{-0.685787668096156}& {-2.24830274133105}& {0.564248224700215}\\ {0.668515233472718}& {-1.50515736499682}& {0.749976789745442}\\ {1.12736559620877}& {1.30335370400498}& {0.788332041459299}\end{array}\right]$ (6)
 > $\mathrm{RandomArray}\left(1,2,\mathrm{distribution}=\mathrm{normal}\right)$
 $\left[\begin{array}{cc}{-0.399816712295164}& {0.100128522592894}\end{array}\right]$ (7)
 > $\mathrm{RandomArray}\left(2,1,3,6,4,\mathrm{distribution}=\mathrm{normal}\right)$
  (8)