I had earlier posted my code in a previous question, but I am reposting my code here:

q := 1.6*10^-19; (* Electron charge in Coulomb *)
me := 9.1*10^-31; (* Free electron rest mass in kg *)
h := 6.63/(2*\[Pi])*10^-34;  (* Reduced Planck's constant in J.s *)
kb := 1.38*10^-23; (* Boltzmann constant in J/K *)

FD[d_, \[Eta]_] := -PolyLog[d + 1, -E^\[Eta]];(* Defining the Fermi-Dirac integrals *)

Nc[d_, gs_, gv_, meff_, T_] := gs*gv*((2*\[Pi]*meff*me*kb*T)/h^2)^(d/2);  (* Effective band-edge DOS in d dimensions *)

n[d_, gs_, gv_, meff_, T_, \[Eta]F_] := Nc[d, gs, gv, meff, T]*FD[(d - 2)/2, \[Eta]F]; 

\[Eta]S[d_, gs_, gv_, meff_, T_, v_, nd_] := 
      1/2*(n[d, gs, gv, meff, T, \[Eta]] + 
          n[d, gs, gv, meff, T, \[Eta] - (q*v)/(kb*T)]) == 
       nd, {\[Eta], 

Lkcore[d_, gs_, gv_, meff_, T_, v_, nd_] := 
 1/2*((FD[d/2, \[Eta]S[d, gs, gv, meff, T, v, nd]] + 
      FD[d/2, \[Eta]S[d, gs, gv, meff, T, v, nd] - (q*v)/(kb*T)] - 
      2*FD[d/2, \[Eta]S[d, gs, gv, meff, T, 0, nd]])/(FD[(d - 1)/
       2, \[Eta]S[d, gs, gv, meff, T, v, nd]] - 
      FD[(d - 1)/
       2, \[Eta]S[d, gs, gv, meff, T, v, nd] - (q*v)/(kb*T)])^2); 

Lk0[d_, gs_, gv_, meff_, T_] := (2*\[Pi]*meff*me)/(
  q^2*Nc[d, gs, gv, meff, T]);
Lkall[d_, gs_, gv_, meff_, T_, v_, nd_] := 
  Lk0[d, gs, gv, meff, T]*Lkcore[d, gs, gv, meff, T, v, nd];

LogLinearPlot[Lkall[2, 2, 1, 1, 0.001, 0.1, n2d], {n2d, 10^14, 10^17}]

When I try to plot this function it returns me the following error:

SystemException["MemoryAllocationFailure"] [enter image description here]2

What is it wrong that I am doing? Also, sometimes it does work, but most of the time it doesn't.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.