Re: [ROOT] Integrating a function

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Jun 18 2003 - 12:58:43 MEST


Hi,

Siva Subramania wrote:
> 
> Hi,
> I have some questions on
> TF1:Integral(Double_t* a, Double_t* b, Double_t* params, Double_t* epsilon).

This function does not exist. The existing signature is:

Double_t Integral(Double_t a, Double_t b, const Double_t *params=0, Double_t
epsilon=0.000001)

> I don't understand what is this params all about. 

If you have a TF1 func object,
  func.Integral(a,b);
returns the integral of the function betwen a and b for the current function
parameters. If you want to evaluate the function with a different set
of parameters in array params, you can do
  func.Integral(a,b,params);

> Actually I want to
> know where do you specify the integration variable.
> To be more specific, I define a function fitf(double* x, double* par) and
> I define TF1 f1("ff", "fitf", 0.50, 1.50)

You are missing one argument. When creating a TF1 using an interpreted
or compiled function, you must specify the number of parameters
in the function, eg
  TF1 f1("ff",fitf,0.5,1.5, 2); if your function has 2 parameters

> and inside the fitf function I
> have a variable y, which is the one I want to be my integration variable
> and not x.  So, I think, y should also be an argument of the function, is
> it necessary like that? or can I specify y to be my integration variable
> when I call the integral routine.

Which function do you want to integrate?
It would be much simpler if you could send a short script.
see: http://root.cern.ch/root/roottalk/RoottalkRules.html

> And also I have been trying to use f1.DrawIntegral() and its giving
> some linking errors, what am I supposed to do.

In your mail, you do not indicate which version you are using.
TF1::DrawIntegral was introduced only in 3.05/05.

Rene Brun



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:12 MET