Integral Cauchy

Hi all,
I’m trying to implement a code able to perform numerical integration and to provide the principal value of an integral of a function. Unfortunately, the integration doesn’t work.
In particular, I have this error:

 Error in <GSLError>: Error 21 in qawc.c at 209 : bad integrand behavior found in the integration interval

And the result doesn’t make any sense. Below, the piece of code which performs the integration:

   ROOT::Math::Functor1D F_tobeintegrated(&Function_tobeintegrated);
   ROOT::Math::IntegratorOneDim ig (F_tobeintegrated, ROOT::Math::IntegrationOneDim::kADAPTIVE);

   double integral=ig.IntegralCauchy(x_low, x_high, E);;

Is there any error? The sad fact is that I can’t find any example of use of the Cauchy Integral method in root.

I think @moneta can help you…

1 Like


Did you define correctly the value E and the function f(x) ?

The IntegralCauchy(a, b,c) function computes

$$I = \int_a^b dx f(x) / (x - c) $$

It is true we don’t have an example, but I could make one if you need it



1 Like

It would be great to have an example, if possible!
By the way, yes, I think I’ve correctly defined the value of the pole and the function to integrate but, maybe, with an example I can better understand if my code contains bug which I’m not finding or not.


By the way the function to be integrated is the following:


Looking at your function only the first part can be computed with IntegralCauchy. The rest you can use the normal Integral function

Yes, of course. The problem is that I have the same error even integrating a simple function, for example 1./(x-a), where a is the pole.

The integral of the function 1./(x-a) = log(x-a) so it is -infinite, if it contains the pole, so it cannot work.
Attached is a simple dummy example



IntegralCauchy.C (326 Bytes)

Yes,this is exactly what I need…to integrate a function within a range in which the pole is contained. So what you tell me is that there is no way to do this with the numerical integration implemented in root?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.