# Approximating integral with small parameter

I want to approximately compute integral $$I =\int_0^1 dx \frac{x(2-x)(1-x)}{(1-x)^2+\mu x}$$ assuming that $$\mu$$ is small. I tried

Integrate [(2 - x) (1 - x) x/((1 - x)^2 + A x), {x, 0, 1}]


My Mathematica for some reason fails to do this integral explicitly (which is strange, since it is an integral of a rational function; I guess Mathematica obtains divergent answer after decomposing the fraction, but can see that the integral is convergent in fact), so that I could just approximate the exact result.

On the other hand, the point of $$\mu x$$ term is to "regulate" divergence of this integral (i.e. integral without it, $$\int_0^1 dx \frac{x(2-x)(1-x)}{(1-x)^2}$$, is logarithmically divergent on the upper limit). Therefore, the whole effect of this term can be accounted by shifting the upper limit:

$$I \approx \int_0^{1-\mu} dx \frac{x(2-x)(1-x)}{(1-x)^2}$$

Now Mathematica can compute this integral easily

Integrate [(2 - x) (1 - x) x/(1 - x)^2, {x, 0, 1 - A}, Assumptions -> A > 0]


giving $$I = -\frac{1}{2}(1+\ln(\mu^2)-\mu^2)$$, which can be approximated as $$I \approx -\frac{1}{2}(1+\ln(\mu^2))$$

I wonder if there is any function, smth like ApproximateIntegral[f[x,s],{x,a,b},{s,0}], which could do this whole manipulation for me.

You could use AsymptoticIntegrate, although I change the $$\mu x$$ term to just $$\mu$$, as the latter version is easier for AsymptoticIntegrate to handle:

AsymptoticIntegrate[(x(2-x)(1-x))/((1-x)^2+μ), {x,0,1}, {μ,0,2}]


-1/2 + μ^2/4 + μ (1/2 - Log[μ]/2) - Log[μ]/2

AsymptoticIntegrate also works when using $$\mu x$$, but is much slower, and needs to use a higher order than 1 to get a correct answer:

asymp = AsymptoticIntegrate[(x(2-x)(1-x))/((1-x)^2+μ x), {x,0,1}, {μ,0,2}]; //AbsoluteTiming
asymp //TeXForm


{127.263, Null}

$$-\frac{(\mu -1) \left(\mu ^2-4 \mu \right) \tanh ^{-1}\left(\frac{\mu -2}{\sqrt{\mu -4} \sqrt{\mu }}\right)}{2 \sqrt{\mu -4} \sqrt{\mu }}+\frac{(\mu -1) \left(\mu ^2-4 \mu \right) \tanh ^{-1}\left(\frac{\sqrt{\mu }}{\sqrt{\mu -4}}\right)}{2 \sqrt{\mu -4} \sqrt{\mu }}-\mu +\frac{1}{4} (\mu -2) (\mu -1) \log (\mu )+(\mu -1) \log (\mu )-\frac{2 (\mu -3) \tanh ^{-1}\left(\frac{\mu -2}{\sqrt{\mu -4} \sqrt{\mu }}\right)}{\sqrt{\frac{\mu -4}{\mu }}}-\frac{(\mu -3) (\mu -2) \tanh ^{-1}\left(\frac{\mu -2}{\sqrt{\mu -4} \sqrt{\mu }}\right)}{2 \sqrt{\frac{\mu -4}{\mu }}}+\frac{2 (\mu -3) \tanh ^{-1}\left(\frac{\sqrt{\mu }}{\sqrt{\mu -4}}\right)}{\sqrt{\frac{\mu -4}{\mu }}}+\frac{\sqrt{\mu -4} (\mu -3) \sqrt{\mu } \left(\frac{\log (\mu )}{2}+\frac{(\mu -2) \tanh ^{-1}\left(\frac{\sqrt{\mu }}{\sqrt{\mu -4}}\right)}{\sqrt{\mu -4} \sqrt{\mu }}\right)}{2 \sqrt{\frac{\mu -4}{\mu }}}-\frac{1}{2}$$

The Series expansion of asymp reproduces user64494's result:

Series[asymp, {μ, 0, 2}, Assumptions->μ>0] //TeXForm


$$\left(-\frac{\log (\mu )}{2}-\frac{1}{2}\right)+\frac{\pi \sqrt{\mu }}{4}+\mu \left(-\frac{\log (\mu )}{2}-\frac{5}{4}\right)+\frac{25}{32} \pi \mu ^{3/2}+\mu ^2 \left(\frac{\log (\mu )}{2}-\frac{19}{24}\right)+O\left(\mu ^{5/2}\right)$$

• Maybe interesting to someone: using the full μx term here, leads AsymptoticIntegrate to return the fully correct analytic answer, equivalent to the answer of Integrate in this case! – Thies Heidecke Apr 25 at 11:44
• Sorry, but this is a surrogate, not the true answer. Please don't delete my comment as before. – user64494 Apr 25 at 15:53
• BTW, the AsymptoticIntegrate command produces an incorrect result for the integral from the question. The report [CASE:4251479] was submitted by me. – user64494 Apr 25 at 15:57
• @user64494 I did not delete your comment. AsymptoticIntegrate at lowest order produces an incorrect result, which can be fixed by raising the order. Of course, if Mathematica can evaluate the integral symbolically, then there is no reason to use AsymptoticIntegrate. Still, the OP asked for such a method. – Carl Woll Apr 25 at 16:19
• Unfortunately, the AsymptoticIntegrate command of order 2 without the assumption $\mu>0$ or with the assumption $\mu<0$ produces an incorrect answer. – user64494 Apr 25 at 16:50

The true answer in version 12 is as follows.

Integrate[(x*(2 - x)*(1 - x))/((1 - x)^2 +\[Mu]*x),{x, 0, 1},Assumptions-> \[Mu] > 0 && \[Mu] < 1]


(1/(2 (-4 + [Mu])^( 3/2)))Sqrt[[Mu]] (4 I Sqrt[-1 + 4/[Mu]] + 7 I Sqrt[(4 - [Mu]) [Mu]] - 2 I Sqrt[(4 - [Mu]) [Mu]^3] + I (4 Sqrt[-1 + 4/[Mu]] + 3 Sqrt[(4 - [Mu]) [Mu]] - 5 Sqrt[(4 - [Mu]) [Mu]^3] + Sqrt[-(-4 + [Mu]) [Mu]^5]) Log[[Mu]] + [Mu] (12 - 7 [Mu] + [Mu]^2) Log[1 - I Sqrt[-([Mu]/(-4 + [Mu]))]] - 12 [Mu] Log[1 + I Sqrt[-([Mu]/(-4 + [Mu]))]] + 7 [Mu]^2 Log[1 + I Sqrt[-([Mu]/(-4 + [Mu]))]] - [Mu]^3 Log[ 1 + I Sqrt[-([Mu]/(-4 + [Mu]))]] + 4 Log[1 - (I [Mu])/Sqrt[-(-4 + [Mu]) [Mu]]] - [Mu] Log[ 1 - (I [Mu])/Sqrt[-(-4 + [Mu]) [Mu]]] - 4 Log[1 + (I [Mu])/Sqrt[-(-4 + [Mu]) [Mu]]] + [Mu] Log[ 1 + (I [Mu])/Sqrt[-(-4 + [Mu]) [Mu]]] - 4 Log[(2 I - I [Mu] + Sqrt[-(-4 + [Mu]) [Mu]])/ Sqrt[-(-4 + [Mu]) [Mu]]] - 11 [Mu] Log[(2 I - I [Mu] + Sqrt[-(-4 + [Mu]) [Mu]])/ Sqrt[-(-4 + [Mu]) [Mu]]] + 7 [Mu]^2 Log[(2 I - I [Mu] + Sqrt[-(-4 + [Mu]) [Mu]])/ Sqrt[-(-4 + [Mu]) [Mu]]] - [Mu]^3 Log[( 2 I - I [Mu] + Sqrt[-(-4 + [Mu]) [Mu]])/ Sqrt[-(-4 + [Mu]) [Mu]]] + 4 Log[(-2 I + I [Mu] + Sqrt[-(-4 + [Mu]) [Mu]])/ Sqrt[-(-4 + [Mu]) [Mu]]] + 11 [Mu] Log[(-2 I + I [Mu] + Sqrt[-(-4 + [Mu]) [Mu]])/ Sqrt[-(-4 + [Mu]) [Mu]]] - 7 [Mu]^2 Log[(-2 I + I [Mu] + Sqrt[-(-4 + [Mu]) [Mu]])/ Sqrt[-(-4 + [Mu]) [Mu]]] + [Mu]^3 Log[(-2 I + I [Mu] + Sqrt[-(-4 + [Mu]) [Mu]])/Sqrt[-(-4 + [Mu]) [Mu]]])

Series[%, {\[Mu], 0, 2}, Assumptions -> \[Mu] > 0 && \[Mu] < 1]


$$\frac{1}{2} (-\log (\mu )-1)+\frac{\pi \sqrt{\mu }}{4}+\frac{1}{4} \mu (-2 \log (\mu )-5)+\frac{25}{32} \pi \mu ^{3/2}+\frac{1}{24} \mu ^2 (12 \log (\mu )-19)+O\left(\mu ^{5/2}\right)$$

Addition. In order to complete the answer, let us consider the asymptotics for negative values of $$\mu$$:

Integrate[(x*(2 - x)*(1 - x))/((1 - x)^2 + \[Mu]*x), {x, 0, 1},
PrincipalValue -> True, Assumptions -> \[Mu] < 0 && \[Mu] > -1]


1/2 (-1 - 2 [Mu] + (-1 - [Mu] + [Mu]^2) Log[-[Mu]] + Sqrt[[Mu]/(-4 + [Mu])] (-1 - 3 [Mu] + [Mu]^2) Log[ 1 + Sqrt[[Mu]/(-4 + [Mu])]] + Sqrt[[Mu]/(-4 + [Mu])] Log[1 + [Mu]/Sqrt[(-4 + [Mu]) [Mu]]] + 3 [Mu] Sqrt[[Mu]/(-4 + [Mu])] Log[1 + [Mu]/ Sqrt[(-4 + [Mu]) [Mu]]] - [Mu]^2 Sqrt[[Mu]/(-4 + [Mu])] Log[1 + [Mu]/Sqrt[(-4 + [Mu]) [Mu]]] - Sqrt[[Mu]/(-4 + [Mu])] Log[(2 - [Mu] - Sqrt[(-4 + [Mu]) [Mu]])/ Sqrt[(-4 + [Mu]) [Mu]]] - 3 [Mu] Sqrt[[Mu]/(-4 + [Mu])] Log[(2 - [Mu] - Sqrt[(-4 + [Mu]) [Mu]])/ Sqrt[(-4 + [Mu]) [Mu]]] + [Mu]^2 Sqrt[[Mu]/(-4 + [Mu])] Log[(2 - [Mu] - Sqrt[(-4 + [Mu]) [Mu]])/ Sqrt[(-4 + [Mu]) [Mu]]] + Sqrt[[Mu]/(-4 + [Mu])] Log[(2 - [Mu] + Sqrt[(-4 + [Mu]) [Mu]])/ Sqrt[(-4 + [Mu]) [Mu]]] + 3 [Mu] Sqrt[[Mu]/(-4 + [Mu])] Log[(2 - [Mu] + Sqrt[(-4 + [Mu]) [Mu]])/ Sqrt[(-4 + [Mu]) [Mu]]] - [Mu]^2 Sqrt[[Mu]/(-4 + [Mu])] Log[(2 - [Mu] + Sqrt[(-4 + [Mu]) [Mu]])/ Sqrt[(-4 + [Mu]) [Mu]]])

Series[%, {\[Mu], 0, 2}, Assumptions -> \[Mu] < 0 && \[Mu] > -1]


$$\frac{1}{2} (-\log (-\mu )-1)+\frac{1}{4} \mu (-2 \log (-\mu )-5)+\frac{1}{24} \mu ^2 (12 \log (-\mu )-19)+O\left(\mu ^{5/2}\right)$$

If you are only trying to find the convergent piece of the integral, you can set GenerateConditions to be False:

Integrate[((1-x) (2-x) x)/(1-x)^2,{x,0,1},GenerateConditions->False] gives $$-1/2$$.

This is not an isolated example, I have observed this behavior for many divergent integrals; setting GenerateConditions to be false seems to give the convergent part each case, convergent in the sense that the leading divergent piece is assumed to be cancelled by a regulator.

Another such an example is

Integrate[1/(x + a), {x, 0, \[Infinity]}, GenerateConditions -> False] Log[1/a]  which matches the convergent piece of cut-off regularization:  Series[Normal[Integrate[1/(x+a),{x,0,L},Assumptions->L>0]],{L,\[Infinity],0}] Log[L/a]+O[1/L]^1 

I would appreciate if anyone with a deeper knowledge of this behaviour can enlighten us.

• GenerateConditions->False is an overloaded setting, and one intent is indeed to provide regularizations of otherwise divergent integrals. – Daniel Lichtblau Apr 28 at 12:34