Generates pseudorandom numbers from a von Mises distribution.
C — Parameter of
the von Mises distribution. (Input)
This parameter must be
greater than one half of machine epsilon. (On many machines, the lower bound for
C is
10−3.)
R — Vector of length NR containing the random von Mises deviates. (Output)
NR — Number of
random numbers to generate. (Input)
Default: NR = size (R,1).
Generic: CALL RNVMS (C, R [,…])
Specific: The specific interface names are S_RNVMS and D_RNVMS.
Single: CALL RNVMS (NR, C, R)
Double: The double precision name is DRNVMS.
Routine RNVMS generates pseudorandom numbers from a von Mises distribution with parameter C, which must be positive. With c = C, the probability density function is
where I0(c) is the modified Bessel function of the first kind of order 0. The probability density equals 0 outside the interval (−π, π).
The algorithm is an acceptance/rejection method using a wrapped Cauchy distribution as the majorizing distribution. It is due to Best and Fisher (1979).
The routine RNSET can be used to initialize the seed of the random number generator. The routine RNOPT can be used to select the form of the generator.
In this example, RNVMS is used to generate five pseudorandom von Mises variates with c = 1.
USE RNVMS_INT
USE UMACH_INT
USE RNSET_INT
IMPLICIT NONE
INTEGER NR
PARAMETER (NR=5)
!
INTEGER ISEED, NOUT
REAL C, R(NR)
!
CALL UMACH (2, NOUT)
C = 1.0
ISEED = 123457
CALL RNSET (ISEED)
CALL RNVMS (C, R)
WRITE (NOUT,99999) R
99999 FORMAT (' Von Mises random deviates: ', 5F8.4)
END
Von Mises random deviates: 0.2472 -2.4326 -1.0216 -2.1722 -0.5029
PHONE: 713.784.3131 FAX:713.781.9260 |