Tendency:
Filter:
Tendency/Classes (extension) | Randomness

Tendency
ExtensionExtension

Creates dynamic random number distributions

Description

Tendency stores data for creating random values where the parameters for the random number generation occur over time.

Some important issues regarding Tendency

Though the parameters 'parX' and 'parY' (see *new method below) are gnerally used to describe bounds over time, in certain distributions, these actual parameters may control other aspects of a random distribution. See -cauchyRandAt, -gaussRandAt and -poissonRandAt for more details.

Using Tendency

The basic usage of Tendency will be through the -at method. A random value will be calculated according to the state of 'parX' and 'parY' at 'time' for a specific 'dist'.

Below is a listing of distributions with examples and how arguments will map to parameters; n/a means a parameter is not used in a distribution.

Linear distributions:

distributionparXparYparAparBmore info
\uniformlowhighn/an/a-uniformAt
\lpRandlowhighn/an/a-lpRandAt
\hpRandlowhighn/an/a-hpRandAt
\meanRandlowhighn/an/a-meanRandAt

Non-linear distributions:

distributionparXparYparAparBmore info
\expRandlowhighn/an/a-expRandAt
\exponentialdensityn/an/an/a-expAt
\gammamoden/an/an/a-gammaAt
\laplacedispersionn/an/an/a-laplaceAt
\alaplacedispersionn/an/an/a-alaplaceAt
\hcosdispersionn/an/an/a-hcosAt
\logisticdispersionn/an/an/a-logisticAt
\poissonmeann/an/an/a-poissonRandAt
\arcsindispersionn/an/an/a-arcsinAt

Symmetrical non-linear distributions:

distributionparXparYparAparBmore info
\betaRandlowhighlowProbhighProb-betaRandAt
\cauchymeanspreadposOnlyn/a-cauchyRandAt
\gaussdevmeann/an/a-gaussRandAt

Class Methods

.new

Creates a new Tendency object. Any of the values below may be a SimpleNumber, an Env or a Function. If a Function is used, the current time will be passed into the Function.

NOTE: The kind of distribution may change the meaning of some of the initial args (e.g., 'parX' may be treated as a 'mean').

Arguments:

parX

For the most common usage, describes the upper bounds of the distribution.

parY

For the most common usage, describes the upper bounds of the distribution.

parA

For some distributions, the control of a specific parameter.

parB

For some distributions, the control of a specific parameter.

defDist

A default distribution to use.

Returns:

a new Tendency

Instance Methods

.at

Basic usage of Tendency.

Arguments:

time

The time to calculate a random number for.

dist

The distribution to use. If supplied, the *defDist is overridden.

Returns:

Calculated value at time provided.

Discussion:

.uniformAt

Uniform distribution. Convenience method for .at(time, \uniform).

.lpRandAt

Lowpass distribution. Convenience method for .at(time, \lpRand).

.hpRandAt

Highpass distribution. Convenience method for .at(time, \hpRand).

.meanRandAt

Mean (bandpass) distribution. Convenience method for .at(time, \meanRand).

.expRandAt

Exponential distribution. Convenience method for .at(time, \expRand). Note that we need to avoid 0.0.

.expAt

Exponential distribution. Convenience method for .at(time, \exponential). 'parX' parameter control on density.

.gammaAt

Gamma distribution. Convenience method for .at(time, \gamma). 'parX' controls mode or peak.

.laplaceAt

Laplace distribution. Convenience method for .at(time, \laplace). 'parX' value controls dispersion.

.alaplaceAt

Special case of laplace distribution, creates a gap in the centerv (anti-laplace). Convenience method for .at(time, \alaplace). 'parX' value controls dispersion.

.hcosAt

Hyperbolic cosine distribution. Convenience method for .at(time, \hcos). 'parX' value controls dispersion.

.logisticAt

Logistic distribution. Convenience method for .at(time, \logistic). 'parX' value controls dispersion.

.poissonRandAt

Poisson distribution. Convenience method for .at(time, \poisson). 'parX' value is the mean of the distribution. This distribution has a discrete histogram (not continuous). It returns always integer values.

.arcsinAt

Arcsin distribution. Convenience method for .at(time, \arcsin). 'parX' value controls dispersion (spread). Output range is between 0 and this value. Histogram shape is similar to beta with parA=parB=0.5.

.betaRandAt

Beta distribution. Convenience method for .at(time, \betaRand). This distribution takes two extra parameters parA and parB to describe where the likelihood that a random value will occur near parX (parA) or parY (parB).

.cauchyRandAt

Cauchy distribution. Convenience method for .at(time, \cauchy). This distribution has a symmetrical histogram around 0. For this implementation 'parX' controls its dispersion. If parA = 1, only positive values are returned.

.gaussRandAt

Gaussian distribution. Convenience method for .at(time, \gauss). This distribution has a bell-shaped symmetrical histogram. 'parX' is the deviation or width of the bell.

.asStream

Use this Tendency like a Stream.

.parXAt

Returns:

'parX' at time

.parYAt

Returns:

'parY' at time

.defDist

Returns:

default distribution

.parX

.parY

.parB

.parA

.valAt

Arguments:

obj
time

Returns:

...

.embedInStream

Arguments:

inval
dist
parA
parB

Returns:

...