3

The PrincipalValue option of Convolve is used in this question to define the Hilbert transform. However, in Mathematica 9.0.1, the convolution version gives a wrong answer, while the Fourier transform based version still works.

(* Fourier transform version *)
hilbertTransform = Function[{f,u,t}, 
    Module[{fp = FourierParameters -> {1, -1}, x},
        FullSimplify@InverseFourierTransform[-I (2 HeavisideTheta[x] - 1) 
            FourierTransform[f, u, x, fp], x, t, fp]
    ]
];
hilbertTransform[#, v, w] & /@ {Sin[v], Cos[v], 1/(1 + v^2), Sinc[v], DiracDelta[v]}

(* {-Cos[w],Sin[w],w/(1+w^2),(1-Cos[w])/w,1/(π w)} *)

(* Convolve based version which failed for DiracDelta *)    
hilbertTransform2[f_, u_, t_] := 
    FullSimplify[Convolve[f, 1/u, u, t, PrincipalValue -> True]/π]
hilbertTransform2[#, v, w] & /@ {Sin[v], Cos[v], 1/(1 + v^2), Sinc[v], DiracDelta[v]}

(* {-Cos[w],Sin[w],Log[(-1)^(-(1/(1+w^2))) E^(π/(-I+w))]/π,(1-Cos[w])/w,0} *)

Is this a bug?

Shuchang Zhou
  • 313
  • 1
  • 6
  • Please see the editing help to learn how to format your posts. By indenting code by 4 spaces (or pressing the {} button in the editor), you can highlight them properly. You can view my edit to see how it is done. Secondly, please do not add the [tag:bugs] tag until it has been decided/confirmed by users here that it is indeed a bug. This blanket restriction is because a lot of people incorrectly use the bugs tag when it is the result of a typo or something similar. – rm -rf Jul 25 '13 at 00:16

1 Answers1

6

just different forms:

hilbertTransformV1[f_, u_, t_] :=Module[{fp = FourierParameters -> {1, -1}, x},
   FullSimplify@InverseFourierTransform[-I (2 HeavisideTheta[x] -1) 
      FourierTransform[f, u, x, fp], x, t, fp]];

hilbertTransformV2[f_, u_, t_] := FullSimplify[Convolve[f, 1/u, u, t, 
      PrincipalValue -> True]/Pi]

Looking at the 1/(1 + v^2) test you did, since that shows a difference. But this differece is just a different form of the same expression

v1 = hilbertTransformV1[1/(1 + v^2), v, w]
Out[39]= w/(1 + w^2)

v2 = hilbertTransformV2[1/(1 + v^2), v, w]
Out[40]= Log[E^(Pi/(-I + w))/(-1)^(1/(1 + w^2))]/Pi

Assuming[Element[w, Reals], FullSimplify[ExpToTrig[v2]]]
Out[41]= w/(1 + w^2)

which is the same. Now looking at the last test which showed a difference. DiracDelta handling is always a tricky thing. Changing the PrincipalValue to False produces the same result:

hilbertTransformV2[f_, u_, t_] := 
 FullSimplify[Convolve[f, 1/u, u, t, PrincipalValue -> False]/Pi];

v1 = hilbertTransformV1[DiracDelta[v], v, w]
Out[34]= 1/(Pi*w)

v2 = hilbertTransformV2[DiracDelta[v], v, w]
Out[33]= 1/(Pi*w)

You might ask, why PrincipalValue is set to False for the DiracDelta case? I do not know now without looking more into it. But again DiracDelta always been a special case.

Nasser
  • 143,286
  • 11
  • 154
  • 359