In [1]:
%pylab inline
from scipy.special import *


Populating the interactive namespace from numpy and matplotlib

Dobozba zárt részecske


In [2]:
x=linspace(0,30,1000)
figure(figsize=(12,6))
grid()
fs=30

plot(x,sqrt(x),'r',label='klasszikus',lw=4)
plot(x,floor(sqrt(x)),'b--',label='kvantum,zárt',lw=4)
plot(x,floor(sqrt(x))+1,'k:',label='kvantum,periodikus',lw=4)
xlabel(r'$Eh/8ma^2$',fontsize=fs)
xticks(fontsize=fs)
ylabel(r'$\Omega_0(E)$',fontsize=fs)
yticks(fontsize=fs)
legend(fontsize=fs,loc='lower right')
savefig('1d_doboz_Omega.png',pad_inches=0.0,bbox_inches='tight')


Rotátor


In [3]:
def lmax_from_E(e):
    l=0
    while l*(l+1)<e:
        l=l+1
    return l-1
vlmax_from_E = np.vectorize(lmax_from_E)

In [4]:
x=linspace(0,100,1000)
figure(figsize=(12,6))
grid()
fs=30
plot(x,x,'r',label='klasszikus',lw=4)
plot(x,(vlmax_from_E(x)+1)**2,'b--',label='kvantum',lw=4)
xlabel(r'$E\hbar^2/2\Theta$',fontsize=fs)
xticks(fontsize=fs)
ylabel(r'$\Omega_0(E)$',fontsize=fs)
yticks(fontsize=fs)
legend(fontsize=fs,loc='lower right')
savefig('rotator_Omega.png',pad_inches=0.0,bbox_inches='tight')


$N$ darab kétállapotú rendszer

Entrópia


In [5]:
def spn(x):
    return -(1+x)/2*log((1+x)/2)-(1-x)/2*log((1-x)/2)

In [6]:
m=linspace(-0.999,0.999,1000)
figure(figsize=(12,6))
plot(m,spn(m),lw=3)
plot([0,0],[0,1],'k-',lw=2)
plot([-.2,.2],[log(2),log(2)],'k-',lw=2)
grid()
xlabel(r'$M/N$',fontsize=fs)
xticks(fontsize=fs)
ylabel(r'$S/k_\mathrm{B}N$',fontsize=fs)
yticks(linspace(0,1,3),fontsize=fs);
text(-0.8,0.7,r'$\frac{\partial S}{\partial M}>0$',fontsize=fs)
text(0.6,0.7,r'$\frac{\partial S}{\partial M}<0$',fontsize=fs);
text(-0.4,0.66,r'$\sqrt{2}$',fontsize=fs);
savefig('N2all_entropia.png',pad_inches=0.0,bbox_inches='tight')


Hőmérséklet


In [7]:
def dspn(x):
    return log((1-x)/(1+x))

In [8]:
m=linspace(-0.999,0.999,1000)
figure(figsize=(12,6))
plot(m,1/dspn(m),lw=3)
plot([-1,1],[0,0],'k-',lw=3)
grid()
xlabel(r'$M/N$',fontsize=fs)
xticks(fontsize=fs)
ylabel(r'$k_\mathrm{B}T/2\varepsilon$',fontsize=fs)
yticks(linspace(-4,4,5),fontsize=fs);
ylim(-4,4);
savefig('N2all_homerseklet.png',pad_inches=0.0,bbox_inches='tight')


Fajhő


In [9]:
import sympy
a=sympy.symbols('a')

In [10]:
x0=float(sympy.nsolve(a-1/sympy.tanh(a),a,0))
x=linspace(0.00001,2,1000)
figure(figsize=(6,6))
plot(x,x,'r-',lw=3,label=r'$x$')
plot(x,1/tanh(x),'b--',lw=3,label=r'$\mathrm{ctan}(x)$')
plot([x0,x0],[0,2],'gray',lw=3)
plot(x0,x0,'o',mec='black',mfc='white',markersize=15,markeredgewidth=3)

legend(fontsize=fs,loc='lower right')
ylim(0,2)
grid()
xlabel(r'$x$',fontsize=fs)
xticks(fontsize=fs)
#ylabel(r'$k_\mathrm{B}T/2\varepsilon$',fontsize=fs)
yticks(fontsize=fs);



In [11]:
t=linspace(0.01,5,1000)
tt=linspace(0.01,0.8,1000)
figure(figsize=(12,6))
plot(t,1/t**2/cosh(1/t)**2,lw=3,label=r'$x^2/\cosh^2(x)$');
plot(tt,4/tt**2*exp(-2/tt),'r--',lw=4,label=r'$x^2\mathrm{e}^{-2x}$');
plot(t,1/t**2,'k:',lw=3,label=r'$x^2$');
plot(1/x0,x0**2/cosh(x0)**2,'o',mec='black',mfc='white',markersize=15,markeredgewidth=3)
xlabel(r'$T/(\varepsilon/k_\mathrm{B})$',fontsize=fs)
xticks(linspace(0,5,6),fontsize=fs)
ylabel(r'$C/k_\mathrm{B}N$',fontsize=fs)
yticks(linspace(0,0.6,3),fontsize=fs);
ylim(0,0.6)
grid()
text(4,0.2,r'$x=\frac{\varepsilon}{k_\mathrm{B}T}$',fontsize=fs)
legend(fontsize=fs)
savefig('N2all_hokapacitas.png',pad_inches=0.0,bbox_inches='tight')


$N$ darab harmonikus oszcillátor

Energia


In [18]:
ee=linspace(0.01,2,1000)
figure(figsize=(6,6))
plot(ee,1/2+1/(exp(1/ee)-1),'-',lw=3)
plot(ee,ee,'r--',lw=3)
ylim(0,2)
ylabel(r'$E/N\hbar\omega$',fontsize=fs)
xlabel(r'$k_\mathrm{B}T/\hbar\omega$',fontsize=fs)
xticks(linspace(0,2,3),fontsize=fs)
yticks(linspace(0,2,5),fontsize=fs)
grid()
savefig('Noszcillator_energia.png',pad_inches=0.0,bbox_inches='tight')


Fajhő


In [13]:
ee=linspace(0.01,3,1000)
figure(figsize=(6,6))
plot(ee,1/(2*ee*sinh(1/(2*ee)))**2,'-',lw=3)
ylim(0,2)
ylabel(r'$C/Nk_\mathrm{B}$',fontsize=fs)
xlabel(r'$k_\mathrm{B}T/\hbar\omega$',fontsize=fs)
xticks(linspace(0,3,4),fontsize=fs)
yticks(linspace(0,2,3),fontsize=fs)
grid()
savefig('Noszcillator_fajho.png',pad_inches=0.0,bbox_inches='tight')



In [ ]: