<jupyter_start><jupyter_text>CH162: Quantum Mechanics <NAME>*** Harmonic Oscillator (Lecture 5)In this notebook, we review some of the properties of the classical and quantum harmonic oscillator.  Classical harmonic oscillatorFirst, consider a classical particle moving in a potential $V(x) = \frac{1}{2} kx^{2}$<jupyter_code>import numpy as np
import matplotlib.pyplot as plt
%matplotlib notebook
plt.rcParams['axes.linewidth']=1.5
Length = 4.0
x = np.linspace(-Length,Length,100)
y0 = np.exp(-0.5 * x**2)
y1 = np.exp(-0.5*x**2) * x
y2 = np.exp(-0.5*x**2) * (2*x**2-1)
y3 = np.exp(-0.5*x**2) * (2*x**3-3*x)
plt.plot(x, y0**2, linewidth=2.0)
plt.text(4.1,0,r'n=0',fontsize=18)
plt.plot(x, y1**2 + 2.0, linewidth=2.0)
plt.text(4.1,2,r'n=1',fontsize=18)
plt.plot(x, y2**2 + 4.0, linewidth=2.0)
plt.text(4.1,4,r'n=2',fontsize=18)
plt.plot(x, y3**2 + 6.0, linewidth=2.0)
plt.text(4.1,6,r'n=3',fontsize=18)
plt.plot(x,0.5*x**2,linewidth=2.5,linestyle='dashed',alpha=0.6)

plt.tick_params(axis='both',width=1.5,length=5)
plt.xlabel('x',fontsize=18)
plt.ylabel(r'$P(x)$',fontsize=18)
plt.xlim((-Length,Length))
plt.ylim((0,8))
plt.xticks(fontsize=0)
plt.yticks(fontsize=0)

plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.21706710853355426, 'fraction_numerical': 0.08285004142502071, 'mean_word_length': 6.365853658536586, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '36497', 'license': 'MIT', 'n_tokens_mistral': 602, 'n_tokens_neox': 562, 'n_words': 91, 'path': '.ipynb_checkpoints/HarmonicOscillator-checkpoint.ipynb', 'repo_name': 'ScottHabershon/CH162', 'size': '1216'}