Repository: sympy/sympy

Issue:
Inverse Laplace and Mellin transform `as_integral` missing 2*pi*I
The usual definition of Inverse Laplace Transform and Inverse Mellin Transform has division by `2*pi*I`.  Our docs are missing this.  And `.rewrite(Integral)` or `_as_integral` are missing it too.

IIRC, there are other possible choices about where to put these `pi` factors; we need to ensure the docs and `as_integral` match what our concrete transforms actual do.

Discussion:

Patch:
diff --git a/sympy/integrals/meijerint.py b/sympy/integrals/meijerint.py
index fc86f99199..f90e037636 100644
--- a/sympy/integrals/meijerint.py
+++ b/sympy/integrals/meijerint.py
@@ -2047,7 +2047,6 @@ def meijerint_inversion(f, x, t):
     t_ = t
     t = Dummy('t', polar=True)  # We don't want sqrt(t**2) = abs(t) etc
     f = f.subs(t_, t)
-    c = Dummy('c')
     _debug('Laplace-inverting', f)
     if not _is_analytic(f, x):
         _debug('But expression is not analytic.')
@@ -2114,5 +2113,6 @@ def meijerint_inversion(f, x, t):
             res = res.subs(t, t + shift)
             if not isinstance(cond, bool):
                 cond = cond.subs(t, t + shift)
+            from sympy import InverseLaplaceTransform
             return Piecewise((res.subs(t, t_), cond),
-                             (Integral(f_*exp(x*t), (x, c - oo*I, c + oo*I)).subs(t, t_), True))
+                             (InverseLaplaceTransform(f_.subs(t, t_), x, t_, None), True))


Test patch:
diff --git a/sympy/integrals/tests/test_meijerint.py b/sympy/integrals/tests/test_meijerint.py
index a8363df658..ebbc9009d4 100644
--- a/sympy/integrals/tests/test_meijerint.py
+++ b/sympy/integrals/tests/test_meijerint.py
@@ -286,6 +286,26 @@ def inv(f):
     assert meijerint_inversion(exp(-s**2), s, t) is None
 
 
+def test_inversion_conditional_output():
+    from sympy import Symbol, InverseLaplaceTransform
+
+    a = Symbol('a', positive=True)
+    F = sqrt(pi/a)*exp(-2*sqrt(a)*sqrt(s))
+    f = meijerint_inversion(F, s, t)
+    assert not f.is_Piecewise
+
+    b = Symbol('b', real=True)
+    F = F.subs(a, b)
+    f2 = meijerint_inversion(F, s, t)
+    assert f2.is_Piecewise
+    # first piece is same as f
+    assert f2.args[0][0] == f.subs(a, b)
+    # last piece is an unevaluated transform
+    assert f2.args[-1][1]
+    ILT = InverseLaplaceTransform(F, s, t, None)
+    assert f2.args[-1][0] == ILT or f2.args[-1][0] == ILT.as_integral
+
+
 @slow
 def test_lookup_table():
     from random import uniform, randrange