I need to compute the following integral \begin{equation*}\int_{t_\text{s}}^{t_\text{e}} \cos(a+b\tau+c\tau^2)\text{ d}\tau\end{equation*} where $t_{\text{s}}<t_{\text{e}}$ and $a,b,c>0$ are given parameters.


Actually, thanks to the help of @egglog and @Bobby Laspy, I've got a clear solution expressed in terms of the so-called Fresnel integrals \begin{equation*}C(t)\triangleq \int_0^t \cos(\tau^2)\text{ d}\tau \qquad S(t)\triangleq \int_0^t \sin(\tau^2)\text{ d}\tau\end{equation*} Indeed this post is a continuation of this previous one.


From what I've understood, the Fresnel integrals are somewhat related to $\text{erf}(\cdot)$ function which, as an engineer, is more familiar to me. Wikipedia presents an expression of $C(\cdot)$ and an expression of $S(\cdot)$ in terms of the $\text{erf}(\cdot)$ function, which are \begin{equation*}\begin{aligned} S(z)&=\sqrt{\frac{\pi}{2}}\frac{1+i}{4}\left[\text{erf}\left(\frac{1+i}{\sqrt{2}}z\right)-i\,\text{erf}\left(\frac{1-i}{\sqrt{2}}z\right)\right]\\ C(z)&=\sqrt{\frac{\pi}{2}}\frac{1-i}{4}\left[\text{erf}\left(\frac{1+i}{\sqrt{2}}z\right)+i\,\text{erf}\left(\frac{1-i}{\sqrt{2}}z\right)\right] \end{aligned}\end{equation*} where, I believe, $i$ is the imaginary unit and the input $z$ is complex. A first question is the following:

  • 1) what are the expressions of the (not complex) $C(\cdot)$ and $S(\cdot)$ in terms of $\text{erf}(\cdot)$?

The answer to the first question can be obtained from the two expressions above by simply putting inside them $z=t$ real, but I would like to have an explanation (because I don't know if I have correctly understood the underlying theory) and so I'm trying to find a proof for the expressions above.

Moreover, it is not clear if the output of the previous expressions is real if $z=t$ is real, so a second question is the following:

  • 2) Why for $z=t$ real the expressions above give a real output?

My attempt to prove the expressions, which is below, give rise to a third question:

  • 3) In the derivations of the results are involved the square roots of $\text{j}$ (imaginary unit expressed in my favorite notation) and $-\text{j}$. Both $\text{j}$ and $-\text{j}$ have two square roots, so what roots I have to consider and why?

Finally, I have also a fourth question about the utility of the $\text{erf}(\cdot)$ function. The expression above requires the computation of $\text{erf}(\cdot)$ with complex input. The $\text{erf}(\cdot)$ is not expressed in terms of elementary functions, so in a practical scenario one have to use some numerical approximation. But when the input is complex what happens? There are some numerical approximation for this more complicated case? It seems to me that the $\text{erf}(\cdot)$ function yields the computation of the Fresnel integrals more complicated because there are numerical approximations, that works with real inputs, of $C(\cdot)$ and $S(\cdot)$. The question is thus the following:

  • 4) What is the utility of expressing the Fresnel integrals in terms of the $\text{erf}(\cdot)$ function?

Cosine integral derivation

I consider the case of the cosine integral function (I believe that the sine case is analogous with some minor adjustments), so my objective is to express the integral \begin{equation*}C(t)\triangleq \int_0^t \text{cos}\left(\tau^2\right)\text{ d}\tau\end{equation*} in terms of the error function \begin{equation*}\text{erf}(t)\triangleq \frac{2}{\sqrt{\pi}}\int_0^t \exp\left(-\tau^2\right)\text{ d}\tau\end{equation*} So, in order to do that I'm tempted to express the cosine as the as the combination of two complex exponentials \begin{equation*}\begin{aligned} C(t)&= \int_0^t \frac{\text{exp}\left[\text{j}\left(\tau^2\right)\right]+\text{exp}\left[-\text{j}\left(\tau^2\right)\right]}{2}\text{ d}\tau \end{aligned}\end{equation*} where $\text{j}$ is the imaginary unit (I prefer this notation than $i$). Now I have the exponentials with quadratic arguments, but I'm still far from the result. Unfortunately it is not clear what to do, so I have to exploit my fantasy to find a way to rearrange the integral in a way such that the $\text{erf}(\cdot)$ function turns out somewhere.

Firstly, I split the integrand, \begin{equation*}\begin{aligned} C(t)&= \frac{1}{2}\left[\underbrace{\int_0^t \text{exp}\left(\text{j}\tau^2\right)\text{ d}\tau}_{\triangleq I_1}+\underbrace{\int_0^t\text{exp}\left(-\text{j}\tau^2\right)\text{ d}\tau}_{\triangleq I_2}\right] \end{aligned}\end{equation*} so that I have to compute two independent integrals $I_1$ and $I_2$.

  • Second integral

    I start from the second integral because is easier. Thanks to the following dirty trick \begin{equation*}\begin{aligned} I_2&= \frac{1}{\sqrt{\text{j}}}\int_0^t\text{exp}\left(-\text{j}\tau^2\right)\sqrt{\text{j}}\text{ d}\tau \end{aligned}\end{equation*} I can use the change of variable \begin{equation*} \alpha(\tau)\triangleq \sqrt{\text{j}}\,\tau \end{equation*} which implies $\text{d}\alpha=\sqrt{\text{j}}\,\text{d}\tau$, to write finally \begin{equation*}\begin{aligned} I_2&= \frac{1}{\sqrt{\text{j}}}\int_0^{\sqrt{\text{j}}t}\text{exp}\left(-\alpha^2\right)\text{ d}\alpha=\frac{1}{\sqrt{\text{j}}}\frac{\sqrt{\pi}}{2}\text{erf}\left(\sqrt{\text{j}}t\right) \end{aligned}\end{equation*}

  • First integral

    For the first integral I use the same procedure, but starting from a different trick \begin{equation*}\begin{aligned} I_1&= \frac{1}{\sqrt{-\text{j}}}\int_0^t\text{exp}\left(\text{j}\tau^2\right)\sqrt{-\text{j}}\text{ d}\tau \end{aligned}\end{equation*} so that the change of variable \begin{equation*} \beta(\tau)\triangleq \sqrt{-\text{j}}\,\tau \end{equation*} allows to write \begin{equation*}\begin{aligned} I_1&= \frac{1}{\sqrt{-\text{j}}}\int_0^{\sqrt{-\text{j}}t}\text{exp}\left(-\beta^2\right)\text{ d}\beta= \frac{1}{\sqrt{-\text{j}}}\frac{\sqrt{\pi}}{2}\text{erf}\left(\sqrt{-\text{j}}t\right)\\ \end{aligned}\end{equation*}

In conclusion, the implicit result is \begin{equation*}C(t)=\frac{\sqrt{\pi}}{4}\left[\frac{1}{\sqrt{-\text{j}}}\text{erf}\left(\sqrt{-\text{j}}t\right)+\frac{1}{\sqrt{\text{j}}}\text{erf}\left(\sqrt{\text{j}}t\right)\right]\end{equation*} here I'm saying "implicit" because the square roots of $\text{j}$ and $-\text{j}$ are left implicit. This is a problem because both $\text{j}$ and $-\text{j}$ have not one square root, but two square roots! \begin{equation*}\begin{aligned} \sqrt{\text{j}}&=\sqrt{\exp\left(\text{j}\frac{\pi}{2}\right)}=\pm\exp\left(\text{j}\frac{\pi}{4}\right)=\pm\left(\frac{\sqrt{2}}{2}+\text{j}\frac{\sqrt{2}}{2}\right)\\ \sqrt{-\text{j}}&=\sqrt{\exp\left(-\text{j}\frac{\pi}{2}\right)}=\pm\exp\left(-\text{j}\frac{\pi}{4}\right)=\pm\left(\frac{\sqrt{2}}{2}-\text{j}\frac{\sqrt{2}}{2}\right)\\\end{aligned} \end{equation*} so, which one I have to consider? This is not so clear. It seems that Wikipedia consider the first roots (the one with the positive sign outside), but why?

Final observation

Such square roots are born from the change of variables $\alpha$ and $\beta$, so in principle I can decide by myself what root to use because any root leads to the same integral in $\text{d}\alpha$ and the same integral in $\text{d}\beta$. But this fact must imply that the ending result for $C(\cdot)$ is independent from the choice of the roots. This is actually true? I cannot see it clearly because the inputs of the $\text{erf}(\cdot)$ functions changes if the roots of $\sqrt{\text{j}}$ and $\sqrt{-\text{j}}$ change.


1 Answer 1

  1. A way to derive the two equations without any square root ambiguities is to start from the error functions. For any $z \in \mathbb{C}$ we have \begin{align*} \operatorname{erf}\left(\frac{1 \pm \mathrm{j}}{\sqrt{2}} z\right) &= \frac{2}{\sqrt{\pi}} \int \limits_0^{\frac{1 \pm \mathrm{j}}{\sqrt{2}} z} \mathrm{e}^{-\tau^2} \, \mathrm{d} \tau \overset{\tau = \frac{1 \pm \mathrm{j}}{\sqrt{2}} \sigma}{=} \sqrt{\frac{2}{\pi}} (1\pm \mathrm{j}) \int \limits_0^z \mathrm{e}^{\mp \mathrm{j} \sigma^2} \, \mathrm{d} \sigma \\ &= \sqrt{\frac{2}{\pi}} (1\pm \mathrm{j}) \int \limits_0^z \left[\cos(\sigma^2) \mp \mathrm{j} \sin(\sigma^2)\right] \, \mathrm{d} \sigma \\ &= \sqrt{\frac{2}{\pi}} (1\pm \mathrm{j}) \left[\operatorname{C}(z) \mp \mathrm{j} \operatorname{S}(z)\right] \, . \end{align*} Solving these equations for $\operatorname{C}(z)$ and $\operatorname{S}(z)$ immediately yields the representations you quoted.

  2. In particular, your identities hold for $z = t \in \mathbb{R}$. Together with the fact that $\operatorname{C}(t)$ and $\operatorname{S}(t)$ are real this implies that the right-hand sides must be real as well, but this is of course not the argument you are looking for. Instead, let us directly show that the terms on the right are equal to their complex conjugates. To this end we note that $\overline{\operatorname{erf}(z)} = \operatorname{erf}(\overline{z})$ holds for $z \in \mathbb{C}$, since $\operatorname{erf}$ has a globally convergent power series representation at $0$ with real coefficients. Therefore, we find \begin{align*} \overline{(1\pm\mathrm{j}) \left[\operatorname{erf}\left(\frac{1 + \mathrm{j}}{\sqrt{2}} t\right) \mp \mathrm{j} \operatorname{erf}\left(\frac{1 - \mathrm{j}}{\sqrt{2}} t\right)\right]} &= (1\mp\mathrm{j}) \left[\operatorname{erf}\left(\frac{1 - \mathrm{j}}{\sqrt{2}} t\right) \pm \mathrm{j} \operatorname{erf}\left(\frac{1 + \mathrm{j}}{\sqrt{2}} t\right)\right] \\ &= (1\mp\mathrm{j}) (\pm \mathrm{j}) \left[\mp \mathrm{j} \operatorname{erf}\left(\frac{1 - \mathrm{j}}{\sqrt{2}} t\right) + \operatorname{erf}\left(\frac{1 + \mathrm{j}}{\sqrt{2}} t\right)\right] \\ &= (1\pm\mathrm{j}) \left[\operatorname{erf}\left(\frac{1 + \mathrm{j}}{\sqrt{2}} t\right) \mp \mathrm{j} \operatorname{erf}\left(\frac{1 - \mathrm{j}}{\sqrt{2}} t\right)\right] \end{align*} for $t \in \mathbb{R}$.

  3. Here your final observation is correct: you do not have to write $\sqrt{\mathrm{j}}$ and artificially introduce an ambiguity here. You can just use $\frac{1+\mathrm{j}}{\sqrt{2}}$ from the start (and $\frac{1-\mathrm{j}}{\sqrt{2}}$ instead of $\sqrt{-\mathrm{j}}$) to get the result you want. Note, however, that choosing the other square roots does indeed not change the result: Since $\operatorname{erf}$ is an odd function, we have $$ \left(-\frac{1 \pm \mathrm{j}}{\sqrt{2}}\right)^{-1} \!\operatorname{erf} \left(- \frac{1 \pm \mathrm{j}}{\sqrt{2}}t\right) = - \left(- \frac{1 \pm \mathrm{j}}{\sqrt{2}}\right)^{-1} \operatorname{erf} \left(\frac{1 \pm \mathrm{j}}{\sqrt{2}}t\right) = \left(\frac{1 \pm \mathrm{j}}{\sqrt{2}}\right)^{-1} \!\operatorname{erf} \left(\frac{1 \pm \mathrm{j}}{\sqrt{2}}t\right) \, ,$$ so the additional minus sign just cancels.

  4. I am not an expert on numerics, but in my view this relation is not a simplification of the Fresnel integrals. It does not express these special functions in terms of elementary functions (which is impossible), but simply provides a connection to another special function, the error function. This can be helpful in some calculations, but I would not usually use it to rewrite real expressions with Fresnel integrals (e.g. the answer to your previous question) in terms of the error function with complex arguments.

  • $\begingroup$ Thanks for your highly detailed answer. I agree with you on every point, and now I have a much better understanding of the error function. It was a pleasure reading you, thank you again. $\endgroup$
    – matteogost
    Commented Jan 21, 2022 at 15:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .