6
$\begingroup$

How can I calculate the Bromwich Integral in Mathematica? If I enter this as code it gives me just the same:

$$\frac{1}{2\pi i}\int_{\alpha-\infty i}^{\alpha+\infty i} \left(e^{st}\cdot F_{(s)}\right) \text{d}s$$

As example:

I want to calculate the inverse laplace transform of $\frac{c}{s}$:

$$\frac{1}{2\pi i}\int_{\alpha-\infty i}^{\alpha+\infty i} \left(e^{st}\cdot \frac{c}{s}\right) \text{d}s$$

Than it gives me the same back, maybe I've to set some conditions to my code?

My code:

Integrate[Exp[s*t]*(c/s), {s, a - Infinity*I, a + Infinity*I}]/(2*Pi*I)

The Bromwich Integral: http://mathworld.wolfram.com/BromwichIntegral.html

$\endgroup$
3
  • 1
    $\begingroup$ InverseLaplaceTransform[c/s, s, t]? $\endgroup$
    – march
    Commented Sep 11, 2015 at 16:32
  • $\begingroup$ That function don't give the conditions when the integral is equal to the answer, so I would like to calculate the integral, than it gives me a conditionalexpression $\endgroup$ Commented Sep 11, 2015 at 16:33
  • 2
    $\begingroup$ If you post the actual code it might be easier (i) to see if there is a mistake in it and (ii) for others to try it out, maybe try variations. $\endgroup$ Commented Sep 11, 2015 at 16:35

2 Answers 2

8
$\begingroup$

I think one possible issue is that e.g. a+Infinity*I becomes just DirectedInfinity[I] because the "finite" part gets swallowed. You can rewrite in such a way that this does not happen.

Integrate[
 Exp[(s*I + a)*t]*(1/(s*I + a)), {s, - Infinity, Infinity}, 
 Assumptions -> Element[{a, t}, Reals]]

(* Out[246]= ConditionalExpression[
 E^(a t) (\[Pi] (Cosh[a Abs[t]] Sign[t] - Sinh[a Abs[t]]) + 
    I CosIntegral[-I a Abs[t]] (Cosh[a Abs[t]] - 
       Sign[t] Sinh[a Abs[t]]) + 
    I CosIntegral[
      I a Abs[t]] (-Cosh[a Abs[t]] + Sign[t] Sinh[a Abs[t]])), a != 0] *)
$\endgroup$
5
  • $\begingroup$ Much better than mine! With the Assumptions that a > 0 and t >= 0, this returns exactly 2*Pi. Doing the same thing for the second example in my answer also returns exactly the correct answer. +1 $\endgroup$
    – march
    Commented Sep 11, 2015 at 19:20
  • $\begingroup$ But it gives not what I expected, because the laplace inverse of $\frac{c}{s}$ is equal to $c$, and I whout like to find the conditions when it becomes $c$ $\endgroup$ Commented Sep 11, 2015 at 19:27
  • $\begingroup$ @JanEerland. Okay, conditions on c? You can put c back into the expression that he is integrating, and it will spit out no extra condition because c can be anything in your simple case. More generally, if you use this method, and if MMA can do the integral, then it will spit out conditions on whatever constants are in your integrand. You should still specify conditions on a and t in your integral, however, because that is necessary for the definition of the inverse Laplace transform. $\endgroup$
    – march
    Commented Sep 11, 2015 at 20:03
  • $\begingroup$ @march I actually liked your result more. I just wanted to post something that did not require limits or related. $\endgroup$ Commented Sep 11, 2015 at 21:42
  • $\begingroup$ I'm not sure either solution will end up being very robust. I'm still convinced that InverseLaplaceTransform is best, since it will have the giant look-up table of Laplace-transform pairs, and the OP can look up somewhere what the conditions on the functions are. (I'm still not entirely sure what the OP wants, anyway.) Nonetheless, I found your solution to be clever. $\endgroup$
    – march
    Commented Sep 11, 2015 at 21:45
7
$\begingroup$

This is decidedly not a general answer, but let's play a bit. If we do

expr = Integrate[Exp[s t] c/s
  , {s, a - b I, a + b I}
  , Assumptions -> {a > 0, b > a, c ∈ Reals, t ∈ Reals}]/(2*π*I)

this yields

ConditionalExpression[
 -((I c (-ExpIntegralEi[(a - I b) t] + ExpIntegralEi[(a + I b) t]))/(2 π))
 , t >= 0]

We of course need to choose a > 0 because the vertical contour that we integrate along needs to be to the right of any poles in the function we are integrating. In this case, there is a pole at 0. I am using b > a > 0 because I find it doubtful that Mathematica knows how to integrate the thing along the entire vertical contour: in fact, if you try it, Mathematica says that the integral does not converge (which is not surprising! - we are in some sense trying to compute a principle value integral). Finally, of course t needs to be non-negative. We knew this already from the definitions of the Laplace transform and inverse Laplace transform.

In any case, we can now set a to anything positive we want, so let's consider the following:

Limit[expr /. {a -> 1, t -> #}] & /@ {1, 5, 0.4, 100}
(* {c, c, 1. c, c} *)

which of course suggests that the expression is equal to c.

In general, if the integral of your function f[s] can actually be evaluated, then I would do

Integrate[Exp[s t] f[s]
  , {s, a - b I, a + b I}
  , Assumptions -> {a > 0, b > a, t >= 0}]/(2*π*I)

and play around with the results. I do not think this will work very often, however. In addition, if it does spit back a solution, the functions that it yields are likely to have branch cuts that you have to worry about. I think that symbolic complex integration with computers is hard.


If you try

Integrate[1/(2 \[Pi] I) Exp[s t] 1/(1 + s^2), {s, a - b I, a + b I}, Assumptions -> {a > 0, b > a, t >= 0}]

you get back something with Gamma functions and Log functions evaluated at imaginary inputs. If you let a -> 2 and try taking the Limit as b -> Infinity with integer of t, eventually you get an expression that will ExpToTrig to Sin[t] while spitting out errors that you might need to be concerned about. (Nonetheless, that's the right answer).

$\endgroup$

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.