stats(deprecated)/random - Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : stats(deprecated)/random

Overview of the stats[random] Subpackage

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

stats[random][distribution](quantity, uniform, method)

random[distribution](quantity, uniform, method)

Parameters

distribution

-

numbers generated according to this distribution

quantity

-

(optional, default=1) either a positive integer indicating how many random numbers are required, or the keyword 'generator'

uniform

-

(optional, default = 'default') a procedure that generates uniformly distributed numbers one at a time, or the keyword 'default'

method

-

(optional, default = 'auto') one of the keywords 'auto', 'inverse', or 'builtin'

Description

• 

Important: The stats package has been deprecated. Use the superseding package Statistics instead.

• 

The stats[random] subpackage provides random numbers with a given distribution.

• 

The random subpackage provides filters that transform a uniformly distributed stream of random numbers to a stream that has the required distribution. The underlying uniform generator can be specified by the parameter uniform.

• 

The seed of the default generator can be modified by using the function randomize().

• 

Random number generators are obtained by specifying the keyword 'generator' as the  parameter quantity. The number of digits (if it is not the default value given in Digits) in the generated numbers is indicated as an index to 'generator'. If randomize() is used, it must be done prior to creating the generators.

• 

The uniform generator specified using the parameter uniform must return one number between 0 and 1. The parameter uniform allows the generation of independent streams of random numbers, provided independent uniform generators are used. It must be noted that the design of good uniform generators, independent of each other, is not an easy task. A randomly chosen random number generator will most likely be of poor quality.

• 

The parameter method specifies by which method the number will be generated. If method is 'inverse' the uniform stream is transformed according to the icdf of a continuous distribution and according to the idcdf of a discrete distribution. If method is 'builtin' then a special purpose function for the required distribution is called. If method is 'auto' then random uses the 'builtin' method, if there is one. If the required special purpose function is not present, then use the 'inverse' method.

• 

The distributions available under the 'inverse' method are all the distributions for which either stats[statevalf, icdf] or stats[statevalf,idcdf] exists.

• 

The distributions available under the 'builtin' method are

beta

chisquare

fratio

gamma

normald

studentst

• 

Each command in the stats[random] subpackage can be accessed by using either the long form or the short form of the command name in the command calling sequence.

Examples

Important: The stats package has been deprecated. Use the superseding package Statistics instead.

withstats:

generate 20 numbers with the standard normal distribution

stats[random,normald]20

1.275676034,0.4761860895,2.620054215,0.8547207946,1.089001804,0.7165427597,0.02996436194,1.330855643,1.296345119,0.4703304030,0.7122630822,0.08717900722,1.282253009,1.683720686,0.3265473243,0.08179818206,0.2127564698,0.7279468705,0.6855773709,0.3760280554

(1)

This time, use the 'inverse' method

stats[random,normald]20,'default','inverse'

0.2942905914,1.023730745,0.07256069586,0.2726670238,0.9797884030,0.06456731317,0.7584692928,1.414509920,0.5848741507,0.1502221444,0.7052134613,0.1760249535,1.114921264,1.111477077,1.837138817,0.007014805706,0.1412349839,0.3487795280,2.269571409,0.6290512530

(2)

Generate 20 numbers with the poisson[3] distribution, using a user specified generator.

seed1

seed:=1

(3)

uniform_generator:=proc()   # not a very good generator
   global seed;
   seed:=irem(seed*11,101);
   return(seed/101)
end proc:

random[γ[3]]20,uniform_generator

1.171878004,1.514461967,3.368200854,1.997566185,4.818133461,6.550753566,0.6309471660,3.556933956,3.761058678,2.869958271,3.026686005,1.117441781,3.623114178,1.001527868,3.492458052,4.230152601,4.063203183,1.911176304,2.259044006,3.691114038

(4)

Generators:

P1random[γ[3]]'generator':

'P1'$10

4.836469539,8.353178496,0.8580684291,2.259265671,3.450849282,2.692610073,6.645335655,8.029222668,1.963201340,3.851992359

(5)

Generators of  15 digit numbers.

P2random[γ[3]]'generator15':

'P2'$10

3.72980590085895,1.34273823710794,2.94592957570767,0.547985385167043,3.75980063833647,1.77869024847795,2.92867095947213,7.52997082985958,3.35028281579760,3.35085086325255

(6)

See Also

rand

randomize

Statistics

Statistics[Distribution]

stats(deprecated)[distributions]

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam