# Convolution of two TF1

**URL:** <https://root-forum.cern.ch/t/convolution-of-two-tf1/23625>\
**Category:** Roofit and RooStats\
**Created:** [January 27, 2017, 3:16pm UTC](https://root-forum.cern.ch/t/convolution-of-two-tf1/23625 "2017-01-27T15:16:25Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![Pepe\_Le\_Pew](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pepe_le_pew/32/12365_2.png) [@Pepe\_Le\_Pew](https://root-forum.cern.ch/u/Pepe_Le_Pew)\
**Post date:** [January 27, 2017, 6:59pm UTC](https://root-forum.cern.ch/t/convolution-of-two-tf1/23625/6 "2017-01-27T18:59:36Z")

</div>

Well, you could try:

```auto
// ...
TF1 *f1 = new TF1("f1", myfunc, emin, emax, 0);
f1->SetNpx(10000);
// ...
TF1Convolution *f_conv = new TF1Convolution(f1, f1, emin, emax, false);
TF1 *f = new TF1("f", *f_conv, emin, emax, f_conv->GetNpar());
f->SetNpx(10000);
f->Draw();
gPad->SetLogx();
// ...

```

but be aware that, [it internally calculates integrals of your “f1”](https://root-forum.cern.ch/t/creating-tf1-from-tgraph/10522/10). 😉 ![:mrgreen:](https://root-forum.cern.ch/uploads/default/original/2X/2/2799b3ea86c419a02327c767288415b2a17e6ee1.gif "Mr. Green")

---

_[View the full topic](https://root-forum.cern.ch/t/convolution-of-two-tf1/23625)._
