help-gsl
[Top][All Lists]

## Re: [Help-gsl] Monte carlo integration

 From: Brian Gough Subject: Re: [Help-gsl] Monte carlo integration Date: Thu, 22 Apr 2004 10:59:58 +0100

Sergio Dominguez writes:
> The integral would be something like
> \int_A1 \int_A2 exp(-a*l) dA1 dA2
> where both areas are delimited by the unit circle and l is the
> distance between both differentials of Area (a=paramter).
>
> I thought about setting as limits [-1,1],[-1,1] and then when doing
> gsl_monte_miser_integrate (&G, xl, xu, 3, calls, r, s,&res, &err);
> Pass in r a random generator that will only generate points inside
> the circle, but I am not very sure of how legal is this.

Transform the integral (e.g. to polar coordinates)

or,

use the unit square [-1,1] [-1,1] but make your function return 0
outside the unit circle (slightly inefficient but easy to implement).

--
Brian Gough

Network Theory Ltd,
Publishing Free Software Manuals --- http://www.network-theory.co.uk/