Put the standard imports for Matplotlib, Numpy and the IPython widgets in the following cell.
In [13]:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
In [14]:
from IPython.display import Image
from IPython.html.widgets import interact, interactive, fixed
In quantum statistics, the Fermi-Dirac distribution is related to the probability that a particle will be in a quantum state with energy $\epsilon$. The equation for the distribution $F(\epsilon)$ is:
In [15]:
Image('fermidist.png')
Out[15]:
In this equation:
In the cell below, typeset this equation using LaTeX:
The Fermi-Dirac equation is given by: $$\large F(\epsilon)=\frac{1}{e^{\frac{(\epsilon-\mu)}{kT}}+1}$$ Where:
$\epsilon $ is the single particle energy. $\mu $ is the chemical potential, which is related to the total number of particles. $k $ is the Boltzmann constant. $T $ is the temperature in Kelvin.
Define a function fermidist(energy, mu, kT)
that computes the distribution function for a given value of energy
, chemical potential mu
and temperature kT
. Note here, kT
is a single variable with units of energy. Make sure your function works with an array and don't use any for
or while
loops in your code.
In [16]:
def fermidist(energy, mu, kT):
"""Compute the Fermi distribution at energy, mu and kT."""
return 1/(np.exp((energy-mu)/kT)+1)
In [17]:
assert np.allclose(fermidist(0.5, 1.0, 10.0), 0.51249739648421033)
assert np.allclose(fermidist(np.linspace(0.0,1.0,10), 1.0, 10.0),
np.array([ 0.52497919, 0.5222076 , 0.51943465, 0.5166605 , 0.51388532,
0.51110928, 0.50833256, 0.50555533, 0.50277775, 0.5 ]))
Write a function plot_fermidist(mu, kT)
that plots the Fermi distribution $F(\epsilon)$ as a function of $\epsilon$ as a line plot for the parameters mu
and kT
.
In [43]:
def plot_fermidist(mu, kT):
fermi = fermidist(np.linspace(0,10.0, 100), mu, kT)
f = plt.figure(figsize=(9,6))
ax = plt.subplot(111)
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.yaxis.set_ticks_position('left')
ax.xaxis.set_ticks_position('bottom')
plt.plot(np.linspace(0,10.0, 100), fermi)
plt.xlabel(r"Energy $\epsilon$")
plt.ylabel(r"Probability $F(\epsilon)$")
plt.ylim(0,1.0)
plt.title(r"Probability that a particle will have energy $\epsilon$")
In [44]:
plot_fermidist(4.0, 1.0)
In [45]:
assert True # leave this for grading the plot_fermidist function
Use interact
with plot_fermidist
to explore the distribution:
mu
use a floating point slider over the range $[0.0,5.0]$.kT
use a floating point slider over the range $[0.1,10.0]$.
In [46]:
interact(plot_fermidist, mu=(0,5.0, .1), kT=(0.1,10.0, .1));
Provide complete sentence answers to the following questions in the cell below:
Use LaTeX to typeset any mathematical symbols in your answer.
a) When kT is low, a particle has a higher probability of having a lower energy $\epsilon < \mu$ and a lower probability of having an energy $\epsilon > \mu$. b) When kT is high, a particle has a more uniform probability of having any energy $\epsilon$. Though, it does still tend to favor lower $\epsilon$. c) The chemical potential $\mu$ affects where the curve $F(\epsilon)$ hits its inflection point. d) A higher chemical potential $\mu$ gives us more area under this curve and thus more particles.
In [ ]: