# Nested NIntegrate with a function in between

I'm trying to do an nested NIntegrate in which there's a function in between; for example:

f[z_?NumericQ] := NIntegrate[Exp[-x^2/2] Cos[x^2 z/10], {x, -Infinity, Infinity}]
NIntegrate[Log[f[z]],{z,0,10}]


Unfortunately, when I try to do this, I get the typical error:

NIntegrate::inumr: The integrand E^(-(x^2/2)) Cos[(x^2 z)/10] has evaluated to non-numerical values for all sampling points in the region with boundaries {{[Infinity],0.}}.

I thought adding NumericQ would make this go away, but it didn't work. Any tips on how to work around this? Apologies if this has been asked before; I wasn't sure how to properly word the question.

• Works for me without any error message. Mathematica 10 on OSX 10.11.5. Try seeing if typing f[3] gives a numerical answer. – Erich Mueller Apr 5 '17 at 23:39
• probably you defined f without the ?NumericQ, then redefined it with ?NumericQ but didn't Clear the original def. Either do Clear[f] or restart the kernel – george2079 Apr 6 '17 at 2:30
• I also have such a message, if using it without ?NumericQ (Mma 11.1, Win7). That's strange I remember to have done such things without such messages in one of the previous versions. Can anybody explain this? – Alexei Boulbitch Apr 6 '17 at 6:46