17
$\begingroup$

In the documentation, it states that

The Laplace transform of a function $f(t)$ is defined to be $\int_0^{\infty } f(t) e^{-s t} \, \mathrm{d}t$.

But why can Mathematica not get the Laplace transform of $\frac{1-\cos (t)}{t}$?

$Assumptions=s>0;

LaplaceTransform[(1-Cos[t])/t,t,s]
(* EulerGamma+LaplaceTransform[1/t,t,s]+1/2 Log[1+s^2] *)

and the integral does converge

Integrate[(1-Cos[t])/t Exp[-s t],{t,0,∞}]
(* 1/2 Log[1+1/s^2] *)

?

$\endgroup$
4
  • $\begingroup$ Laplace transform is not defined for 1/t and that is why it did not do it. May be it used a lookup table and found that. But I do not know why it worked when doing direct integration when the cos term is there. $\endgroup$
    – Nasser
    Commented Nov 20, 2013 at 22:31
  • $\begingroup$ also when you do integration seperately you receive divergence message $\endgroup$
    – sky-light
    Commented Nov 20, 2013 at 23:26
  • $\begingroup$ Another possibility you can try: 2 LaplaceTransform[Haversine[t]/t,t,s] $\endgroup$ Commented May 19, 2015 at 5:46
  • 2
    $\begingroup$ In Version 12, LaplaceTransform returns the desired result. $\endgroup$
    – mikado
    Commented Nov 16, 2019 at 17:50

5 Answers 5

27
$\begingroup$

You can use a trick to prevent Mathematica from taking your expression apart:

LaplaceTransform[Abs[1 - Cos[t]]/t, t, s]
(* 1/2 Log[1 + 1/s^2] *)
$\endgroup$
3
  • 1
    $\begingroup$ Usually, Abs is the last thing you want to have in your expression. With most vector norm calculations, you have to take care of it manually. Very interesting that it works here. How did you find out about it, because putting it around the whole expression doesn't work. Was it luck? ..and of course +1! $\endgroup$
    – halirutan
    Commented Nov 21, 2013 at 10:39
  • $\begingroup$ @halirutan It's not the last: f = {Abs, FractionalPart, Ceiling, Floor, Round, PrimePi}; GraphicsGrid[ Partition[ Plot[{#[u], D[#[x], x] /. x -> u}, {u, -1, 3}, PlotLabel -> Style[Framed[Hyperlink[#, "paclet:ref/" <> #] &@ToString@#], 16, Blue, Background -> Lighter[Yellow]]] & /@ f, 2], Frame -> All] $\endgroup$ Commented Nov 21, 2013 at 12:52
  • $\begingroup$ @halirutan When I realized that Mathematica tries to transform each summand separately, it was the first idea that came to my mind about how to make the expression not to be a trivially subdivisible into its summands. Of course, it can be seen that Abs is not significant in this context, but I thought that Mathematica would not try to prove it. $\endgroup$ Commented Nov 21, 2013 at 15:33
11
$\begingroup$

When Mathematica tries to pull the fraction apart, it gets

$$\mathcal{L}_t\left[\frac{1-\cos(t)}{t}\right](s)=\mathcal{L}_t\left[\frac{1}{t}\right](s) - \mathcal{L}_t\left[\frac{\cos(t)}{t}\right](s)$$

While the cosine term has a Laplace-transform, $1/t$ doesn't have a transform. That might be the reason why Mathematica cannot solve it. The problem is, that the $1/t$ term has a singularity at 0:

Limit[1/t, t -> 0, Direction -> -1]

(* ∞ *)

while the complete expression doesn't

Limit[(1 - Cos[t])/t, t -> 0, Direction -> -1]

(* 0 *)

On the other hand, calculating the back-transform works:

InverseLaplaceTransform[1/2 Log[1 + 1/s^2], s, t] // FullSimplify

(* (1 - Cos[t])/t *)

What you can do is the following. You expand your formula into a series

Series[(1 - Cos[t])/t, {t, 0, 10}] // Normal

(* t/2 - t^3/24 + t^5/720 - t^7/40320 + t^9/3628800 *)

then you use LaplaceTransform

LaplaceTransform[%, t, s]

(* 1/(10 s^10) - 1/(8 s^8) + 1/(6 s^6) - 1/(4 s^4) + 1/(2 s^2) *)

we see that this sum is pretty easy, so we write it down and let Mathematica calculate the value:

Sum[(-1)^(i/2 + 1)/(i*s^i), {i, 2, Infinity, 2}]

(* 1/2 Log[(1 + s^2)/s^2] *)
$\endgroup$
2
  • 1
    $\begingroup$ Yes, 1/t does not have a Laplace transform, but (1-Cos[t])/t has, since the integral does exist, right? $\endgroup$ Commented Nov 20, 2013 at 22:53
  • 1
    $\begingroup$ the sign between two transforms is minus. $\endgroup$
    – sky-light
    Commented Nov 20, 2013 at 23:14
9
$\begingroup$

Ok, I think I know why the integral worked, but not the Laplace transform.

When using the integral, there is a pole at t=0 but this is a removable singularity.

Series[1 - Cos[t], {t, 0, 6}] // Normal

Mathematica graphics

Now dividing by t

(#/t) & /@ r

Mathematica graphics

So, the t in the denominator is gone. I do not know how Mathematica actually removed this pole at t=0 in the code, but it did it when calling Integrate. It might be because it is at start of the interval? or it have done something more advanced than the above, I do not know.

But when doing the Laplace transform, Mathematica must have first tried table lookup for each term. It must saw the 1/t term there. Using the lookup table, the Laplace transform for $t^n$ for negative $n$ is Gamma[n+1]/(s^(n+1)) reference and for $n=-1$ this gives Gamma[0] which is not defined. Hence LaplaceTransform gave up.

Basically what seems to have happened, is that LaplaceTransform does lookup first (for speed). It does not call Integrate to do the integration right away unless needed (else why have LaplaceTransform function in first place, no need to be calling a function which will just call integrate right away).

$\endgroup$
1
  • 1
    $\begingroup$ We cannot be sure what happens, but this seems one of the most plausible explanations. +1 from me. $\endgroup$
    – halirutan
    Commented Nov 20, 2013 at 23:35
8
$\begingroup$

If you don't want to resort to tricks, you can differentiate the transform over s first, which would bring -t downstairs and cancel 1/t. You can then take the transform for:

LaplaceTransform[(1 - Cos[t]), t, s]

(* 1/s - s/(1 + s^2) *)

and then integrate this over s (with a negative sign, since differentiation produced an extra -1):

-Integrate[1/s - s/(1 + s^2), s]

(* -Log[s] + 1/2 Log[1 + s^2] *)

In principle, this was done up to an additive constant, but you can see that this constant is zero, by inspecting the behavior of the original transform, and also the result, at $s\to\infty$ - both tend to zero in this limit.

$\endgroup$
5
$\begingroup$

Another quick way is to use the following trig identity

In[13]:= TrigFactor[(1-Cos[2x])]
Out[13]= 2 Sin[x]^2

If t==2*x, then we have the integrand becomes:

LaplaceTransform[2 Sin[x]^2/x, x, 2*s]

(* 1/2 Log[1+1/s^2] *)
$\endgroup$
3
  • 1
    $\begingroup$ I think you actually mean p == 2 t and the final line should be LaplaceTransform[2 Sin[t/2]^2/t, t, s], right? $\endgroup$
    – xzczd
    Commented Apr 29, 2015 at 8:53
  • $\begingroup$ Thanks for correcting me, I use x to take the confusion away as xslittlegrass uses t in the original question. $\endgroup$
    – yshk
    Commented May 19, 2015 at 5:14
  • $\begingroup$ Well, are you sure that LaplaceTransform[f[t], t, 2 s] is always equal to LaplaceTransform[f[t/2], t, s]? $\endgroup$
    – xzczd
    Commented May 19, 2015 at 5:36

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.