concept-collection / numbl-quantum-optics
numbl-quantum-optics / README.md
4.6 KBPreviewCodeBlameHistoryRaw

Companion to Quantum Optics#

A companion to the tutorial article "Quantum optics in MATLAB" by Nilakantha Meher — arXiv:2309.14354.

The article teaches the basics of theoretical quantum optics through short, self-contained MATLAB scripts: building quantum states and operators as matrices, then using them to compute physical properties and time dynamics. This project collects those examples as runnable numbl scripts so you can execute and edit them directly in your browser — no MATLAB, no install. Pick a script in the panel on the left and click Run. Edits stay in memory for your session.

This README is a guide to which example to open, not a replacement for the article. Read the article for the physics, the equations, and the discussion; come here to run the code. Each numbered script corresponds to one code block in the article, in the same order, and is annotated with its section number. The code is transcribed faithfully from the article; the only additions are axis labels and legends on the plots.

Quantum states (Sec. II)#

Script Article What it shows
ex01_number_states.m II.A Number states |0>, |1>, |2> as columns of the identity matrix
ex02_number_state_20.m II.A A higher number state |20>, and why the dimension d must exceed it
ex03_superposition_state.m II.B A normalized superposition of number states
ex04_coherent_state.m II.C A coherent state |alpha> built by truncating its number-basis sum
ex05_thermal_state.m II.D A thermal state as a diagonal density matrix (mixed state)
ex06_squeezed_vacuum.m II.E A squeezed vacuum state — a superposition of even number states
ex07_nsfcs.m II.F A number-state-filtered coherent state (one Fock state removed)
ex08_atomic_states.m II.G Excited/ground states of a two-level atom and their superposition

Operators (Sec. III)#

Script Article What it shows
ex09_field_operators.m III.A Annihilation, creation and number operators in the number basis
ex10_field_hamiltonian.m III.B The quantized electromagnetic-field Hamiltonian
ex11_pauli_operators.m III.C Pauli sigma_z, raising/lowering operators, two-level-atom Hamiltonian

Properties of quantum states (Sec. IV)#

Script Article What it shows
ex12_photon_distribution.m IV.A Photon-number distributions P_n (bar plots): coherent vs. thermal
ex13_average_photons.m IV.B Average photon number <a'a> for number, coherent, thermal states
ex14_g2_coherence.m IV.C Second-order coherence g^(2)(0): sub-Poissonian, Poissonian, super-Poissonian

Atom–field interaction (Sec. V)#

Script Article What it shows
ex15_atom_field_rabi.m V Jaynes–Cummings vacuum Rabi oscillations P_e(t), P_g(t)
ex16_atomic_inversion.m V Atomic inversion <sigma_z(t)> with a coherent field: collapse and revival

Two-mode field (Sec. VI)#

Script Article What it shows
ex17_coupled_cavities.m VI.A Photon exchange between two coupled cavities P_{10}(t), P_{01}(t)

A few numbl/MATLAB notes#

How it's deployed#

On every push to main, the workflow in .github/workflows/deploy.yml bundles these files with the numbl browser IDE and publishes the result to GitHub Pages — no server, nothing to build by hand. Edit numbl-project.json to change the title or which file opens first.

Reference#

Nilakantha Meher, Quantum optics in MATLAB, arXiv:2309.14354.