9
$\begingroup$

i'm quite new to Mathematica. I'm trying to do something along the lines of:

InverseFourierTransform[1/(w^2 - I*w*b + c) , w, t, FourierParameters -> {1, -1}, Assumptions -> {b > 0, c > 0}]

But the computation never ends. If I put some numbers (say b=3, c=4) explicitly into the call it works perfectly. Is there something i'm doing wrong?

$\endgroup$
  • 2
    $\begingroup$ I can confirm on version 10.0.2.0. I have never had success with Symbolic Fourier transforms. I would suggest using Laplace transforms. Use s = I w to change to Laplace notation. This works InverseLaplaceTransform[1/(-s^2 - s*b + c), s, t]. $\endgroup$ – Hugh Dec 21 '14 at 18:16
  • $\begingroup$ Back when I was using V7 I noticed this problem when playing around with harmonic oscillators. I've also never had much luck with FourierTransform. Note that as the transfer function of a damped oscillator, the IFT of the expression is a Heaviside theta times a decaying sine wave, namely the impulse response function of the corresponding time domain DEQ (I think?). But hopefully someone else with more wisdom can find a way to get FourierTransform to work here. $\endgroup$ – DumpsterDoofus Dec 21 '14 at 22:42
  • $\begingroup$ @DumpsterDoofus I think you are correct about the Heavside theta but there are many ways of handling the limits of integration for both Laplace and Fourier forward transforms. Am I correct in thinking that if your expression does not contain branch cuts then the InverseLaplace transform with s = I w will give the same answer as an InverseFourier transform with variable w? So is using Laplace transforms always a workaround for these cases? $\endgroup$ – Hugh Dec 21 '14 at 22:57
  • $\begingroup$ @Hugh: My math understanding isn't the greatest, but I'm not sure they'll necessarily give the same results. The damped oscillator equation has transient solutions that are not elements of the Schwartz space that the Fourier transform acts as an automorphism on, and I think they get lost in the inverse FT, ie the FT method "misses" the transients. In contrast, the Laplace transform catches them (or something to that effect). However, I have no idea how that generalizes to other ODE's. In any case, this seems to be another area where Mathematica doesn't seem up to date compared to Maple. $\endgroup$ – DumpsterDoofus Dec 22 '14 at 1:12
  • $\begingroup$ @Hugh Just tried your code. The answer seems to be incorrect. (The correct one is given by bbgodfrey in the answer below.) $\endgroup$ – xzczd Dec 22 '14 at 7:49
9
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ Thanks! It still feels somewhat strange that mathematica fails with such a simple case. Anyway, i'll try to use things on which Apart works from now on =). $\endgroup$ – pnjun Dec 22 '14 at 15:08
3
$\begingroup$

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]}
$\endgroup$
  • 1
    $\begingroup$ I did this as well and it is, of course, the foundation of Fourier transforms to be able to deal with functions that lack continuity. The issue I got stuck on was how to find the point t = 0 automatically. I feel that as this is a computer algebra system there ought to be a method for identifying this requirement for spiting the range of integration. I also looked at the indefinite integral (which also works) but could not make progress with the limits. $\endgroup$ – Hugh Dec 23 '14 at 8:56
  • 1
    $\begingroup$ I can confirm that int[ t != 0] gives the same answer in v10.0.2.0. $\endgroup$ – Hugh Dec 23 '14 at 8:59
  • 1
    $\begingroup$ @Hugh, @xzczd, Interestingly, the run time on my PC is only 7 and 66 sec for t < 0 and t > 0, respectively, using InverseFourierTransform on Mathematica 10.0.2.0. On the other hand, the calculation for t != 0 had not concluded after 10 minutes, when I stopped it. Same for Re[t] != 0, Im[t] == 0. $\endgroup$ – bbgodfrey Dec 23 '14 at 13:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.