<jupyter_start><jupyter_text>Interact Exercise 6  Imports Put the standard imports for Matplotlib, Numpy and the IPython widgets in the following cell.<jupyter_code>%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import math as m
from IPython.display import Image
from IPython.html.widgets import interact, interactive, fixed<jupyter_output><empty_output><jupyter_text>Exploring the Fermi distribution In quantum statistics, the [Fermi-Dirac](http://en.wikipedia.org/wiki/Fermi%E2%80%93Dirac_statistics) 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:<jupyter_code>Image('fermidist.png')
%% html
<equation>
    F($epsilon$)=$1/(e^(($epsilon$ -$mu$)/kT)-1)
    </equation><jupyter_output>ERROR: Cell magic `%%` not found.<jupyter_text>In this equation:* $\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.In the cell below, typeset this equation using LaTeX: YOUR ANSWER HERE 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.<jupyter_code>def fermidist(energy, mu, kT):
    """Compute the Fermi distribution at energy, mu and kT."""
    # YOUR CODE HERE
    a = np.array(energy - mu)
    b = np.array(a/kT)
    c = np.array(m.exp(b))
    d = np.array(c+1)
    f = np.array(1/d)
    return f    
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       ]))<jupyter_output><empty_output><jupyter_text>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`.* Use enegies over the range $[0,10.0]$ and a suitable number of points.* Choose an appropriate x and y limit for your visualization.* Label your x and y axis and the overall visualization.* Customize your plot in 3 other ways to make it effective and beautiful.<jupyter_code>def plot_fermidist(mu, kT):
    # YOUR CODE HERE
    a = np.array(mu)
    b = np.array(kT)
    plt.scatter(a, b)
    plt.ylabel('Temperature')
    plt.xlabel('Chemical Potential')
plot_fermidist(4.0, 1.0)
assert True # leave this for grading the plot_fermidist function<jupyter_output><empty_output><jupyter_text>Use `interact` with `plot_fermidist` to explore the distribution:* For `mu` use a floating point slider over the range $[0.0,5.0]$.* for `kT` use a floating point slider over the range $[0.1,10.0]$.<jupyter_code># YOUR CODE HERE
w = interactive(plot_fermidist, mu =(0.0,5.0,0.1), kT=(0.1,10.0,0.1));
w<jupyter_output><empty_output><jupyter_text>Provide complete sentence answers to the following questions in the cell below:* What happens when the temperature $kT$ is low?* What happens when the temperature $kT$ is high?* What is the effect of changing the chemical potential $\mu$?* The number of particles in the system are related to the area under this curve. How does the chemical potential affect the number of particles.Use LaTeX to typeset any mathematical symbols in your answer. YOUR ANSWER HERE<jupyter_code>When kT is low then energy is high and when kT is high then energy is low. 
Lowering the chemical potential would result in a higher energy and raising the chemical potental would result in a lower energy.
A smaller area would result in less particls<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1009150991357397, 'fraction_numerical': 0.04016268429079817, 'mean_word_length': 4.645624103299856, 'pattern_counts': {'":': 0, '<': 26, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '17614', 'license': 'MIT', 'n_tokens_mistral': 1342, 'n_tokens_neox': 1251, 'n_words': 482, 'path': 'assignments/midterm/InteractEx06.ipynb', 'repo_name': 'sraejones/phys202-2015-work', 'size': '3934'}