[Math] Can an integral over a real function give a complex function

calculuscomplex integrationintegration

Somebody else asked a similar question here and got the answer that an integral of a real function over a portion of the real line must give a real number. However, with WolframAlpha I found several examples of real functions (on $x\in [0,\infty])$ which lead to an imaginary part after integration. One example was

$$\int \frac{dx}{(x^3+2)^{2/3}}$$

According to the plot in Wolfram Alpha, the result of this integration has a constant non-zero imaginary part for the plotted interval of positive numbers (Wolfram Alpha used $x\in [0,8.4]$). The link to my input is
here.

How can there be an imaginary part even though $\frac{1}{(x^3+2)^{2/3}}$ is real for $x\in[0,8.4]$? Could this be a problem with Wolfram Alpha or is there something special about this function, where its integration leads to a function with an imaginary part?

Best Answer

Can an integral of a real function give a complex number?

No. This is clear from the definition of an integral as a limit of Riemann sums. That is, integrating the real-valued $f$ on an interval with partitions that I denote by $\{x_n\}$, then we see all sums $$ \sum_{x_n} [x_n - x_{n-1}] f(x_n)$$ are sums of real numbers. Thus their limit (presuming the function is integrable) is real.

What's happening with W|A is a result of approximations. The result W|A gives for the indefinite integral is exact, but it's quite complicated. The surprising fact is that all the apparent imaginary parts in the many cube roots and the hypergeometric function perfectly cancel out. This is similar to the historical development of Cardano's solution to the cubic, which can yield intermediate steps with imaginary numbers even when all roots are actually real.

I would guess that the apparent imaginary part in the plot shown on W|A comes from a poor approximation of the imaginary part of the (admittedly very hard to accurately estimate) hypergeometric function $_2F_1$.

It may be good to consider the plot of the integrand and evaluation of the integral on $[0,8.4]$ given by W|A, which shows a pretty ordinary (real) number result.

It turns out that W|A makes lots of mistakes, as do all computer algebra systems.

Related Question