# InverseLaplaceTransform producing unexpected imaginary terms

The following code computes inverse Laplace Transform (trueLaplace) manually and using Mathematica (observedLaplace) of expression (expr). Mathematica version has an extra imaginary term, making it numerically different from the one I computed manually.

Is this a bug? How do I restrict Mathematica to real-valued domain in this case?

IE, I expected $$\mathcal{L}^{-1}\left(\frac{\tan ^{-1}\left(\frac{\sqrt{2}}{\sqrt{s}}\right)}{\sqrt{2} \sqrt{s}}\right)=\frac{\sqrt{\frac{\pi }{2}} \text{erf}\left(\sqrt{2} \sqrt{t}\right)}{2 \sqrt{t}}$$ but got

$$\mathcal{L}^{-1}\left(\frac{\tan ^{-1}\left(\frac{\sqrt{2}}{\sqrt{s}}\right)}{\sqrt{2} \sqrt{s}}\right)=-\frac{\sqrt{\frac{\pi }{2}} \text{erf}\left(\sqrt{2} \sqrt{t}\right)}{2 \sqrt{t}}-i \sqrt{\frac{2}{\pi }} \sqrt{t} \, _2F_2\left(1,1;\frac{3}{2},2;-2 t\right)$$

expr = ArcTan[Sqrt/Sqrt[s]]/(Sqrt Sqrt[s]);
trueLaplace = (Sqrt[\[Pi]/2] Erf[Sqrt Sqrt[t]])/(2 Sqrt[t])
observedLaplace = InverseLaplaceTransform[expr, s, t]
Print["Expected mismatch: ",
LaplaceTransform[trueLaplace, t, s] - expr /. s -> 2.]
Print["Observed mismatch: ",
LaplaceTransform[observedLaplace, t, s] - expr /. s -> 2.]


• Apart[observedLaplace] shows the difference between the two more clearly.
– JimB
May 17 at 16:38
• Workaround: Integrate[ InverseLaplaceTransform[ D[ArcTan[a Sqrt/Sqrt[s]]/(Sqrt Sqrt[s]), a], s, t], {a, 0, 1}] :) May 18 at 14:04
• @MariuszIwaniuk haha, that trick works so well, I wonder if it makes sense to have it as a ResourceFunction May 18 at 16:46
• @YaroslavBulatov It,s only a Feynman's Trick: zackyzz.github.io/feynman.html May 18 at 17:49

If you square both expressions and replace 2 t -> 4 t^2 and do
        Series[expr,{s,0,7}]

you see that there is a factor Sqrt[1 + I] between.
Physicists now, that there exist denumerable conventions for LaplaceTransforms. Since its use is in DSolve of linear equations demanding linear combinations of solutions, the factor is without significance. The determination of the coeffients is always the last step to fit the boundary or start conditions.