# Can the definite integral of a real valued function be a complex number with imaginary part?

While working on an engineering problem I needed to calculate this integral, so I typed it into the Wolfram Alpha and got this:

If you look at the logarithms, you will see that one of arguments have the opposite sign than the other. This means logarithms with negative arguments there, which means the result will definitely have imaginary terms. Why?

It doesn't look like there is a way to cancel the imaginary terms when I calculate a definite integral, but I think it's definitely possible to set the parameters and the range so the integrand remains real: large $a$, large $c$, small $b$ and the range of $x$ is around 0.

• I think it just means the "$+$ constant" is a nonreal constant. Commented Jan 20, 2016 at 12:02
• what is weird is that in wolfram $\text{Integrate Re[ ln(2*sqrt(a)*sqrt(a*x^2-b*x+c)+2*a*x-b)]}$ yields "no result" while $\text{Re[Integrate ln(2*sqrt(a)*sqrt(a*x^2-b*x+c)+2*a*x-b)]}$ yields $\text{Re[f(x)]}$ where $f$ is the function above Commented Jan 20, 2016 at 12:28
• Your function is not only real valued. With x=0 and c<0 you have a root out of a negative value there. Commented Jan 20, 2016 at 12:33
• @Diego of course it's not real valued everywhere. But the question ask why does it seem to give a complex number with an imaginary part when I perform a definite integral on a range where it remains real. Commented Jan 20, 2016 at 13:07
• @GerryMyerson But when I calculate a definite integral that constant vanishes anyway... Commented Jan 20, 2016 at 13:14

apart from the already mentioned fact that $$\ln(-a)=\ln(a)\pm i\pi$$ you can directly simplify the integral as $$I=\int\ln\left(\sqrt{(2ax-b)^2+4ac-b^2}+(2ax-b)\right) dx \\=\frac1{2a}\int\ln\left(\sqrt{u^2+d}+u\right) du$$ which has a decided resemblance to the Arsinh function. This suggests to look at $$\frac{d}{du}u·\ln\left(\sqrt{u^2+d}+u\right) = \ln\left(\sqrt{u^2+d}+u\right)+u·\frac{\frac{u}{\sqrt{u^2+d}}+1}{\sqrt{u^2+d}+u} \\= \ln\left(\sqrt{u^2+d}+u\right)+\frac{u}{\sqrt{u^2+d}}$$ (this is partial integration backwards), so that $$\int\ln\left(\sqrt{u^2+d}+u\right) du = u·\ln\left(\sqrt{u^2+d}+u\right) - \sqrt{u^2+d} + C$$
Inserting this backwards gets one $$I = \frac{2ax-b}{2a}·\ln\left(\sqrt{4a(ax^2-bx+c)}+2ax-b\right) - \frac1{2a}·\sqrt{4a(ax^2-bx+c)} + C$$ which up to variations of $\sqrt{4a}=2\sqrt{a}$ is the same anti-derivative as the one from WA.