Integration over irregular region

Hi there,

I am trying to do the following integral (over some irregular region):

|+1      |+sqrt(1-x^2)
|        |
|   dx   |     dy  f(x,y)
|        |
|-1      |-sqrt(1-x^2)

Obviously, there are a couple of numerical C-recipes to get the job done.
However, I was wondering if there is ROOT way to do it. More specifically,
using GLSIntegrator. I am going through the documentation (including the
mathmore/test folder) but it seems to me that GSL integrands requires a
regular region for the integration limit e.g.,

|+1      |+c
|        |
|   dx   |     dy  f(x,y)
|        |
|-1      |-d

Am I totally misunderstanding the documentation? Otherwise, could you please point me to the right direction!

Thank you as always

erdos

Root 5.18
osx 10.4.9

Hi,

you would need to build two integrand functions one in x and one in y and then do the two integrations.

The attached example shows how to do using a simple case for f(x,y).

Best Regards

Lorenzo
exampleDoubleIntegral.C (1.85 KB)

Hi Lorenzo,

Thank you very much for the example. It worked beautifully! However, just to check my understanding, I made an attempt (albeit childish!) to generalize your example to a TripleIntegral. It quits with some bus errors.

I attach my attempt! I would greatly appreciate if you would take a look at it (time permitting of course!).

Thanks in advance
erdos
exampleTripleIntegral.C (2.68 KB)

Hi,

just replace line 92 of your macro:

  WrappedFunction<IntegrandFunctionX> wf(fx); 

with

  WrappedFunction<const IntegrandFunctionX &> wf(fx); 

This avoids the copying of the IntegrandFunctionX object, which has as data member a pointer to a GSLIntegrator and therefore it is not handled correctly.
It is strange that using ACLIC you did not get a compiler error, due to the private copy constructor of IntegrandFunctionX . Compiling directly the macro you will have this error.

Best Regards

Lorenzo