Numerical technical:: GaussIntegrator

Hi,

Im trying resolve a numerical integral by a gaussian integral method.

I got the following example:

[code]#include “TF1.h”
#include “Math/WrappedTF1.h”
#include “Math/GaussIntegrator.h”

int IntegralNumerica()
{

TF1 f("Sin Function", "sin(x)", 0, TMath::Pi());

ROOT::Math::WrappedTF1 wf1(f);

ROOT::Math::GaussIntegrator ig;

ig.SetFunction(wf1,false);
ig.SetRelTolerance(0.001);

cout << ig.Integral(0, TMath::PiOver2()) << endl;

return 0;

}[/code]

When compile, the error appears:

Error: Can’t call GaussIntegrator::SetFunction(wf1,false) in current scope /opt/local/root_v5-32-00/macros/IntegralNumerica.C:22:
Possible candidates are…
Error: class,struct,union or type GaussIntegrator not defined /opt/local/root_v5-32-00/macros/IntegralNumerica.C:22:
*** Interpreter error recovered ***

any ideas?

Renato.

Hi,

There are some errors in your macro, attached is the fixed one.
I would recommend you to try always to compile your macro so you can find easily the errors

Best Regards

Lorenzo

I do not see the attachment, can you put that macro again?

Here it is,

Best Regards

Lorenzo
IntegralNumerical.C (406 Bytes)