# Complex integration anyone?

Hello everybody,

Does anybody know of a C++ library that does complex integration that I can link against?

I want to fit a TH1D histogram using some fancy QCD theory which has a complex integral involved. I want to use minuit to fit the parameter of the theory to the histogram. Each time the parameter is changed the integral has to be redone.

My professor has given me his old fortran code which uses the wgauss method from cernlib, I am looking for a C++ analog. Does anybody know of one?

I would hate to have to convert my root histograms into paw form and then do this all in fortran.

Can you elaborate what is wrong with your fortran code? Normally, one can call any fortran subroutine from the C++ code.

Presently there in no equivalent of wgauss in ROOT.

However, a complex integration along a line segment can be transformed as a sum of real integrations, as shown for example in

ndp.jct.ac.il/tutorials/complex/node32.html

and you can use the integration algorithms for real number,
like those implemented for TF1::Integral or the class ROOT::Math::Integrator based on adaptive numerical integration from GSL,

Best Regards

Lorenzo

The problem I will have interfacing with wgauss is that wgauss has the form:

wgauss(f,min,max,acc)

where f is your user supplied complex fortran function,
min and max are the integration limits and acc is the accuracy required.

The reason I can’t just extern this is that wgauss will not know what to make of my C++ complex function.

I understand that ROOT doesn’t have a wgauss equivalent, does anybody know of any other C++ library that could do this?

I think that I am going to experiment with mathematica on this one.

The page 4 of netlib.org/f2c/f2c.pdf says,[quote]A complex or double complex function is equivalent to a C routine with an
additional initial argument that points to the place where the return value is to be stored. Thus,[/quote]

```void f_(temp, . . .) complex *temp;```. . .
This probably is not true for the Microsoft compiler 