My question may seem naive, but I couldn't find its answer in books, websites, etc.
Assume that I want to calculate numerically the absolute value of the following integral
$$I = \int_0^T\exp(if(t)),$$
where $f(t)$ is a real function of $t$.
Which one of the following is the answer?
$\quad|I|^2 = I\cdot I^*$
$\quad|I|^2 = \displaystyle\int_0^T\mathrm dt\int_0^t\mathrm dt'\exp(-if(t))\exp(if(t'))$
Any comment or help would be highly appreciated.
The absolute value of any complex number is given by
$$|a|=\sqrt{a \cdot a^*}$$
It does not matter if you get the value of $a$ by integration, differentiation or another operation. Therefore your first solution is correct.
Your second example introduces a dependency between the integrals, which leads to a wrong result.