Probleme with GSLIntegrator

Hi
First of all, I’m sorry for my english (I’m french, so that’s a goos reason…)

I’ve a problem using the ROOT::Math::GSLIntegrator in a root macro: I wanted to integrate a function from a up to infinity but it gave me this

ten times end then gave me my plot with few bad points i had not before using the simple Integral way (but this way took several hour to give me a plot)

I don’t really understand this error (I’ve look for the reason in GSLError.h and qags.c but i didn’t understand it)

By the way what i’ve tried to do is to calculate a integration of a f(a,b) over b from 0 up to a finite b and then to multiply the result by another function g(a,c) and to integrate it over c from a up to ifinity

I’ll join you the code (it may be simpler)

Thanks a lot in advance
Jean-Baptiste
newIdea.C (2.36 KB)

Hi,

this error indicates a numerical problem when evaluating the integral with the function. The problem comes from the second integral, from c to infinity.
Are your sure the definition of the function is correct ?

It looks to me that the function is not converging fast enough to zero for x-> infinity. The integrand function seems also to have a singularity.
In case the function definition is correct, a solution could be to change variables in a way to make the numerical calculation more stable with respect to numerical errors.

Best Regards

Lorenzo

hi
You were right: my integrand function was not exact… now it works
thank you

Hello

I’m back with this code… It’s working good as a ROOT macro : the function is the one i expected, but when i want to turn it into a class in order to fit histograms whit this new function it gives me this

[quote] In function TransverseMass::IntegPhi(double*, double*)': /users/nemo/blanchar/exp/Stage/Programme_de_fit/TransverseMass.C:45: undefined reference to ROOT::Math::GSLIntegrator::GSLIntegrator(double, double, unsigned int)’
[/quote]
each time it uses a GSLIntergrator function even if i have put this in the code

thanks in advance
JB

You must explicitely load libMathMore.so. When using CINT, CINT can do it automatically
but not the compiler.
In your program you can include

gSystem->Load("libMathMore");
Rene

hello

I did it but it gave me this

.I’ve so added an #include ‘TSystem.h’. Consequence :

[quote] In function TransverseMass::IntegPhi(double*, double*)': /users/nemo/blanchar/exp/Stage/Programme_de_fit/TransverseMass.C:46: undefined reference to ROOT::Math::GSLIntegrator::GSLIntegrator(double, double, unsigned int)’
[/quote]

I really don’t get why it can’t find the GSLIntegrator whereas it gives no message for the WrappedTF1 function i’m also using…
here are all the include i’ve got

[quote]#include “TransverseMass.h”
#include “TSystem.h”
#include “Math/WrappedTF1.h”
#include “Math/GSLIntegrator.h”
#include “TF1.h”
#include “TFile.h”[/quote]

thank you for your reply
JB

If you are compiling your macro with ACLIC you need to load first (as Rene said) the MathMore library.
Do before executing the macro (not inside the macro)

gSystem->Load("libMathMore")

You can add this statement also in your rootlogon.C file.

Lorenzo

but I’m not compiling with ACLIC (I’ve never heard about it). I’ve done a MakeFile and i’m compiling with g++.
Do i have to change my way of compiling and to use ACLIC in order to make it work?

cheers
JB

If you link yourself in the old style way you must add -lMathMore in your link sequence.

Some words about ACLIC:
If you have a script example.C, using ACLIC in ROOT, you can do

root > .x example.C (script interpreted by CINT) root > .x example.C+ (script compiled and executed by the native compiler)
for more info see the first pages of teh Users Guide

Rene