如何使用Mathematica解决代码中的数值微分和积分问题?

时间:2018-11-15 06:02:18

标签: wolfram-mathematica numeric differentiation

enter image description here enter image description here enter image description here enter image description here

我使用参数最终计算Φ,但我不知道会发生什么,它显示了很多信息,但我听不懂。我正在使用此代码来解决问题。这段代码是我借的。在别人的同意下,我什么也没有改变,但是我无法显示最终结果。主要问题在于上一次计算FindRoot。遵循是我的代码。

希望有人能帮助我,非常感谢!因为这个问题对我来说很重要!

(* Physical Constants *)
k = 1.38 * 10^-23;
ϵ = 8.85 * 10^-12;
e = 1.6 *10^-19;
m0 = 9.11 * 10^-31;
h = 6.63 * 10^-34;

(* Basic information of Black Phosphorus *)
κ = 6.1;
me = 0.13 * m0;
mp = 0.28 * m0;
Eg = 0.33;
Δϕ = -0.1;
(* Δϕ = ϕTip - χ *)
ΔV = 0.04;
(* ΔV = EA - EV *)

(* Experimental conditions *)
T = 4.3;
ΔS = 0.4*10^-9;
(* Distance between tip and sample *)
ni = 2/h^3*(2*π*k*T)^(3/2)*(me*mp)^(3/4)*E^(-((Eg*e)/(2*k*T)));
uB = (e*ϕB)/(k*T);
NA = 10^22;
ND = 0;
X = FindRoot[-(NA/(
    1 + 4*E^(((ΔV - 1/2 Eg - ϕB)*e)/(k*T)))) == 
    2*ni*Sinh[uB], {ϕB, 1/2 Eg}]
ϕB = ϕB /. X;
uB = (e*ϕB)/(k*T);
LD = ((κ*ϵ*k*T)/(2*e^2*ni))^(1/2);
Result = FindRoot[(k*T)/e*1/
    LD*(NA/ni*
        Log[(1 + 
            1/2*E^((e*ϕS)/(k*T) - ((ΔV - 1/2*Eg)*e)/(
            k*T)))/(
        1 + 1/2*E^((e*ϕB)/(
            k*T) - ((ΔV - 1/2*Eg)*e)/(k*T)))] - 1/\!\(
\*SubsuperscriptBox[\(∫\), \(0\), \(∞\)]\(
\*FractionBox[
SuperscriptBox[\(x\), 
FractionBox[\(1\), \(2\)]], \(1 + 
\*SuperscriptBox[\(E\), \(x - 
\*FractionBox[\(\(-Eg\)*e\), \(2*k*
                T\)]\)]\)] \[DifferentialD]x\)\)*(2/3*\!\(
\*SubsuperscriptBox[\(∫\), \(0\), \(∞\)]\(
\*FractionBox[
SuperscriptBox[\(x\), 
FractionBox[\(3\), \(2\)]], \(1 + 
\*SuperscriptBox[\(E\), \(x - 
\*FractionBox[\(\(-Eg\)*e\), \(2*k*T\)] + 
\*FractionBox[\(e*ϕB\), \(k*T\)]\)]\)] \[DifferentialD]x\)\) - 
            2/3*\!\(
\*SubsuperscriptBox[\(∫\), \(0\), \(∞\)]\(
\*FractionBox[
SuperscriptBox[\(x\), 
FractionBox[\(3\), \(2\)]], \(1 + 
\*SuperscriptBox[\(E\), \(x - 
\*FractionBox[\(\(-Eg\)*e\), \(2*k*T\)] + 
\*FractionBox[\(e*ϕS\), \(k*T\)]\)]\)] \[DifferentialD]x\)\)) + 
        1/\!\(
\*SubsuperscriptBox[\(∫\), \(0\), \(∞\)]\(
\*FractionBox[
SuperscriptBox[\(x\), 
FractionBox[\(1\), \(2\)]], \(1 + 
\*SuperscriptBox[\(E\), \(x - 
\*FractionBox[\(\(-Eg\)*e\), \(2*k*
                T\)]\)]\)] \[DifferentialD]x\)\)*(2/3*\!\(
\*SubsuperscriptBox[\(∫\), \(0\), \(∞\)]\(
\*FractionBox[
SuperscriptBox[\(x\), 
FractionBox[\(3\), \(2\)]], \(1 + 
\*SuperscriptBox[\(E\), \(x + 
\*FractionBox[\(Eg*e\), \(2*k*T\)] - 
\*FractionBox[\(e*ϕS\), \(k*T\)]\)]\)] \[DifferentialD]x\)\) - 
            2/3*\!\(
\*SubsuperscriptBox[\(∫\), \(0\), \(∞\)]\(
\*FractionBox[
SuperscriptBox[\(x\), 
FractionBox[\(3\), \(2\)]], \(1 + 
\*SuperscriptBox[\(E\), \(x + 
\*FractionBox[\(Eg*e\), \(2*k*T\)] - 
\*FractionBox[\(e*ϕB\), \(k*T\)]\)]\)] \[DifferentialD]x\)\)))^(
    1/2)*(-ΔS) == Δϕ - 
    1/2*Eg + ϕB - (ϕS - ϕB), {ϕS, -(1/2) Eg}]
ϕ = (ϕS /. Result[[1]]) - ϕB

1 个答案:

答案 0 :(得分:2)

尝试谨慎地将其粘贴到一个新的空笔记本中,然后再进行评估。

alluxio.exception.status.DeadlineExceededException: Timeout writing to WorkerNetAddress{host=spark-74-44.xxxx, rpcPort=51998, dataPort=51999, webPort=51997, domainSocketPath=} for request type: ALLUXIO_BLOCK
id: 3209355843338240
tier: 0
worker_group {
  host: "spark6-64-156.xxxx"
  rpc_port: 51998
  data_port: 51999
  web_port: 51997
  socket_path: ""
}