VonMises Distribution - 5.2 English - 68552

AOCL API Guide (68552)

Document ID
68552
Release Date
2025-12-29
Version
5.2 English

Generates a vector of random variates from a Von Mises distribution with probability density function, \(f (X)\), where:

\[f (X) = \frac{e ^{k\ cos\ X}}{2\pi I_0(K)}\]

where X is reduced modulo \(2\pi\) so that it lies between \(\pm \pi\), and κ is the concentration parameter VK.

C Generate 100 values from the Von Mises distribution
    INTEGER LSTATE,N
    PARAMETER (LSTATE=16,N=100)
    INTEGER I,INFO,SEED(1),STATE(LSTATE)
    DOUBLE PRECISION VK
    DOUBLE PRECISION X(N)

C Set the seed
    SEED(1) = 1234

C Read in the distributional parameters
    READ(5,*) VK

C Initialize the STATE vector
    CALL DRANDINITIALIZE(1,1,SEED,1,STATE,LSTATE,INFO)

C Generate N variates from the Von Mises distribution
    CALL DRANDVONMISES(N,VK,STATE,X,INFO)

C Print the results
    WRITE(6,*) (X(I),I=1,N)