# TF3 Integration

**URL:** <https://root-forum.cern.ch/t/tf3-integration/37676>\
**Category:** Newbie\
**Created:** [January 22, 2020, 7:34pm UTC](https://root-forum.cern.ch/t/tf3-integration/37676 "2020-01-22T19:34:15Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Angey](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/f04885/32.png) [@Angey](https://root-forum.cern.ch/u/Angey)\
**Post date:** [January 22, 2020, 7:34pm UTC](https://root-forum.cern.ch/t/tf3-integration/37676/1 "2020-01-22T19:34:15Z")

</div>

So, for the first time I am trying to do multiple integration using TF3 for 3 variables. Here’s below what I wrote in my code which is showing error when compiled. It is showing that it can’t call Wrapped function. I don’t know how to do triple integration in ROOT and where is my error in this code. Any help in this regard would be highly appreciated. Thank you.

```auto
 TF3 *sigma_1 = new TF3("sigma_1", integrand_sigma , 0, 100,0,100,-1,1,2);  				
		Sigma->FixParameter(0, q);
		Sigma->FixParameter(1, T);
		ROOT::Math::WrappedMultiTF1 wf1(Sigma);
		ROOT::Math::AdaptiveIntegratorMultiDim ig;
		
		ig.SetFunction(wf1);
		double xmin[] = {0,0};
		double xmax[] = {100,100};
	
		double sigma_num = ig.Integral(xmin, xmax);

		cout<<sigma_num<<endl;

```

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [January 23, 2020, 8:05am UTC](https://root-forum.cern.ch/t/tf3-integration/37676/2 "2020-01-23T08:05:49Z")

</div>

I guess @moneta can help you.

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [January 23, 2020, 8:42am UTC](https://root-forum.cern.ch/t/tf3-integration/37676/3 "2020-01-23T08:42:14Z")

</div>

Hi,

I see from the code you are integrating a 3D function. You should then define xmin and xmax as 3d arrays

Lorenzo

---

<div class="post-metadata">

**Author:** ![Angey](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/f04885/32.png) [@Angey](https://root-forum.cern.ch/u/Angey)\
**Post date:** [January 27, 2020, 5:25am UTC](https://root-forum.cern.ch/t/tf3-integration/37676/4 "2020-01-27T05:25:57Z")

</div>

Hi,  
So, I did the following way but it still didn’t work out…(P.S. “integrand\_sigma” is a function defined above the main function in my code where the value of integrand\_sigma is already calculated):

TF3 \*Sigma = new TF3(“Sigma”, integrand\_sigma , 0, 100,0,100,-1,1,2);  
Sigma-\>FixParameter(0, q);  
Sigma-\>FixParameter(1, T);  
ROOT::Math::WrappedMultiTF1 wf1(Sigma);  
ROOT::Math::AdaptiveIntegratorMultiDim ig;  
ig.SetRelTolerance(0.001);  
ig.SetFunction(wf1);  
double xmin[] = {0,0,-1};  
double xmax[] = {100,100,1};  
double sigma\_num = ig.Integral(xmin, xmax);

```
	cout<<sigma_result<<endl;

```

The error repeatedly being shown is :

Error: Can’t call WrappedMultiTF1::WrappedMultiTF1(Sigma) in current scope pion\_eta.C:191:  
Possible candidates are…  
Error: class,struct,union or type WrappedMultiTF1 not defined pion\_eta.C:191:  
\*\*\* Interpreter error recovered \*\*\*

---

<div class="post-metadata">

**Author:** ![Angey](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/f04885/32.png) [@Angey](https://root-forum.cern.ch/u/Angey)\
**Post date:** [January 27, 2020, 5:27am UTC](https://root-forum.cern.ch/t/tf3-integration/37676/5 "2020-01-27T05:27:50Z")

</div>

I doubt that it’s because ROOT::Math::WrappedMultiTF1 wf1 function is not supported by ROOT version 5.34/38 , the one I’m using. Is that so ??

---

<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:** [January 27, 2020, 7:05am UTC](https://root-forum.cern.ch/t/tf3-integration/37676/6 "2020-01-27T07:05:18Z")

</div>

Try: `ROOT::Math::WrappedMultiTF1 wf1(*Sigma);`

---

<div class="post-metadata">

**Author:** ![Angey](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/a/f04885/32.png) [@Angey](https://root-forum.cern.ch/u/Angey)\
**Post date:** [January 27, 2020, 7:08am UTC](https://root-forum.cern.ch/t/tf3-integration/37676/7 "2020-01-27T07:08:37Z")

</div>

I did…It’s showing bus error now!!

---

<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:** [January 27, 2020, 8:30am UTC](https://root-forum.cern.ch/t/tf3-integration/37676/8 "2020-01-27T08:30:01Z")

</div>

It seems to suggest that you have a bug somewhere in your “integrand\_sigma”.
