Created
December 22, 2017 01:31
-
-
Save Mahdisadjadi/d09a50174f020ef77e5951402656bb88 to your computer and use it in GitHub Desktop.
Generate picture of a specific heat two level states
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
This code generates a picture of the specific | |
heat of a two-level system. It also shows | |
the limits in low- and high-temperatures | |
regions, in addition to the location of | |
the maximum specific heat. | |
Mahdi Sadjadi, 2017. | |
''' | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from matplotlib.ticker import FuncFormatter, MaxNLocator | |
for param in ['axes.labelsize','xtick.labelsize','ytick.labelsize']: | |
plt.rcParams[param] = 15 | |
f = lambda x: x**2 * np.exp(-x) / (1+np.exp(-x))**2 | |
g = lambda x: x**2 /4 | |
h = lambda x: (x)**2 * np.exp(-(x)) | |
fig,ax = plt.subplots(1,1,figsize=(7,7)) | |
x = np.linspace(0,10,100) | |
ax.plot(x,f(x),'-k',lw=2,label='Exact') | |
x = np.linspace(0,2,20) | |
ax.plot(x,g(x),':r',lw=2,label=r'$x^2/4$') | |
x = np.linspace(2,10,20) | |
ax.plot(x,h(x),':b',lw=2,label=r'$x^2 e^{-x}$') | |
ax.vlines(2.4, 0, 0.5, linestyles='dashed',color='k') | |
ax.text(2.6,0.1,r'$T_0 \approx 2.4 T $',fontsize=20) | |
ax.set_xlim(0,10) | |
ax.set_ylim(0,0.5) | |
ax.set_xlabel(r'$x = \frac{T_0}{T}$') | |
ax.set_ylabel(r'$k_B^{-1} C(T_0,T)$') | |
ax.legend() | |
plt.tight_layout() | |
plt.savefig('./specific_heat_ts.pdf',dpi=100,transparent=True) | |
plt.show(fig) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment