Levy flight distribution

800 Views Asked by At

Can somebody help me with C++ code, how to make a Levy distribution like a function? I need to make one dimensional Levy flight model, but I don't know the function how to choose the right step.

1

There are 1 best solutions below

0
On

So there is a package in R to generate a one-dimensional levy flight. It is called rmutil. Now the package is not on CRAN apparently, but you can install it from source. You would just download the rmutil.tgz package to a folder. Then you would enter the command: Here is the link rmutil.

install.packages('/path/rmutil.tgz', repos=NULL, type='source)

You can generate random levy values with the rlevy() function. BUT, you should also be able to look at the source code for the function is as follows:

function (n = 1, m = 0, s = 1) 
{
    if (any(s < 0)) 
        stop("s must be positive")
    s/qnorm(1 - runif(n)/2)^2 + m
}

In this parameterization, m = location parameter and s = dispersion parameter.