# Wrong result of Laplace Transformation [closed]

I am trying to calculate the Laplace Transformation of the following function: $$f(x) = \theta(t+1)-\theta(t-1)$$

where $$\theta(t)$$ is the Heaviside step function defined as: $${\displaystyle \theta(x):={\begin{cases}1,&x>0\\0,&x\leq 0\end{cases}}}$$

My code to calculate this is:

f2[t_] :=  Piecewise[{{1, t < 1 && t > -1}},0]
Plot[f2[x],{x, -2, 2},Evaluated -> True]
lapl[s_] := LaplaceTransform[f2[t], t, s]
lapl[s]


But the output I get from Mathematica is $$\frac{1-cosh(s)+sinh(s)}{s}$$ When running the following transformation integral in wolfram alpha $$\int_{-\infty}^{\infty}(\theta(t+1)-\theta(t-1))*e^{-st}dt$$ the result I get is: $$\frac{2sinh(s)}{s}$$ for $$\Re(s)>0$$ which seems to be correct.

My question is: Why are the results different? I am using Wolfram Engine Version 13.1 in Wolfram Cloud Version 1.64.

Your integral is wrong. Laplace transform is defined from $$0$$ to $$\infty$$ not from $$-\infty$$ to $$\infty$$. The 2-sided Laplace transform is defined from $$-\infty$$ to $$\infty$$ but that is not the Mathematica command uses.

Mathematica result matches the integral directly:

f2[t_] := Piecewise[{{1, t < 1 && t > -1}}, 0]
LaplaceTransform[f2[t], t, s]



Integrate[f2[t]*Exp[-s*t], {t, 0, Infinity}];
ExpToTrig[%] // FullSimplify


• I see I was not aware that the bilateral laplace transform was another function, thanks. Nov 29, 2022 at 3:57