InverseFourierTransform of simple function takes forever
This is not an answer to why InverseFourierTransform
is so slow in this case, but it may provide some useful insights.
The argument 1/(w^2 - I w*b + c)
is equal to
I/(Sqrt[b^2 + 4 c] (w - I (b - Sqrt[b^2 + 4 c])/2))
- I/(Sqrt[b^2 + 4 c] (w - I (b + Sqrt[b^2 + 4 c])/2))
as can be seen by applying Simplify
. Yet, I had to determine this latter expression by hand, because Apart
did not transform the first expression into the second, even when I provided it with the denominator factored! On the other hand, it performed
Apart[1/(w^2 - I w*3 + 4)]
(* (I/5)/(I + w) - (I/5)/(-4*I + w) *)
without difficulty. So, if InverseFourierTransform
uses Apart
, and it might well, then it is understandable that it cannot handle the symbolic expression while it can handle the numerical one. In any case, with the argument transformed as above,
InverseFourierTransform[
I/(Sqrt[b^2 + 4 c] (w - I (b - Sqrt[b^2 + 4 c])/2)) -
I/(Sqrt[b^2 + 4 c] (w - I (b + Sqrt[b^2 + 4 c])/2)), w, t,
FourierParameters -> {1, -1}, Assumptions -> {b > 0, c > 0}]
(* (E^(Sqrt[b^2 + 4*c]*t)*HeavisideTheta[-t] +
HeavisideTheta[t])/(Sqrt[b^2 + 4*c]*E^(((b + Sqrt[b^2 + 4*c])*t)/2)) *)
produces an answer without difficulty.
Addendum
Suppose we choose a slightly simpler argument, 1/(b^2 - (c + I w)^2)
, which Apart
can handle.
Apart[1/(b^2 - (c + I w)^2)]
(* (-I/2)/(b*((-I)*b - I*c + w)) + (I/2)/(b*(I*b - I*c + w)) *)
Then InverseFourierTransform
also works.
InverseFourierTransform[1/(b^2 - (c + I w)^2), w, t,
FourierParameters -> {1, -1}, Assumptions -> {b > 0, c > 0}]
(* (2*HeavisideTheta[t] + E^(2*b*t)*(2*HeavisideTheta[-(t*Sign[b - c])]*Sign[b - c]
+ Sign[t]*(-1 + Sign[Abs[b - c]])))/(4*b*E^((b + c)*t)) *)
strengthening the supposition of a connection between Apart
and InverseFourierTransform
.
I found another work-around. Use Integrate
to calculate the inverse Fourier transform directly, with the exclusion of t == 0
:
int = Integrate[Exp[I w t]/(w^2 - I w b + c), {w, -∞, ∞},
Assumptions -> {b > 0, c > 0, #}]/(2 π) &;
(lhalf = int[t < 0]) // AbsoluteTiming
(rhalf = int[t > 0]) // AbsoluteTiming
{5.091000, E^(1/2 (-b + Sqrt[b^2 + 4 c]) t)/Sqrt[b^2 + 4 c]} {5.958000, E^(-(1/2) (b + Sqrt[b^2 + 4 c]) t)/Sqrt[b^2 + 4 c]}
Verification:
FourierTransform[Piecewise[{{lhalf, t < 0}, {rhalf, t >= 0}}], t, w,
FourierParameters -> {1, -1}]
1/(c + w (-I b + w))
Well, actually Integrate
isn't necessary, InverseFourierTransform
can also be used, but much slower:
ift = InverseFourierTransform[1/(w^2 - I w b + c), w, t,
FourierParameters -> {1, -1}, Assumptions -> {b > 0, c > 0, #}] &;
ift[t < 0] // AbsoluteTiming
ift[t > 0] // AbsoluteTiming
{153.917000, E^(1/2 (-b + Sqrt[b^2 + 4 c]) t)/Sqrt[b^2 + 4 c]} {295.518000, E^(-(1/2) (b + Sqrt[b^2 + 4 c]) t)/Sqrt[b^2 + 4 c]}
BTW, during the exploration, I noticed another bug of Integrate
, at least in v9:
(* Can anyone help to test this in v10 ? *)
int[t != 0] // AbsoluteTiming
{14.306000, ConditionalExpression[E^(1/2 (-b + Sqrt[b^2 + 4 c]) t)/Sqrt[b^2 + 4 c], Re[t] < 0 && Im[t] == 0]}