# Wrong convolution of 2 functions

**URL:** <https://root-forum.cern.ch/t/wrong-convolution-of-2-functions/26205>\
**Category:** ROOT\
**Created:** [September 13, 2017, 2:24pm UTC](https://root-forum.cern.ch/t/wrong-convolution-of-2-functions/26205 "2017-09-13T14:24:27Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [September 13, 2017, 6:49pm UTC](https://root-forum.cern.ch/t/wrong-convolution-of-2-functions/26205/3 "2017-09-13T18:49:21Z")

</div>

I blame the ROOT’s “Integral” method, so try with FWHM=10 …

> [@Convolution of two TF1](https://root-forum.cern.ch/t/convolution-of-two-tf1/23625/8):
>
> If you do not like this plot, you can also try: ROOT::Math::IntegratorOneDimOptions::SetDefaultIntegrator("Gauss"); TF1Convolution \*f\_conv = new TF1Convolution(f1, f1, emin, emax, false); You will then have four different curves, so you should be able to pick one for you exclamation [:mrgreen:] Well, you could try all different available ROOT’s “1-dim integrators”: “Gauss”, “GaussLegendre”, “Adaptive”, “AdaptiveSingular” and “NonAdaptive”. wink Seven different curves should be a “good m…

> [@Creating TF1 from TGraph](https://root-forum.cern.ch/t/creating-tf1-from-tgraph/10522/10):
>
> Why are you still complaining question [[-(] You now have three different integral values, so you can choose the one you like the most exclamation [:mrgreen:] Using “ROOT::Math::IntegratorOneDimOptions::SetDefaultIntegrator(…);”, you could try all different available ROOT’s “1-dim integrators”: “Gauss”, “GaussLegendre”, “Adaptive”, “AdaptiveSingular” and “NonAdaptive”. wink You will then have six different integral values to choose from exclamation [:mrgreen:] BTW. ROOT’s “integr…

> [@Why is my integral zero?](https://root-forum.cern.ch/t/why-is-my-integral-zero/21999/3):
>
> I don’t think your calls to “Integral” are wrong. I guess it’s a deficiency in ROOT. It’s the “efficiency” / “efficiencyF” function which fools ROOT. It’s value “jumps” between 0 and 1 and the current “integrator” is known to misbehave in such cases. See also, for example: [Simple Integral](https://root-forum.cern.ch/t/simple-integral/21760/2) Sometimes you can try to “hide” this problem if you increase the number of points … for each of your functions try to add: SomeTF2-\>SetNpx(1000); SomeTF2-\>SetNpy(1000); But I wouldn’t really trust the res…

> [@Integral of 2D function](https://root-forum.cern.ch/t/integral-of-2d-function/15146/2):
>
> A very brutal fix (works just in this case; in another cases you’ll need to “tune” the “number of points”): g2D1-\>SetNpx(700); g2D1-\>SetNpy(700); // “number of points” \>= 700 I guess the problem is that your “g2dBIF1” is not smooth at the “edge” given by the “radius” (i.e. it’s not differentiable there) and the “numerical integrator” gets fooled (there’s a “jump” from about 8000 to 0). That’s not a problem for your “g2dBIF2” because the “radius” is much larger and the “jump” at the “edge” is …

---

_[View the full topic](https://root-forum.cern.ch/t/wrong-convolution-of-2-functions/26205)._
