# NIntegrate & non-numerical values

I am wondering why I am receiving the message "The integrand ... has evaluated to non-numerical values for all sampling points in the region ..." for a particular calculation I am running. How can I change my code so that this is not an issue? A simple example is copied below.

a = 1/20; b = 1/5;
FF[y_] := Exp[I a y - 1/2 b^2 y^2];
f[x_] := NIntegrate[E^(-I x y) FF[y], {y, 0.0, 100}];
NIntegrate[f[x], {x, -100, 100}]


Thanks...

a = 1/20; b = 1/5;
FF[y_?NumericQ] := Exp[I a y - 1/2 b^2 y^2];
f[x_?NumericQ] := NIntegrate[E^(-I x y) FF[y], {y, 0.0, 100}];
NIntegrate[f[x], {x, -100, 100}]


converges slowly ... to Pi

• That did the trick. I just noticed that FF[y_Real] and f[x_Real] also solves the issue. Shame it slows the code down though... – Freakalien Oct 24 '13 at 2:49
• Would you know where I can find some general information on when such conditions on function parameters should be used? – Freakalien Oct 24 '13 at 2:57
• @Freakalien Take a look at the first two questions here meta.mathematica.stackexchange.com/questions?sort=votes – Dr. belisarius Jul 7 '14 at 12:17