0

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

I use the parameters to calculate the Φ in the final, but I don't know what happen, it shows a lot of information, but I can't understand. I am using this code to solve the problem. This code is borrowed by me. With the consent of others, then I have not changed anything, but I can't display the final result. The main problem is in the last calculation FindRoot. Follow is my code.

Hope somebody can help me, thank you very much! Cause this problem is very important to me!

(* 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
m0nhawk
  • 22,980
  • 9
  • 45
  • 73
  • The code is a mess, people won't try to understand it to help. I suggest to extract different part from the last `FindRoot` to understand how the resulting equation look like and to introduce dimensionless variables, to get rid of tiny and huge exponents. – m0nhawk Nov 15 '18 at 17:28
  • Yeap, I know. But I wanna show the whole code and the parameters, I can't get rid of tiny and huge exponents, cause it will change the result, and I wanna precise number to finish my research. The main problem is that I can't get the final [Phi]S, But some can, I don't know where the problem come from? The difference of the version? – Allen_King Nov 16 '18 at 03:10

1 Answers1

2

Try CAREFULLY scrape-n-pasting this into a new fresh empty notebook and evaluating it before anything else.

(* 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*Pi*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/Integrate[x^(1/2)/(1+E^((e*Eg)/(2*k*T)+x)), {x, 0, Infinity}]*
  (2/3*Integrate[x^(3/2)/(1+E^((e*Eg)/(2*k*T)+x+(e*φB)/(k*T))), {x, 0, Infinity}] - 
   2/3*Integrate[x^(3/2)/(1+E^((e*Eg)/(2*k*T)+x+(e*φS)/(k*T))), {x, 0, Infinity}]) + 
     1/Integrate[x^(1/2)/(1+E^((e*Eg)/(2*k*T)+x)), {x, 0, Infinity}]*
  (2/3*Integrate[x^(3/2)/(1+E^((e*Eg)/(2*k*T)+x-(e*φS)/(k*T))), {x, 0, Infinity}] - 
   2/3*Integrate[x^(3/2)/(1+E^((e*Eg)/(2*k*T)+x-(e*φB)/(k*T))), {x, 0, Infinity}]))^(1/2)*
  (-ΔS) == Δφ - 1/2*Eg + φB - (φS - φB), {φS, -(1/2) Eg}];
φ = (φS /. Result[[1]]) - φB

(*-0.324431*)
Bill
  • 3,664
  • 1
  • 12
  • 9
  • Excellent!!! That's the result what i am want!!! You didn't change the code? Can I know your version of the Mathematica? Thank you very much! – Allen_King Nov 16 '18 at 03:06
  • I see some difference between my code, but i don't know why. You think is the problem of my version or my code? – Allen_King Nov 16 '18 at 03:30
  • I am sorry, Cause I am a freshman of MMA, I don't understand the "2-d desktop published" format and "through Mathematica's InputForm to turn it back into 1-d". This code just part of my project, and I will change some parameters to calculate the [Phi]S, You know I can't post all the code, and I wanna master it and fix it by myself, I am very glad if you can teach me how to do it.(I know it might be easy for you,but for me it's important and a little difficult )Thank you for your patient guidance and your precious time – Allen_King Nov 16 '18 at 05:56
  • You mean you just changed 2-d to 1-d with do nothing else,right? Thank you very much, I can run the code after your changed. If you didn't do other modification, I will use another code to test it! Thank you again,your help is very important to me ! If i hv any questions, hope I can ask you again! THANK YOU! – Allen_King Nov 17 '18 at 02:11
  • I am sorry to interrupt you again. I use this code and just changed the T=77, but I got a complex solution,can you help me and give me some explanations, cause as I know, if use the FindRoot, and given initial value is a real number,the result will be a real number. Thx! – Allen_King Nov 21 '18 at 07:08
  • Plot the function that you are using FindRoot on and see what it looks like. Perhaps your starting point isn't sufficiently close to the real root. You may need to plot the real and complex parts of your function on the same graph. I don't know that it matters, but you can combine four of those integrals into one and the remaining two integrals into one. – Bill Nov 22 '18 at 19:30