# 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[2]/Sqrt[s]]/(Sqrt[2] Sqrt[s]);
trueLaplace = (Sqrt[\[Pi]/2] Erf[Sqrt[2] 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, 2023 at 16:38
• Workaround: Integrate[ InverseLaplaceTransform[ D[ArcTan[a Sqrt[2]/Sqrt[s]]/(Sqrt[2] Sqrt[s]), a], s, t], {a, 0, 1}] :) May 18, 2023 at 14:04
• @MariuszIwaniuk haha, that trick works so well, I wonder if it makes sense to have it as a ResourceFunction May 18, 2023 at 16:46
• @YaroslavBulatov It,s only a Feynman's Trick: zackyzz.github.io/feynman.html May 18, 2023 at 17:49
• InverseLaplaceTransform[ArcTan[Sqrt[2]/Sqrt[s]]/(Sqrt[2] Sqrt[s]), s, t] == InverseLaplaceTransform[ 1/8 Inactive[ FoxH][{{{1, 1/2}, {3/2, 1/2}}, {}}, {{{1, 1/2}}, {{1/2, 1/2}}}, Sqrt[2] Sqrt[1/s]], s, t] == Inactive[ FoxH][{{{1, 1/2}, {3/2, 1/2}}, {}}, {{{1, 1/2}}, {{1/2, 1/2}, {1, 1/2}}}, Sqrt[2] Sqrt[t]]/( 8 t) == (Sqrt[\[Pi]/2] Erf[Sqrt[2] Sqrt[t]])/(2 Sqrt[t])  Jul 20, 2023 at 20:19

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.