0
$\begingroup$

I have a problem with a numeric computation. I should solve a numeric ODE and the rhs is a numeric parametric function that I find with several NIntegrate. I'd like to fix the parameter (l, m is just a number) with a condition but when Mathematica tries to solve an integration gives me the error: "the integrand U has evaluated to non-numerical values for all sampling points in the region with boundaries {0,500}". The code is longer, I extrapolate the important things (I hope). Any help would be greatly appreciated!

m := 1000
theta := ArcSin[Sqrt[7*10^(-11)]]/2
Mp = 1.2209*10^22
L2[z_?NumericQ, x_?NumericQ] := Log[Abs[(((2 x)/z^2 + (2 Sqrt[m^2*z^2x^2])/z^2 + m^2) ((2 x)/z^2 - 2/z^2 Sqrt[m^2*z^2 + x^2] + m^2))/(((-2 x)/z^2 + (2 Sqrt[m^2*z^2 + x^2])/z^2 + m^2) ((-2 x)/z^2 - (2 Sqrt[m^2*z^2 + x^2])/z^2 + m^2))]]
L1[z_?NumericQ, x_?NumericQ] := Log[Abs[(-4 x/z^2 - m^2)/(4 x/z^2 - m^2)]]
Delta[z_?NumericQ] := (0.0071^2 z)/2
Sigma2[x_?NumericQ, z_?NumericQ, y_?NumericQ] := (l^4*x^3 (1 - y)^2)/((2 \ 
[Pi])^3*4*z^5*(E^x + 1)*(((2*x*(1 - y))/z^2 - m^2)^2 + (l^4*m^4)/(32*\ 
[Pi])^2))
Sigmaint[x_?NumericQ, z_?NumericQ] := NIntegrate[Sigma2[x, z, y], {y, -1, 1}, 
Method -> {"GlobalAdaptive", "MaxErrorIncreases" -> 1000},  MaxRecursion -> 20, AccuracyGoal -> 20]
Rate[z_?NumericQ] := NIntegrate[Sigmaint[x, z], {x, 0, 1000}, Method -> {"GlobalAdaptive"}, MaxRecursion -> 20, AccuracyGoal -> 20, Exclusions ->Automatic]
Gm[z_?NumericQ] := Rate[z]
Vtot[z_?NumericQ] := V[z]
G[z_] = 1/(1 + E^(z/z))
Gstar[z_] =If[z < 0.00001, 106.75, If[z < 10^(-4), 86.25, If[z < 10^(-3), 61.75, 10.75]]]
H[z_] = Sqrt[(4*Pi^3*Gstar[z])/(z^4*45*Mp^2)]
F[z_?NumericQ] := (Gm[z]*S2eff[z])/(4*H[z]*z)*G[z]
sol = ParametricNDSolve[{y'[z] == F[z], y[10^(-10)] == 0}, y, {z, 10^(-10), 10}, l]
$\endgroup$
3
  • $\begingroup$ Please provide definitions for H,G,Vtot, L1,L2, Gm, Delta, theta and definitions for all things necessary to execute your code. $\endgroup$ – flinty Aug 6 '20 at 17:40
  • 1
    $\begingroup$ Welcome to Mathematica! As noted, we do need code that works on its own in order to answer your question. That said: for this error message, nine times out of ten, it's due to a typo. You can often figure out the error by evaluating the integrand at "typical" values of the arguments within the range of integration and looking at the output; more often than not, you'll find that you didn't define the numerical value of one of your symbols, or that you misspelled one of them. $\endgroup$ – Michael Seifert Aug 6 '20 at 18:50
  • $\begingroup$ First thank you all. If i set a value for the parameter l, it works. I've already tried setting a value for m and l. But now i should leave at least one of them without value because, at the end, i have to fix it with a condition. $\endgroup$ – sam Aug 6 '20 at 19:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.