Mathematica seems to integrate this function: $\int \limits_{-\infty}^{\infty} d w\, \frac{\sin ^2\left(\frac{1}{2} wt \right)}{w^2} \frac{\frac{\gamma ^2}{4}}{ \left(w^2+\frac{\gamma ^2}{4}\right)}$, which is Lorentzian product with Sinc squared.

But it can not integrate shifted version shifted by a constant value $a>0$: $\int \limits_{-\infty}^{\infty} d w\, \frac{\sin ^2\left(\frac{1}{2} (a-w)t\right)}{(a-w)^2} \frac{\frac{\gamma ^2}{4}}{ \left((w-a)^2+\frac{\gamma ^2}{4}\right)}$

Why would be that? Does not seem that integration would be different for shifted function. $\gamma$ and $t$ are variating parameters, width of Lorentzian peak and time, respectively.

Here is my code, I also use assumptions for integration to be easier:

Lorentz = (1/4) \[Gamma]^2/((w - a)^2 + (\[Gamma]^2/4));
Sincfunction = Sin[(1/2 (a - w)*t)]^2/(a - w)^2;

IIntegral2 = 
 Integrate[Lorentz*Sincfunction, {w, - Infinity, Infinity}, 
    Assumptions -> {Im[\[Gamma]] == 0, Re[\[Gamma]] > 0, Im[t] == 0, 
    Re[t] >= 0, Im[a] == 0, Re[a] >= 0  , 1/2*Re[\[Gamma]] < Re[a], 
    Im[w] == 0 }]

Then to simplify I usually expand it into series

Series[IIntegral2, {t, Infinity, 2}, {\[Gamma], Infinity, 1}] // Normal
Series[IIntegral2, {t, 0, 2}, {\[Gamma], 0, 2}] // Normal

So when I set $a=0$, everything works fine, bet when $a>0$, then Mathematica gets stuck.

  • 1
    $\begingroup$ Internal code is probably not seeing the right change of variable. $\endgroup$ May 19, 2020 at 20:14
  • $\begingroup$ Would there be a way to correct it or it is up to software developers? $\endgroup$ May 20, 2020 at 6:25
  • 1
    $\begingroup$ A little of both, perhaps. It never hurts to express a problem in the simplest (for the software) form possible. It's also possible the software will improve in future to automate this. $\endgroup$ May 20, 2020 at 14:23
  • $\begingroup$ In the meantime, it wouldn't hurt to report this to Support (and perhaps link to this thread), so it gets on record. $\endgroup$ May 20, 2020 at 14:41
  • $\begingroup$ Ok, thanks for the suggestions! $\endgroup$ May 24, 2020 at 11:54

1 Answer 1


Mathematica is able to integrate both cases, but for the shifted function 100 times longer calculation is needed.

Lorentz[a_,γ_,w_]:=(1/4) γ^2/((w-a)^2+(γ^2/4));
Sincfunction[a_,t_,w_]=Sin[(1/2 (a-w)*t)]^2/(a-w)^2;

Compare the times

Integrate[Lorentz[a,γ,w] Sincfunction[a,t,w],{w,-Infinity,Infinity},Assumptions->t>0&&γ>0&&a∈Reals]//Timing
Out[2]= {99.977,(π (-2+2 E^(-((t γ)/2))+t γ))/(2 γ)}


Integrate[Lorentz[0,γ,w] Sincfunction[0,t,w],{w,-Infinity,Infinity},Assumptions->t>0&&γ>0]//Timing
Out[3]= {1.00345,(π (-2+2 E^(-((t γ)/2))+t γ))/(2 γ)}

The results are identical. In order to understand the large time-difference compare the respective indefinite integrations:

Integrate[Lorentz[a,γ,w] Sincfunction[a,t,w],w,Assumptions->t>0&&γ>0&&a∈Reals];//Timing
Integrate[Lorentz[0,γ,w] Sincfunction[0,t,w],w,Assumptions->t>0&&γ>0];//Timing
Out[4]= {0.691755,Null}
Out[5]= {0.128017,Null}

Thus, most of the time is spent to establish that antiderivatives are continuous functions and taking the limits according to the fundamental theorem of calculus.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.