Consider the following Laplace transform:


To calculate it, I'd write LaplaceTransform[Sin[2 x] / x, x, p] into both Wolfram Alpha and WolframScript (for the command-line). WolframScript returns ArcTan[2 / p], whereas Wolfram Alpha gives (Pi - 2 ArcTan[p / 2]) / 2. Although the two results appear different, plotting the functions shows they are actually equal for $p \gt 0$.

Performing the calculations by hand, I can arrive at the second answer.

How can I get WolframScript (or Wolfram Cloud) to produce the result of Wolfram Alpha?
I'm asking this because:

  1. That's what I reached by hand.
  2. That's what we usually want, since the result of a Laplace transform is expected to be valid for $p > 0$, not negative values.

3 Answers 3

FullSimplify[ArcTan[2/p] - (Pi - 2 ArcTan[p/2])/2,  Assumptions -> p > 0]


  • $\begingroup$ This relation can be analytically extended from the positive ray to certain domains in the complex plane. $\endgroup$
    – user64494
    Jan 5 at 18:16
  • 2
    $\begingroup$ This result was already included in the question: "plotting the functions shows they are actually equal for p>0". What about the case of $p\leq 0$? $\endgroup$
    – MarcoB
    Jan 5 at 20:00
  • $\begingroup$ @MarkoB: First, a plot is a plausible reasoning, not a proof. Second, the case of p<0 is of needless for InverseFourierTransform (see the documentation). Third, up to Maple FunctionAdvisor(branch_cuts, arctan(2/p)-(Pi-2*arctan((1/2)*p))*(1/2), plot = 2.), there are branch cuts along the imaginary axis except the origin. $\endgroup$
    – user64494
    Jan 6 at 6:58
  • $\begingroup$ How can I get WolframScript to produce (Pi - 2 ArcTan[p / 2]) / 2? Isn't this the viable answer we are looking for, as $p$ is almost always assumed to be at least positive in a Laplace transform? $\endgroup$ Jan 6 at 20:07
  • $\begingroup$ @MehrshadKhansarian: Don't know it. Integrate[Sin[2 x]/x*Exp[-p*x], {x, 0, Infinity}, Assumptions -> p > 0] results in ArcTan[2/p]. $\endgroup$
    – user64494
    Jan 7 at 14:06

(* "13.3.1 for Mac OS X ARM (64-bit) (July 24, 2023)" *)


f[x_] := Sin[2 x]/x

lt = LaplaceTransform[f[x], x, p]

(* ArcTan[2/p] *)

Taking the inverse,

f[x] == InverseLaplaceTransform[lt, p, x]

(* True *)

Whereas using WolframAlpha

lt2 = WolframAlpha[
   "LaplaceTransform[Sin[2 x]/x, x, p]", {{"Result", 1}, "ComputableData"}] //

(* 1/2 (π - 2 ArcTan[p/2]) *)

Again taking the inverse,

ilt = InverseLaplaceTransform[lt2, p, x]

(* 1/2 (π DiracDelta[x] - 2 (1/2 π DiracDelta[x] - Sin[2 x]/x)) *)

EDIT: As pointed out by user64494 in a comment, Expand simplifies the inverse

f[x] == ilt // Expand

(* True *)
  • 1
    $\begingroup$ Expand[1/ 2 (\[Pi] DiracDelta[x] - 2 (1/2 \[Pi] DiracDelta[x] - Sin[2 x]/x))] results in Sin[2 x]/x. In view of it your claim "To get the original function the DiracDelta must be eliminated" seems very strange. $\endgroup$
    – user64494
    Jan 6 at 6:48
  • $\begingroup$ @user64494 - corrected. Thanks. $\endgroup$
    – Bob Hanlon
    Jan 6 at 7:59

I, myself, could reach an explanation as to why Wolfram Engine has given such a result, thanks to the answer posted by @user64494.

Consider the following identity: $$\cot^{-1}{x} = \dfrac{\pi}{2} - tan^{-1}{x}$$

Using the above, $\dfrac{\pi}{2} - tan^{-1}{\dfrac{p}{2}}$, the answer given by Wolfram Alpha and calculated by hand, can be written as $\cot^{-1}{\dfrac{p}{2}}$, which is in turn equal to $\tan^{-1}{\dfrac{2}{p}}$, whenever $p \gt 0$.

  • 1
    $\begingroup$ Your answer duplicates one already given. $\endgroup$
    – bbgodfrey
    Jan 8 at 18:35

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.