# TF2 projection on TF1

Hello everyone. I have a two-dimensional function, say f(x,y), and I defined it as a TF2. I was wondering if there is any method to define a TF1 as the integral of the previous TF2. I would like to do something like:

g(x) = Integral[f(x,y), {y, ymin, ymax}]

Is that possible?

Thanks a lot

Hello,
Referring to the root reference guide here root.cern.ch/root/html530/TF2.html#TF2:Integral root offers a numeric integration, and not an analytic one. So partial integration is not implemented imho.
I think the only thing you could do in if you know the f(x,y) analytic formula you previously calculate the F(x) and load that as a TF1.
If you plan to calculate the F(x) at certain x values you could do something like that, bypassing the TF2->TF1 convertion:

[code]TF2 f(…);
Double_t F;
Double_t x0=#.#;
Double_t ymin=#.#;
Double_t ymax=#.#;
Double_t epsilon=0.000001;

F=f.Integral(x0,x0+epsil/2.,ymin,ymax,epsilon);[/code]

Since:

where #.# is a double/real value placeholder and epsilon is a redefinition of the numerical integration step (epsilon/2. should avoid significant deviations from the analytic x0 calculation of the integral).

Hope that helps

Have you solved your problem? Now I have the same problem as you