nag_rngs_exp_mix (g05lqc) generates a vector of pseudorandom numbers from an exponential mix distribution composed of exponential distributions each having a mean and weight .
The distribution has PDF (probability density function)
where
and
,
.
One of the initialization functions
nag_rngs_init_repeatable (g05kbc) (for a repeatable sequence if computed sequentially) or
nag_rngs_init_nonrepeatable (g05kcc) (for a non-repeatable sequence) must be called prior to the first call to nag_rngs_exp_mix (g05lqc).
- 1:
nmix – IntegerInput
On entry:
, the number of exponential distributions in the mix.
Constraint:
.
- 2:
a[nmix] – const doubleInput
On entry: the parameters for the exponential distributions in the mix.
Constraint:
, for .
- 3:
wgt[nmix] – const doubleInput
On entry: the weights for the exponential distributions in the mix.
Constraints:
- ;
- , for .
- 4:
n – IntegerInput
-
On entry: , the number of pseudorandom numbers to be generated.
Constraint:
.
- 5:
x[n] – doubleOutput
On exit: the pseudorandom numbers from the specified exponential mix distribution.
- 6:
igen – IntegerInput
-
On entry: must contain the identification number for the generator to be used to return a pseudorandom number and should remain unchanged following initialization by a prior call to
nag_rngs_init_repeatable (g05kbc) or
nag_rngs_init_nonrepeatable (g05kcc).
- 7:
iseed[] – IntegerCommunication Array
-
On entry: contains values which define the current state of the selected generator.
On exit: contains updated values defining the new state of the selected generator.
- 8:
fail – NagError *Input/Output
-
The NAG error argument (see
Section 3.6 in the Essential Introduction).
Not applicable.
None.
This example prints the first five pseudorandom real numbers from an exponential mix distribution comprising three exponential distributions with parameters
,
and
, and with respective weights
,
and
. The numbers are generated by a single call to nag_rngs_exp_mix (g05lqc), after initialization by
nag_rngs_init_repeatable (g05kbc).
None.