Basically I have the same question as here: https://mathematica.stackexchange.com/questions/37146/multiple-nintegrate but since I don't have enough "reputation" I cannot comment there.
I want to solve the following multiple Integral numerically at given Points R, m:
Qb[R_, m_] := 3/m^2 + 8/(Sqrt[Pi] m)
NIntegrate[Exp[-c^2] (-4 m^2/(R Sqrt[Pi]) Integrate[
Exp[-x^2] x^2, {x, 0, Infinity}] - 2 m^2/(R Sqrt[Pi])
Integrate[Exp[-x^2] x^2 Integrate[If[R < Sqrt[c^2 + x^2 - 2 c x z],
R/Sqrt[c^2 + x^2 - 2 c x z], 1], {z, -1, 1}], {x, 0, Infinity}])
(3 c^2 - 2 c^4), {c, 0, Infinity}]
But I get error messages: NIntegrate::inumr: "The integrand (3\ c^2-2\ c^4)\ E^-c^2\ (-44.7156-50.4562\ !(*SubsuperscriptBox[([Integral]), (0), ([Infinity])](*SuperscriptBox[(E), (-Power[<<2>>])]\\ *SuperscriptBox[(x), (2)]\\ (*SubsuperscriptBox[([Integral]), (-1), (1)]If[Less[<<2>>], Times[<<2>>], 1] [DifferentialD]z) [DifferentialD]x))) has evaluated to non-numerical values for all sampling points in the region with boundaries {{[Infinity],0.}}."
What is the right way to do this with Mathematica?
Edit:
To make the problem slightly simpler you can leave out all constants and get rid of the x-integration:
Qb[R_] :=
NIntegrate[
Exp[-c^2] NIntegrate[
If[R < Sqrt[c^2 - 2 c z], R/Sqrt[c^2 - 2 c z], 1], {z, -1, 1}],
{c, 0, Infinity}];
Qb[3.7]
or as an even simpler example
NIntegrate[NIntegrate[y, {x, 0, 1}], {y, 0, 1}]
In this case it works to replace the inner NIntegrate by Integrate, but if the inner integral is too complicated for analytic evaluation Mathematica cannot handle it.
Qb
used for? DoesR
have a value at some point? Lots of questions, you could try to debug your code and identify the problematic bits first. $\endgroup$If
. Do you perhaps mean for all those integrals to be numeric? $\endgroup$simple
example in the first place, and really its ok to edit the question and delete the complicated mess and just ask the specific relatively simple question. $\endgroup$