# Integral with dependent bounds

**URL:** <https://root-forum.cern.ch/t/integral-with-dependent-bounds/54028>\
**Category:** Roofit and RooStats\
**Created:** [March 14, 2023, 7:36pm UTC](https://root-forum.cern.ch/t/integral-with-dependent-bounds/54028 "2023-03-14T19:36:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![morbik](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/439d5e/32.png) [@morbik](https://root-forum.cern.ch/u/morbik)\
**Post date:** [March 14, 2023, 7:36pm UTC](https://root-forum.cern.ch/t/integral-with-dependent-bounds/54028/1 "2023-03-14T19:36:17Z")

</div>

Dear all,

I have posted a question as a part of ROOT category over here [→](https://root-forum.cern.ch/t/double-integration-with-dependent-bounds/54017). I want to post the same thing with now RooFit. Is there any way to calculate double, or actually quadrupole integrals with dependent bounds with RooFit? I want to fit this function to data later on. While this is just a representative form, the function looks something like this before I change variables:

\int\_{9.5}^{10.5}da \frac{1}{x} \int\_{0}^{a}dt\ t\*sin(x \int\_{t}^{a}dc\ c) \* sph\_bessel(x,x\*\int\_{a}^{10000}dl\ \*l)

if I change variables to have independent limits, it looks like this:

\int\_{9.5}^{10.5}da \frac{1}{x} \int\_{0}^{1}dt\ a\*t\*sin(x \int\_{1}^{0}dk\ a\*t\*k) \* sph\_bessel(x,x\*\int\_{1}^{0}dl\ a\*l)

Can I do this over RooFit? Thanks so much for your help!

Cheers,  
morbik

---

<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:** [March 15, 2023, 9:24am UTC](https://root-forum.cern.ch/t/integral-with-dependent-bounds/54028/2 "2023-03-15T09:24:49Z")

</div>

In the first formula, the integral over “`dl`” is just “`(1.e8-a*a)/2.`” and the integral over “`dc`” is just “`(a*a-t*t)/2.`”.

BTW. It seems to me that the “[change of variables](https://en.wikipedia.org/wiki/Integration_by_substitution)” (for “`l`”, “`c`” and “`t`”) in the second formula is not correct.

---

<div class="post-metadata">

**Author:** ![morbik](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/439d5e/32.png) [@morbik](https://root-forum.cern.ch/u/morbik)\
**Post date:** [March 16, 2023, 7:13am UTC](https://root-forum.cern.ch/t/integral-with-dependent-bounds/54028/3 "2023-03-16T07:13:23Z")

</div>

Dear @Wile_E_Coyote, thank you for your answer but this is a representative form as I have indicated. The real form of the function is like this:

\int\_{9.5}^{10.5}da\frac{0.6}{\sqrt{3}x} \{ \int\_a^1db\frac{b^{3/2}}{(1+b)^{1/2}}sin(\frac{x}{0.6\sqrt{3}}\int\_b^a dc \frac{1}{c(1+c)^{1/2}})\*sph\_bessel(x,\frac{x}{0.6} \int\_a^{10000} dc \frac{1}{c(1+c)^{1/2}}) \}

I want to draw this function as x extends from 1 to 1000.

I didn’t want to explicitely give this as it is quite complicated. I can change the limits of the integrals to be 1 and 0 as you have suggested earlier. But the thing is that: I am just trying to understand if ROOT can perform integrals that are **not** of the form \int\int\int\int f(x,y,z,t)dx dy dz dt.

I hope I am able to make myself clear.

Best regards,  
morbik

---

<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:** [March 16, 2023, 8:49am UTC](https://root-forum.cern.ch/t/integral-with-dependent-bounds/54028/4 "2023-03-16T08:49:43Z")

</div>

For available “quadrature” routines see:

> [@Double integration with dependent bounds](https://root-forum.cern.ch/t/double-integration-with-dependent-bounds/54017/4):
>
> [ROOT Manual → Functional parts → Mathematical libraries → MathCore library → Numerical integration](https://root.cern/manual/math/#numerical-integration)

See also the “[MathCore](https://root.cern.ch/doc/master/group__MathCore.html)” and “[MathMore](https://root.cern.ch/doc/master/group__MathMore.html)” documentation.

In principle, ROOT internally often uses:

- for “special functions”: [GSL → Special Functions](https://www.gnu.org/software/gsl/doc/html/specfunc.html)

- for “quadrature”: [GSL → Numerical Integration](https://www.gnu.org/software/gsl/doc/html/integration.html) and [GSL → Monte Carlo Integration](https://www.gnu.org/software/gsl/doc/html/montecarlo.html)

If you find some appropriate routine in [GSL (GNU Scientific Library)](https://www.gnu.org/software/gsl/doc/html/index.html), you should be able to use it in ROOT.

BTW. [The integrals over “`dc`” can be calculated analytically](https://www.wolframalpha.com/input?i2d=true&i=integrate+Divide%5B1%2CxSqrt%5B1%2Bx%5D%5D). In principle, one should use clean “analytical formulas” whenever possible.

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [March 30, 2023, 8:50am UTC](https://root-forum.cern.ch/t/integral-with-dependent-bounds/54028/5 "2023-03-30T08:50:41Z")

</div>

Closed on March 30, 2023, 8:50am UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
