ADS

Computation of the partition function Z(β) for examples of systems with a finite number of single particle levels

 

Computation of the partition function Z(β) for examples of systems with a finite number of single particle levels (e.g., 2 level, 3 level, etc.) and a finite number of non-interacting particles N under Maxwell-Boltzmann statistics:

PROGRAM :
clf ;clc
 
k = 8.6e-5 // in (eV/K) unit
E = [0, .001, .002] // in (eV) unit
dT = 1 // step size
T = [1:dT:100] // in K unit
np = [1,2,3]
// MB Probablity function
function y=f(E, T)
 y = exp(-E./(k*T))
endfunction
p = []
for T0 = T
 p0 = feval(E,T0,f)/sum(feval(E,T0,f))
 p = [p,p0]
end
plot2d(T',p',[-6,-5,-1])
xlabel("Temperature ( K )","font_size",3)
ylabel("Probality Occupancy","font_size",3)
legend("E = "+string(E)+" eV ", 1)
title("The Probality of Occupancy for MB statistics","font_size",4)
xgrid
zn = []
U = []
Cv = []
dU = []
for n = np
 z = []
 for T0 = T
 z = [z;sum(feval(E,T0,f))]
 end
 zn = [zn,z.^n]
 u = k*(T(1:$-1).^2)'.*(diff(log(z.^n))./dT)
 U = [U,u]
 Cv = [Cv,diff(u)./dT]
 x = sqrt(k*(T(1:$-2).^2)'.*(diff(u)./dT))
 dU = [dU,x]
end
//plot Partition Function
scf()
plot2d(T',zn,[-6,-5,-1])
legend("N = "+string(np),2)
title("Partition function for MB statistics","font_size",4)
xlabel("Temperature (K)","font_size",3)
ylabel("Partition Function ","font_size",3)
xgrid
//Plot avarage energy
scf()
plot2d(T(1:$-1)',U,[-6,-5,-1])
legend("N = "+string(np),2)
title("Avarage Energy for MB statistics","font_size",4)
xlabel("Temperature (K)","font_size",3)
ylabel("Avarage Energy (eV) ","font_size",3)
xgrid
//Plot Specific heat
scf()
plot2d(T(1:$-2)',Cv,[-6,-9,-10])
legend("N = "+string(np))
title("Specific Heat for MB statistics","font_size",4)
xlabel("Temperature (K)","font_size",3)
ylabel("Specific Heat (eV/kg-K) ","font_size",3)
xgrid
// Plot Energy fluctuation
scf()
plot2d(T(1:$-2)',dU,[-6,-5,-1])
legend("N = "+string(np),4)
title("Energy Fluctuation for MB statistics","font_size",4)
xlabel("Temperature (K)","font_size",3)
ylabel("Energy Fluctuation (eV) ","font_size",3)
xgrid

output:

একটি মন্তব্য পোস্ট করুন

0 মন্তব্যসমূহ