help-gsl
[Top][All Lists]

[Help-gsl] Monte carlo integration

 From: Sergio Dominguez Subject: [Help-gsl] Monte carlo integration Date: Wed, 21 Apr 2004 14:04:52 +0100 User-agent: Mutt/1.3.28i

Hi everyone,

I am new to the list and to the GSL, so excuse me if some of my questions are
basic, I'm still getting used to it.

I am trying to do a montecarlo integration. I have written some code
to do it by myself, using my own random number generator and stuff. I would
like to check the results against the GSL, which I believe will be much more
accurate, but I have the problem that the integration is carried out in a
circunference, so the limits are not constant (the integration needs to be
carried out
in cartesian coordinates) and I am not quite sure how to change the limits in
the monte carlo
algorithm to be equations.

Has someone a piece of code maybe even not directly related but that could
ilustrate
me how to do this?

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.

Thanks all,

Sergio
--
Nostalgia is living life in the past lane.