1

I need to compute the Fourier Transform of a streched exponential (according to Wikipedia "it must be calculated either by numeric integration, or from a series expansion"; so I go for the first option) for various parameters. The standard way I would do this is

    listb = Range[1.5, 2., 0.5];
    f[om_?NumericQ, b_?NumericQ] := 
     NIntegrate[Exp[-t^b]*Exp[-I om t], {t, 0, Infinity},AccuracyGoal -> Infinity, 
  PrecisionGoal -> 2]
    fFT = Map[ParallelTable[{om, f[om, #]}, {om, -10., 10., .01}] &, 
       listb];

Is there a more efficient way?

Thanks in advance for any help.

[Edit]

Compiling the target functions (as suggested here) is more than twice as fast as the original try

listb = Range[1.5, 2., 0.5];
cf = Compile[{{t, _Real}, {b, _Real}, {om, _Real}}, 
   Exp[-t^b]*Exp[-I om t], CompilationTarget -> "C", 
   "RuntimeOptions" -> {"Speed", "EvaluateSymbolically" -> False}];
f2[om_?NumericQ, b_?NumericQ] := 
 NIntegrate[cf[t, b, om], {t, 0, Infinity}, AccuracyGoal -> Infinity, 
  PrecisionGoal -> 2]
fFT = Map[ParallelTable[{om, f2[om, #]}, {om, -10., 10., .01}] &, 
   listb];

Note also the similarity to this question here where in my case compiling the target function seems to be beneficial with respect to speed.

[Edit2]

By disabling the symbolic processing (which doesn't make sense in the case of a compiled function anyways) one gets another speed increase by a factor of more than three.

listb = Range[1.5, 2., 0.5];
cf = Compile[{{t, _Real}, {b, _Real}, {om, _Real}}, 
   Exp[-t^b]*Exp[-I om t], CompilationTarget -> "C", 
   "RuntimeOptions" -> {"Speed", "EvaluateSymbolically" -> False}];
f2[om_?NumericQ, b_?NumericQ] := 
 NIntegrate[cf[t, b, om], {t, 0, Infinity}, AccuracyGoal -> Infinity, 
  PrecisionGoal -> 2, 
 Method -> {Automatic, "SymbolicProcessing" -> 0}]
fFT1 = Map[ParallelTable[{om, f2[om, #]}, {om, -10., 10., .01}] &, 
   listb];

If somebody has additional ideas please let me know. But at least this is now almost one magnitude faster than my original attempt.

NeverMind
  • 1,201
  • 7
  • 9

0 Answers0