0

I wish to solve this equation for kappa, given a certain set of parameters (m and beta):

chi[x_, m_, beta_, kappa_] := (x*(1 - x))^beta*Exp[-(m^2/(2*kappa^2*x*(1 - x)))]

norm[m_, beta_, kappa_] := 1/NIntegrate[chi[x, m, beta, kappa]^2/(x*(1 - x)), {x, 0, 1}]

deltaM2[m_, beta_, kappa_] := norm[m, beta, kappa]m^2NIntegrate[chi[x, m, beta, kappa]^2/(x^2*(1 - x)^2), {x, 0, 1}]

M2[m_, beta_, kappa_] := deltaM2[m, beta, kappa] + 2*kappa^2

Solve[3.097^2 == M2[1.27, 2.56, kappa], kappa]

However, I am thrown this error message when I run the code:

NIntegrate::inumr: The integrand (E^(-(1.6129/(kappa^2 (1-x) x))) ((1-x) x)^5.12)/((1-x) x) has 
evaluated to non-numerical values for all sampling points in the region with boundaries {{0,1}}.

It is clear that NIntegratecannot work since kappa remains a symbol. My question is if there is a way of solving this equation that substitutes in values for kappa to find a solution, so that NIntegrate can still work. These integrals cannot be solved analytically by Mathematica, from what I've tried.

I have found that using FindRoot[3.097^2 == M2[1.27, 2.56, kappa], {kappa, 0.1}] instead of Solve produces an answer, but I'm not sure why. I would also appreciate any different answers! Thank you.

STDK
  • 157
  • 6
  • 4
    Make all your arguments pattern test ?NumericQ, because Solve and NIntegrate are attempting symbolic manipulation. For example: M2[m_?NumericQ, beta_?NumericQ, kappa_?NumericQ]. Also use NSolve, not Solve. After doing this I get {{kappa -> 1.18321}}. See this https://mathematica.stackexchange.com/a/26037/72682 – flinty Jul 16 '20 at 15:53
  • @flinty That's exactly what I am looking for. Thank you. – STDK Jul 16 '20 at 16:08

0 Answers0