This question is continuation of my previous post. Alex Trounev was very helpful in fixing a crucial typo in the analytic solution known from the article "Density Dependent Exchange Contribution to ∂𝜇/∂𝑛 and Compressibility in Graphene". Here, the question is about obtaining the analytic solution in fully automatic way with MA. It consists of 2 parts:
I know the analytic solution for
xe
(but do not know how to obtain it) and I can verify it numerically.I have numerical solution for
xi
and a fixed analytical solution that works in some parameter range.I am asking because I feel that there are other typos that I am not able to fix myself.
We will be needing some auxiliary functions [Eqs.(5,6) in the paper] that I define beforehands
(*i[1]=Integrate[EllipticK[y^2]-EllipticE[y^2],{y,0,1/x},Assumptions->x>1]*)
i[1]=1/(2 x) π (-HypergeometricPFQ[{-(1/2),1/2,1/2},{1,3/2},1/x^2]+HypergeometricPFQ[{1/2,1/2,1/2},{1,3/2},1/x^2]);
(*i[2]=Integrate[(EllipticK[y^2]-EllipticE[y^2]-π/4 y^2)/y^3,{y,0,x},Assumptions->0≤x≤1]*)
i[2]=3/256 π x^2 (HypergeometricPFQ[{1,1,3/2,5/2},{2,3,3},x^2]+3 HypergeometricPFQ[{1,1,5/2,5/2},{2,3,3},x^2]);
f[x_] =Piecewise[{{EllipticE[x^2],x<=1},{x EllipticE[1/x^2]-(x-1/x)EllipticK[1/x^2],True}}];
h[x_] =Piecewise[{{x(π/4Log[4/x]-π/8)-x i[2],x<=1},{x i[1],x>1}}];
h2[x_]=Piecewise[{{x(π/4Log[4/x]+π/8)-x i[2],x<=1},{x i[1],x>1}}];
These expressions I want to reproduce with MA
Calculation of xe
With the definitions
p[k_,q_,θ_]:=Sqrt[k^2+q^2-2 k q Cos[θ]]
Fs[k_,q_,θ_,si_,sf_]:=1/2(1+si sf (k-q Cos[θ] )/p[k,q,θ] )
n[k_,s_]:=UnitStep[1- k s]
n0[s_]:=1/2(1-s)
δn[k_,s_]:=n[k,s]-n0[s]
we get the first 2d integral that I want to know how to compute analytically
xeN[k_?NumericQ,s_]:=-(1/(2π))NIntegrate[
Fs[k,q,θ,s,1]δn[p[k,q,θ],1]+Fs[k,q,θ,s,-1]δn[p[k,q,θ],-1],
{q,0,∞},{θ,0,2π},PrecisionGoal->2]
xeN[k_?NumericQ,0]:=-(1/(2π))NIntegrate[UnitStep[1- p[k,q,θ]],
{q,0,∞},{θ,0,2π},PrecisionGoal->4] (* sum of the 1 and -1 cases*)
Here, xe
is the known analytical expression for xeN
but how to get this with MA?:
xe[k_,s_]:=1/π (-f[k]-s h[k])
Verification
is time consuming
eval[ 1]=Table[{k,xeN[k, 1]},{k,0.1,2,0.2}]
eval[-1]=Table[{k,xeN[k,-1]},{k,0.1,2,0.2}]
eval[ 0]=Table[{k,xeN[k, 0]},{k,0.1,2,0.2}]; (*the sum of the 1 and -1 cases*)
and plot
Plot[{xe[k,1],xe[k,-1],xe[k,1]+xe[k,-1]},{k,0,2},
PlotRange->{-1.05,0},PlotTheme->{"FrameGrid","BoldColor"},FrameStyle->14,FrameLabel->{"k","Subscript[x, e]"},Epilog->{PointSize[Medium],Blue,Point[eval[1]],Orange,Point[eval[-1]],Red,Point[eval[0]]}]
This is actually the Fig.1 from the paper.
Calculation of xi
The second integral is simpler from the numerical point of view
xiN[k_?NumericQ,kc_?NumericQ,s_]:=-(1/(2π))NIntegrate[
Fs[k,q,θ,s,1]n0[1]+Fs[k,q,θ,s,-1]n0[-1],
{q,0,kc},{θ,0,2π},PrecisionGoal->4]+kc/2
xiN[k_?NumericQ,kc_?NumericQ,0]:=-(1/(2π))NIntegrate[1,
{q,0,kc},{θ,0,2π},PrecisionGoal->4]+kc (* sum of the 1 and -1 cases*)
but not so simple analytically...
Verification
c=30;
ival[1] =Table[{k,xiN[k,c,1]}, {k,0.1,40,2}];
ival[-1]=Table[{k,xiN[k,c,-1]},{k,0.1,40,2}];
ival[0] =Table[{k,xiN[k,c,0]}, {k,0.1,40,2}]; (*the sum of the 1 and -1 cases*)
against analytical solution
xi[k_,s_,kc_]:=kc/π (-f[k/kc]+s h2[k/kc])
Δxi[k_,s_,kc_]:=xi[k,s,kc]+kc/2
and plot
Plot[{Δxi[k,1,c],Δxi[k,-1,c],Δxi[k,1,c]+Δxi[k,-1,c]},{k,0,40},
PlotRange->{-20,20},PlotTheme->{"FrameGrid","BoldColor"},FrameStyle->14,FrameLabel->{"k","Subscript[x, i]"},Epilog->{PointSize[Medium],Blue,Point[ival[1]],Orange,Point[ival[-1]],Red,Point[ival[0]]}]
Thanks to the Alex Trounev answer, h
was replaced with h2
(sign correction) thereby fixing the small-$k$ behavior, however, there are still problems at high $k$ as can be seen from the plot.
xiN
marked the same? It is necessary to separate identifiers, for example,xiN
andxiN1
. Undefined{Δxi[k,1,c,1],Δxi[k,-1,c,1],Δxi[k,1,c,1]+Δxi[k,-1,c,1]}
therefore not reproducedPlot
$\endgroup$h2
supposed to have a big discontinuity at x=1? This must be the source of the discontinuities at k=30... $\endgroup$f
term in the expression forΔxi
,h2
should be modified accordingly and it should be continuous. The reason for the separation ofxe
andxi
intof
andh
is to haves
-dependent ands
-independent parts. $\endgroup$