# Solving a particular transcendental equation

I am trying to find the chemical potential as a function of number density, the equation of which is $$$$\frac{n}{2\pi l_{B}^2} = \int_{-\Delta}^{\Delta}d\epsilon \frac{e^{-\epsilon^2/w^2}}{e^{{(\epsilon-\omega_{L}+\delta\mu)}/kT}+1},$$$$ where $$\omega_{L}=(2n+1)\hbar\omega_{c}$$, and $$\Delta = w+kT$$.

I would like to solve for $$\delta\mu$$ as a function of $$n$$ for different values of parameters $$w, kT.$$

(*kT is set to 1. \hbar\omega_{c} is set to 1. 2\pi l_{B}^2 is set to 1.*)

In[113]:= e[w_, T_, M_, i_] := -(w + T) + 2 (w + T) i/M; (*discretize e*)

In[95]:=
S[w_, T_, M_, dmuu_, NN_] :=
2 ((w + T)/M)
Sum[1/(Sqrt[\[Pi]] w) Exp[(-e[w, T, M, i])^2/w^2]/(
Exp[(e[w, T, M, i] - (NN + 0.5) + dmuu)/T] + 1), {i, 0, M}] (*RHS of equation defined in the text*)

In[143]:= N[ S[1, 1, 50, 0.1, 10]]

Out[143]= 21.1583

Solve[(2 10 + 1) - S[1, 1, 50, dmuu, 10] == 0, dmuu ] (*does not evaluate*)


Unfortunately Solve takes too long and I abort the evaluation.

Alternatively I can do a low-temperature expansion (Sommerfeld expansion), $$$$\int d\epsilon \phi(\epsilon)\frac{1}{e^{{(\epsilon-\mu)}/kT}+1} = \int^{\mu}d\epsilon\phi(\epsilon)+\frac{\pi^2}{6}(kT)^2\phi^{'}(\mu)+\frac{7\pi^2}{360}(kT)^4\phi^{'''}(\mu)+\dots$$$$ and find the chemical potential $$\mu$$ as a series expansion in $$\frac{kT}{\mu_{0}}$$, where at $$\mu = \mu_{0}$$, $$n = n_{0}$$.($$kT\ll \mu_{0}$$)

But I was wondering if there is a direct way to solve the transcendental equation.

Edit : Thanks to Daniel Huber, FindRoot is useful in finding the root of the transcendental equation. FindRoot returns a list of replacement rules. I need to input the result of FindRoot to a function, i.e.,

(* f[x_] := FindRoot[g[x,u],{u,0}] *)
(* FindRoot returns a list of replacement for particular values of x*)
(*I would like to input f[x] into another function F[f[x]]*)

dmu[w_, T_, NN_] :=
FindRoot[(2 NN + 1) - S[w, T, 100, dmuu, NN], {dmuu, 0} ]
DD[w_, T_, mu_, M_, NN_] := -2 ((w + T)/M)
Sum[1/(Sqrt[Pi] w) Exp[-e[w, T, M, i]^2/w^2] - E^((
e[w, T, M, i] - (NN + 0.5) + mu)/
T)/((1 + E^((e[w, T, M, i] - (NN + 0.5) + mu)/T))^2 T), {i, 0,
M}]

A[w_, T_, NN_, Ex_] := Ex (1 - 1/2 Ex DD[w, T, dmu[w, T, NN], 10] )(*dmu returns a replacement list for particular values. Is there any way to input into a function.*)


How do I convert FindRoot$$$$ for variable parameters into an input for another function?

Look at:

Solve[(2 10 + 1) - S[1, 1, 50, dmuu, 10] == 0, dmuu ]


This is nothing else than a root search. If we in addition plot "S":

Plot[(2 10 + 1) - S[1, 1, 50, dmuu, 10], {dmuu, 0, 5}]


and if we are only are interested in the above root, we may write:

FindRoot[(2 10 + 1) - S[1, 1, 50, dmuu, 10], {dmuu, 0}]


(* {dmuu -> 4.54994} *)

• how do I assign a variable to have the output of FindRoot. I want to substitute the value of find root as an input to a function. Commented Jul 20, 2022 at 19:25
• variable= dmuu /. {dmuu -> 4.54994} Commented Jul 21, 2022 at 7:04