Put the standard imports for Matplotlib, Numpy and the IPython widgets in the following cell.
In [1]:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
In [2]:
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 [3]:
Image('fermidist.png')
Out[3]:
In this equation:
In the cell below, typeset this equation using LaTeX:
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 [7]:
np.exp(2)
Out[7]:
In [8]:
def fermidist(energy, mu, kT):
"""Compute the Fermi distribution at energy, mu and kT."""
x=np.exp((energy-mu)/(kT))
F=1/(x+1)
return F
In [9]:
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 [26]:
plt.plot?
In [42]:
def plot_fermidist(mu, kT):
energy=np.linspace(0.0,10.0,100)
plot_f=fermidist(energy,mu,kT)
plt.figure(figsize=(5,5))
plt.plot(energy,plot_f, 'ro')
plt.ylabel('F($\epsilon$)')
plt.xlabel('$\epsilon$')
plt.title('F($\epsilon$) vs $\epsilon$')
plt.tight_layout()
plt.xlim(0,2*mu)
In [43]:
plot_fermidist(4.0, 1.0)
In [44]:
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 [45]:
interact(plot_fermidist, mu=(0.0,5.0), kT=(0.1,10.0))
Provide complete sentence answers to the following questions in the cell below:
Use LaTeX to typeset any mathematical symbols in your answer.
-When the value $kT$ becomes extremely low, the probability of finding the particle in question past a quantam state value of $\mu$ becomes nearly 0
-When the value $kT$ becomes extremely high, the probability of finding the particle in higher quantam states is much more likely
-As you increase the chemical potential $\mu$, the quantam states possible for the particle will increase for a fixed $kT$ value
-As would be rational to assume, chemcial potential increase is related to an increase in the number of particles in the system, which is shwon by the graph because as &\mu$ increases so does the area under the graph
In [ ]: