<jupyter_start><jupyter_text>Chapter 12 - Simple Harmonic OscillatorSome of the tools for using the SHO<jupyter_code>from numpy import sqrt,linspace
from qutip import *
import matplotlib.pyplot as plt
%matplotlib inline
a = destroy(20)
n = a.dag()*a
psi = coherent(20,2)
psi.dag()*n*psi
psi_dm = ket2dm(psi)
plot_fock_distribution(psi_dm)<jupyter_output><empty_output><jupyter_text>Also look at other coherent states:<jupyter_code>plot_fock_distribution(coherent_dm(40,4))<jupyter_output><empty_output><jupyter_text>And some other density matrices, like a fock-state (or n eigenstate):<jupyter_code>plot_fock_distribution(fock_dm(20,2))<jupyter_output><empty_output><jupyter_text>And a thermal state:<jupyter_code>plot_fock_distribution(thermal_dm(20,2))<jupyter_output><empty_output><jupyter_text>Finally, can visualize the phasor using what is called the Wigner function:<jupyter_code>xvec = linspace(-10,10,200) # Create an array for the phase space coordinates.
plt.contourf(xvec, xvec, wigner(coherent_dm(20,2),xvec,xvec),20) # contour plot of Wigner function<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10511882998171847, 'fraction_numerical': 0.026508226691042046, 'mean_word_length': 10.288659793814434, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, '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': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '136783', 'license': 'MIT', 'n_tokens_mistral': 437, 'n_tokens_neox': 406, 'n_words': 80, 'path': 'Chapter 12 - SHO.ipynb', 'repo_name': 'Ashardalon125/Quantum-Resources', 'size': '1094'}