RNVMS
Generates pseudorandom numbers from a von Mises distribution.
Required Arguments
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)
Optional Arguments
NR — Number of random numbers to generate. (Input)
Default: NR = size (R,1).
FORTRAN 90 Interface
Generic: CALL RNVMS (C, R [, …])
Specific: The specific interface names are S_RNVMS and D_RNVMS.
FORTRAN 77 Interface
Single: CALL RNVMS (NR, C, R)
Double: The double precision name is DRNVMS.
Description
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).
Comments
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.
Example
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
Output
Von Mises random deviates: 0.2472 -2.4326 -1.0216 -2.1722 -0.5029