# NIntegrate::inumr error, but only for some values.

GROUPS:
 Hello,I am having trouble getting a double integral to work. It is a function of k, and works well for one value of k (k=2)that I can find. Any other value, and the function spits out this error message:NIntegrate::inumr: The integrand Re[\!$$\*SubsuperscriptBox[\(\$$, $$-1.13$$, $$50$$]$$\(0.000035237548017848564\ \*SuperscriptBox[\(E$$, $$\(-t$$\ $$(\(\(0.02$$\) + Times[<<2>>])\) - 0.039241305112179804\ Re + 0.039241305112179804\ \*SuperscriptBox[$$2$$, $$Times[<<2>>]$$]\ Re\)]\ Re[\*SuperscriptBox[$$E$$, $$\(-0.2092315267335341$$\ \*SuperscriptBox[$$Abs[<<1>>]$$, $$2.01`$$]\)]]\) \T\)\)] has evaluated to non-numerical values for all sampling points in the region with boundaries {{0,500}}. >>Here is the function:ginfinity[\_] := Re[NIntegrate[minfinity[\, t], {t, 0, 500}]]whereminfinity[\_, t_] := Re[Integrate[ E^(\[T, t] - ((\[T, t]) (t)) - \[T, t] (1/2)^(t/ H)) (zta[\, T]) .000136, {T, thetat, 50}]]If anybody has any idea of what could be going wrong, I would greatly appreciate it!Thank you,Katherine
Answer
5 years ago
1 Reply
 There seems to be some issues with the code you have posted. Please try putting it in a Mathematica code section. To do this, paste the code into the editor, highlight it, and then click the Mathematica red spiky logo in the editor. The error message you are seeing means that the integrand for the NIntegrate statement has a variable in it. If you would like to nest numeric functions like this, please consider using ?NumericQ as shown in this tutorial: http://support.wolfram.com/kb/3820. Additionally, if you are doing a double integral, NIntegrate is capable of handling those as well. For example:(*A double integral*) NIntegrate[Sin[x y], {x, 0, 10}, {y, 0, 1}]Note that if we want to use functions like you did, the following will usually not work and at least give warning messages for the reasons mentioned in the tutorial:myFunction [y_] := NIntegrate[Sin[x y], {x, 0, 10}]NIntegrate[myFunction[y], {y, 0, 1}] Use ?NumericQ  to delay the evaluation of myFunction until y is given a numeric value:Clear[myFunction];myFunction [y_?NumericQ] := NIntegrate[Sin[x y], {x, 0, 10}]NIntegrate[myFunction[y], {y, 0, 1}]
Answer
5 years ago