馬克士威速率分布圖形
作者:王一哲
日期:2020/7/19
原理
全名為馬克士威 - 波茲曼速率分布 (Maxwell–Boltzmann distribution),氣體分子的移動速率不會完全相同,氣體分子處於某個速率的機率密度函數為
上式中 是原子質量, 是波茲曼常數 (Boltzmann constant) , 是溫度, 是速率。下圖是維基百科上的圖片。不過我們只要知道函數的樣子,應該就能用函數繪圖軟體畫出一樣的圖片。
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
如果想要用 VPython 模擬出類似的結果,請參考 Glowscript 網站範例。
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
使用 Matplotlib 繪圖
import numpy as np
import matplotlib.pyplot as plt
vmin, vmax, num = 0, 2500, 100
v = np.linspace(0, 2500, 1000)
amu = 1.66053904E-27
mass = {'He': 4*amu, 'Ne': 20*amu, 'Ar': 40*amu, 'Xe': 132*amu}
T = 298.15
k = 1.38E-23
He = 4*np.pi*(mass['He']/(2*np.pi*k*T))**(3/2)*v**2*np.exp(-(mass['He']*v**2)/(2*k*T))
Ne = 4*np.pi*(mass['Ne']/(2*np.pi*k*T))**(3/2)*v**2*np.exp(-(mass['Ne']*v**2)/(2*k*T))
Ar = 4*np.pi*(mass['Ar']/(2*np.pi*k*T))**(3/2)*v**2*np.exp(-(mass['Ar']*v**2)/(2*k*T))
Xe = 4*np.pi*(mass['Xe']/(2*np.pi*k*T))**(3/2)*v**2*np.exp(-(mass['Xe']*v**2)/(2*k*T))
plt.figure(figsize=(6, 4.5), dpi=100)
plt.subplots_adjust(left=0.2)
plt.xlabel('Speed (m/s)', fontsize=14)
plt.ylabel('Propability Density (s/m)', fontsize=14)
plt.xticks(fontsize = 12)
plt.yticks(fontsize = 12)
plt.grid(color='cyan', linestyle='--', linewidth=1)
plt.xlim(vmin, vmax)
plt.ylim(0, 0.0045)
line1, = plt.plot(v, He, color='blue', linewidth=3, label=r'$\mathrm{{}^4 He}$')
line2, = plt.plot(v, Ne, color='green', linewidth=3, label=r'$\mathrm{{}^{20} Ne}$')
line3, = plt.plot(v, Ar, color='red', linewidth=3, label=r'$\mathrm{{}^{40} Ar}$')
line4, = plt.plot(v, Xe, color='orange', linewidth=3, label=r'$\mathrm{{}^{132} Xe}$')
plt.legend(handles = [line1, line2, line3, line4], loc='upper right', fontsize=12)
plt.savefig('MaxwellDistribution.svg')
plt.savefig('MaxwellDistribution.png')
plt.show()
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
使用 Matplotlib 繪製的圖片
參考資料
- David Halliday et al, "Fundamentals of Physics, 6th ed," (2000) 464
- https://en.wikipedia.org/wiki/File:MaxwellBoltzmann-en.svg
- https://www.glowscript.org/#/user/GlowScriptDemos/folder/Examples/program/HardSphereGas-VPython