RanLip Maple toolbox
School of Engineering and IT, Deakin University, Australia Copyright Gleb Beliakov, 2006 Australia gbeliako@gmail.com
Installation instructions
To use this worksheet you need to have MapleRanLip.dll library in the curent directory or on the path
Introduction
This worksheet illustrates how RanLip package can be used with Maple (under MS Windows).
RanLip is a programming library to generate non-uniformly distributed random vectors with Lipschitz continuous densities.
Please see the user manual supplied with this worksheet.
This worksheet is provided as a template for user's own distributions. It shows how to declare the distribution density and
generate random vectors.
It should be used in conjunction with the supplied dll (MapleRanLip.dll), and the user manual (ranlipmaple.pdf).
The typical calling sequence is as follows:
1. execute define_external procedures in the next subsection
2. declare your density function (and also set the boundaries of the domain)
3. call the relevant routines with correct arguments
Please change the RANLIPPATH line below to the location of this package on your computer!
Initialization: Declarations of RanLip procedures found in the dll
Execute the commands below to declare the external subroutines from RanLip library.
Section 1: Declaration of the density function
We need to declare the distribution density function and also box constraints lo_i <= x_i <= up_i.
Declaration of the density function f(x)
Declare f as a procedure. The objective function f takes n arguments, the components of vector x. It returns a real value. The density does not need to be normalised.
Declaring the bounds and space to receive generated random vectors
Boundaries, and also the dimension of x and declaration of xrand.
Executing RanLip methods
Construct the hat function, using a grid 50 x 50, and using 16 x 16 function evaluations in each cell. Lipschitz constant is 10.
Section 2: Generation of random vectors
Generate and plot random vectors with density f.
Generate a few random vectors
Generating many random vectors and plotting them
First prepare space to hold random vectors
Get some statistics from the process: how many random numbers generated, how may errors (error is the hat function too small - increase Lipschitz constant)
Section 3: Saving and retrieving the hat function
The next command clears the hat function. No generation of random vectors is possible after it, until we load it or prepare a new hat function .
Hat function loaded
Now we can generate random vectors again (we keep the same distribution function)
Section 4: Another example, putting it all together
just define the boundaries and prepare arrays
generate the hat function
generate random vectors
generate and plot many random vectors
References
Please consult http://www.deakin.edu.au/~gleb for updates.
We appreciate your comments about your experiences using RanLip and this Maple toolbox. Please send your feedback to
gbeliako@gmail.com
This project was carried out with the assistance of Ilya Khriapin, which is greatefully acknowledged.
Legal Notice: The copyright for this application is owned by the author(s). Neither Maplesoft nor the author are responsible for any errors contained within and are not liable for any damages resulting from the use of this material. This application is intended for non-commercial, non-profit use only. Contact the author for permission if you wish to use this application in for-profit activities.