# Complex integral constant in real integration

Can an indefinite integration of a real function with respect to real variable have a complex integral constant? i.e. for $\int f(x) dx = g(x) + c$, can '$c$' be complex, where $f(x)$ is a real function?

N.B. I have found a lot of integrations of real function (example 1, example 2) which use theorems from complex analysis, but finally get real value.

N.B. As per as I understand, it can't have complex constant, because integration of a real valued function would only be defined on real plane. Am I right?

N.B. I am just checking my understanding. I need to use this result in another problem.

• Many years ago, I asked one of the early computer algebra packages to find an antinderivative for $\sec x$. The answer it gave me didn't look at all like the one I was expecting, the one that was in all the Calculus textbooks. After wrestling with it for a while, I found it differed from the one I was expecting by $\pi i/4$. – Gerry Myerson Sep 5 '16 at 9:51
Sure, it can be complex: The indefinite integral $$\int f(x) dx=g(x)+C$$ is the antiderivative of the integrand $f(x)$. What this implies is that if you differentiate $g(x)+C$, you should get back to $f(x)$, and you will do this for any $C$, complex or not, as long as it isn't a function of $x$.
Beginners calculus is about real-valued functions of a real variable $t$. Indeed most "elementary" functions occurring in engineering and physics, like $\sqrt{\cdot}$, $\exp$, $\sin$, ${\rm erf}$, etc., are of this type. As long as you are only interested in the "real" world you do not need to consider complex integration constants.
But it turns out that for a better understanding and description of many physical phenomena we should actively take complex-valued functions of a real variable $t$ ("time") into consideration. The most famous example of course is $t\mapsto e^{it}$. In ODE problems we are used to make an "Ansatz" of the form $y(t):=e^{\lambda t}$ with an as yet unknown $\lambda$, which in the end may turn out complex. In such an environment not only the functions may be complex-valued, but the integration constants we introduce underway have to be conceived as complex-valued, or else we miss an infinity of solutions.