# Wolfram Alpha and Wolfram Engine produce different Laplace transforms

Consider the following Laplace transform:

$$\mathcal{L}\{\dfrac{\sin{2x}}{x}\}$$

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?

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.

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


0

• This relation can be analytically extended from the positive ray to certain domains in the complex plane. Jan 5 at 18:16
• 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$? Jan 5 at 20:00
• @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. Jan 6 at 6:58
• 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? Jan 6 at 20:07
• @MehrshadKhansarian: Don't know it. Integrate[Sin[2 x]/x*Exp[-p*x], {x, 0, Infinity}, Assumptions -> p > 0] results in ArcTan[2/p]. Jan 7 at 14:06
\$Version

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

Clear["Global*"]

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"}] //
ReleaseHold

(* 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 *)

• 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. Jan 6 at 6:48
• @user64494 - corrected. Thanks. 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$$.