1
$\begingroup$

I am trying to solve the following equation numerically for $\mu$, but I'd like to keep $T$ and $n_e$ as parameters for easier plots. $$ n_e = \frac{1}{\pi^2}\int_0^\infty dp\, p^2\frac{\sinh \left(\frac{\mu }{T}\right)}{\cosh \left(\frac{\sqrt{{m_e}^2+p^2}}{T}\right)+\cosh \left(\frac{\mu}{T}\right)} $$

I tried the following code

me = 0.51 10^-3;
Ke = 8.62 10^-14;
ne[\[Micro]_, T_] := ne[\[Micro], T] = 1/\[Pi]^2 NIntegrate[p^2*Sinh[\[Micro]/T]/(Cosh[Sqrt[me^2 + p^2]/T] + Cosh[\[Micro]/T]), {p, 0, \[Infinity]}]
FindRoot[10 == ne[\[Micro], 10^2*Ke], {\[Micro], 0.10}]

But got an error saying that the integrand has evaluated to non-numerical values for all sampling points in the region of integration...

$\endgroup$
3
  • 1
    $\begingroup$ Get rid of this ne[\[Micro]_, T_] := ne[\[Micro], T] = ... and just use ne[\[Mu]_?NumericQ, T_?NumericQ] := and change \[Micro] to \[Mu] (this last part has no functional effect but it's bad style to use an SI prefix symbol instead of a Greek letter). Then Remove["Global`*"] and re-evaluate. You'll still get warnings about poor convergence. $\endgroup$
    – flinty
    Nov 25, 2020 at 13:17
  • $\begingroup$ I tried out some different integration methods but they still had warnings, and LocalAdaptive had no warnings but was incorrect. The best I could get was $\mu = 6.7$ but I have no idea if that's accurate. $\endgroup$
    – flinty
    Nov 25, 2020 at 13:37
  • $\begingroup$ Thanks but it keeps telling me that it encountered a singular Jacobian, whatever value I use as starting point (Btw, ne is ~10^30 and T ~ 10^-3) $\endgroup$ Nov 25, 2020 at 13:49

1 Answer 1

1
$\begingroup$

Try this:

m = 0.51 10^-3;
ParametricPlot3D[{T, 
  Log[Sinh[μ/T]*π^-2 NIntegrate[
     p^2/(Cosh[Sqrt[m^2 + p^2]/T] + Cosh[μ/T]), {p, 0, 
      100}]], μ}, {T, 1, 5}, {μ, 1, 5}, PlotRange -> All, 
 AxesLabel -> {Style["T", Italic, 16], 
   Style["log(\!\(\*SubscriptBox[\(n\), \(e\)]\))", Italic, 16], 
   Style["μ", Italic, 16]}, ColorFunction -> "Rainbow"]

with the following effect:

enter image description here

If you want to make a solution in a form of a list, replace ParametricPlot3D by Table.

Have fun!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.