Skip to content

Cavity QED Simulation Notebook

A finite Jaynes–Cummings matrix is not automatically a faithful Jaynes–Cummings calculation. The matrix can be Hermitian, the propagated state can keep unit norm, and the total excitation can appear conserved even when the chosen photon cutoff removes appreciable probability or blocks a physically allowed transition at the upper edge of the basis.

This notebook makes the representation error visible. It computes:

  1. the first two dressed doublets across resonance;
  2. resonant vacuum Rabi exchange from ∣e,0⟩|e,0\rangle;
  3. collapse and revival for an initially coherent field with nˉ=16\bar n=16;
  4. a four-cutoff convergence study against an effectively infinite Poisson sum;
  5. an optional unconditional Lindblad model with cavity and emitter loss; and
  6. algebraic, invariant, convergence, trace, Hermiticity, and positivity checks.

The retained headline results are:

DiagnosticComputed valueWhat it tests
largest dressed-energy error5.55×10−17ℏ5.55\times10^{-17}\hbarnumerical versus analytic 2×22\times2 blocks
largest vacuum-Rabi population error4.44×10−164.44\times10^{-16}full tensor-basis propagation
largest vacuum-Rabi excitation drift3.33×10−163.33\times10^{-16}conservation of a†a+σ+σ−a^\dagger a+\sigma_+\sigma_-
N=100N=100 versus infinite Poisson-sum error6.56×10−156.56\times10^{-15}coherent-state reference
largest revival-window inversion0.56110.5611revival resolved near trevt_{\mathrm{rev}}
closed Lindblad-limit population error3.69×10−113.69\times10^{-11}RK4 master-equation propagation
largest density-matrix trace error4.11×10−154.11\times10^{-15}open-system normalization
minimum computed density eigenvalue−3.30×10−12-3.30\times10^{-12}positivity within integration tolerance

The small negative eigenvalue in the last row is reported rather than clipped. Explicit Runge–Kutta propagation is not a completely positive map for an arbitrary time step; the value is a numerical error estimate, not a physical negative probability.

Run the investigation. The program and retained results below support the stated experiment. Follow Running an Experiment for environment and output-directory guidance. The recorded evidence applies to its stated parameters and environment.

This page is the canonical home for the executable calculation that:

  • builds atom–field tensor-product operators in a declared ordering;
  • treats the photon cutoff as a convergence parameter;
  • checks analytic dressed energies and resonance splittings;
  • propagates pure states by Hermitian diagonalization;
  • verifies vacuum Rabi exchange against a closed-form solution;
  • compares finite coherent-state calculations with the untruncated Poisson sum;
  • quantifies both omitted coherent-state weight and observable error;
  • propagates a small unconditional Lindblad equation with explicit RK4; and
  • exports every plotted curve, diagnostic, convention, and limitation.

Neighboring pages retain distinct canonical responsibilities:

  • Jaynes–Cummings Model owns the model derivation, excitation manifolds, exact dressed states, collapse–revival analysis, and physical interpretation.
  • Cavity QED owns the physical coupling gg, cavity linewidth conventions, cooperativity, Purcell regime, strong-coupling criteria, and measured spectra.
  • Dressed States owns the broader concept of eigenstates of an interacting light–matter Hamiltonian.
  • Cavity QED Platforms owns implementation-specific hardware, scales, and noise sources.
  • Quantum Optical Master Equation owns the system–reservoir assumptions behind Markovian radiative loss.
  • Quantum-Jump Trajectories owns states conditioned on a detection record.

The present page verifies a finite-basis forward model. It does not replace those derivations, infer a device from dimensionless curves, or interpret an unconditional density matrix as a single experimental record.

The executable artifact is a NumPy-only Python program:

Run the downloaded program from the folder where you saved it:

Terminal window
python cavity-qed-simulation.py --output-dir results

The default run declares:

ItemChoice
languagePython 3
numerical dependencyNumPy
random numbersnone
closed-dynamics unitsℏ=g=1\hbar=g=1
detuningΔ=ωa−ωc\Delta=\omega_a-\omega_c
atom basis order$[
field basis order$[
tensor orderatom ⊗\otimes field
dressed-spectrum samples401401
vacuum-Rabi samples801801
collapse–revival samples12011201
loss-model samples501501
largest loss-model RK4 step0.0025/g0.0025/g
pure-state propagatorHermitian eigendecomposition
density-matrix propagatorclassical explicit RK4

Odd output-sample counts include both endpoints and the midpoint. There is no random seed, nonlinear fit, adaptive tolerance, hidden plotting dependency, or external quantum-optics package. The JSON artifact records the runtime versions, all checks, physical exclusions, source DOIs, and output names.

The closed calculations assume:

  • one two-level emitter;
  • one bosonic cavity mode;
  • the rotating-wave Jaynes–Cummings interaction;
  • no external drive;
  • no loss, dephasing, thermal photons, or measurement; and
  • an exactly time-independent Hamiltonian.

The optional open calculation adds only Markovian cavity-energy decay and emitter-population decay. It is restricted to the zero- and one-excitation sectors. It does not include pure dephasing, a coherent cavity drive, finite-temperature pumping, non-Markovian reservoirs, input–output fields, detector response, counter-rotating terms, or the diamagnetic contribution needed in some ultrastrong-coupling descriptions.

The generated curves are therefore model benchmarks, not species-specific or device-specific predictions.

The full Jaynes–Cummings Hamiltonian is

HJC=ℏωca†a+ℏωa2σz+ℏg(aσ++a†σ−),H_{\mathrm{JC}} = \hbar\omega_c a^\dagger a + \frac{\hbar\omega_a}{2}\sigma_z + \hbar g \left( a\sigma_+ + a^\dagger\sigma_- \right),

with

Δ=ωa−ωc.\Delta=\omega_a-\omega_c.

Operators acting on different tensor factors commute, so the interaction could equivalently be written with the atom operators first. The program uses atom ⊗\otimes field ordering consistently:

HN=span⁡{∣e,0⟩,…,∣e,N−1⟩,∣g,0⟩,…,∣g,N−1⟩}.\mathcal H_N = \operatorname{span}\{ |e,0\rangle,\ldots,|e,N-1\rangle, |g,0\rangle,\ldots,|g,N-1\rangle \}.

Its vector dimension is 2N2N. A basis index is not meaningful without this ordering declaration.

For closed dynamics, a common excitation-dependent phase can be removed. The program propagates with

HIℏ=Δ2σz⊗IN+g(σ+⊗a+σ−⊗a†).\frac{H_I}{\hbar} = \frac{\Delta}{2}\sigma_z\otimes I_N + g \left( \sigma_+\otimes a + \sigma_-\otimes a^\dagger \right).

This interaction-frame Hamiltonian retains the detuning and exchange dynamics while avoiding a large irrelevant carrier frequency. It gives the same populations and number expectation values as the full Hamiltonian.

Define

N=I2⊗a†a+σ+σ−⊗IN.\mathcal N = I_2\otimes a^\dagger a + \sigma_+\sigma_-\otimes I_N.

For the untruncated Jaynes–Cummings model,

[HJC,N]=0.[H_{\mathrm{JC}},\mathcal N]=0.

Consequently each positive-excitation sector is two-dimensional:

Hn=span⁡{∣e,n⟩, ∣g,n+1⟩},n=0,1,….\mathcal H_n = \operatorname{span} \left\{ |e,n\rangle,\, |g,n+1\rangle \right\}, \qquad n=0,1,\ldots.

This symmetry is both an analytic simplification and a high-value computational diagnostic. During closed propagation the program monitors

δN=max⁡t∣⟨N⟩t−⟨N⟩0∣.\delta_{\mathcal N} = \max_t \left| \langle\mathcal N\rangle_t - \langle\mathcal N\rangle_0 \right|.

A small drift tests the propagator and operator assembly. It does not prove that NN is large enough, because the truncated Hamiltonian can conserve its own truncated excitation operator.

The cutoff NN means that the retained photon numbers are

n=0,1,…,N−1.n=0,1,\ldots,N-1.

The annihilation matrix is

aN=∑n=1N−1n ∣n−1⟩⟨n∣.a_N = \sum_{n=1}^{N-1} \sqrt n\,|n-1\rangle\langle n|.

In NumPy this is:

a = np.zeros((N, N), dtype=complex)
for n in range(1, N):
a[n - 1, n] = np.sqrt(n)
adag = a.conj().T

The main tensor operators then have the explicit forms

H = (
0.5 * delta * np.kron(sigma_z, identity_field)
+ g
* (
np.kron(sigma_plus, a)
+ np.kron(sigma_minus, adag)
)
)

The code never infers tensor ordering from dimensions. That restraint avoids a particularly quiet error: two matrices can have the expected shape while acting on the wrong subsystems.

Finite oscillator matrices do not satisfy the canonical commutator exactly:

[aN,aN†]=IN−N∣N−1⟩⟨N−1∣.[a_N,a_N^\dagger] = I_N-N|N-1\rangle\langle N-1|.

The deviation is localized at the highest retained number state. In the Jaynes–Cummings interaction, the state

∣e,N−1⟩|e,N-1\rangle

should couple to the omitted state ∣g,N⟩|g,N\rangle. The finite matrix blocks that transition. Therefore a calculation can fail before the omitted tail looks visually dramatic.

This is why the notebook reports three distinct diagnostics:

  1. omitted initial probability above the cutoff;
  2. observable error against an effectively infinite reference; and
  3. invariant and norm errors within the retained space.

No one of them substitutes for the others.

For a coherent state with amplitude α\alpha,

∣α⟩=e−∣α∣2/2∑n=0∞αnn!∣n⟩,nˉ=∣α∣2.|\alpha\rangle = e^{-|\alpha|^2/2} \sum_{n=0}^{\infty} \frac{\alpha^n}{\sqrt{n!}}|n\rangle, \qquad \bar n=|\alpha|^2.

A finite vector commonly retains the first NN coefficients and then renormalizes them. Its norm is exactly one after renormalization even if a large part of the physical Poisson distribution was discarded. The omitted weight

qN=∑n=N∞e−nˉnˉnn!q_N = \sum_{n=N}^{\infty} e^{-\bar n} \frac{\bar n^n}{n!}

must be computed before renormalization.

The canonical derivation lives on the Jaynes–Cummings Model page. For computational verification, restrict the full Hamiltonian to Hn\mathcal H_n and subtract its common center:

Bnℏ=12(Δ2gn+12gn+1−Δ).\frac{B_n}{\hbar} = \frac12 \begin{pmatrix} \Delta & 2g\sqrt{n+1}\\ 2g\sqrt{n+1} & -\Delta \end{pmatrix}.

The two shifts are

εn,±=±12Ωn,Ωn=Δ2+4g2(n+1).\varepsilon_{n,\pm} = \pm\frac12\Omega_n, \qquad \Omega_n = \sqrt{\Delta^2+4g^2(n+1)}.

Restoring the common energy gives

En,±=ℏωc(n+12)+ℏεn,±.E_{n,\pm} = \hbar\omega_c \left( n+\frac12 \right) + \hbar\varepsilon_{n,\pm}.

At resonance,

En,+−En,−=2ℏgn+1.E_{n,+}-E_{n,-} = 2\hbar g\sqrt{n+1}.

The square-root scaling distinguishes successive excitation manifolds.

The spectrum calculation uses:

QuantityValue
cavity frequencyωc=1\omega_c=1
couplingg=0.1g=0.1
detuning interval−6≤Δ/g≤6-6\le\Delta/g\le6
manifoldsn=0,1n=0,1
detuning samples401401

At each detuning, numpy.linalg.eigh diagonalizes the Hermitian 2×22\times2 block. The program:

  • sorts the eigenvalues in ascending order;
  • compares them with ±Ωn/2\pm\Omega_n/2;
  • verifies the eigenvector Gram matrix;
  • records the ∣e,n⟩|e,n\rangle fraction of each eigenvector; and
  • checks both resonance gaps.

The largest energy difference is

5.55×10−17ℏ,5.55\times10^{-17}\hbar,

and the largest orthonormality error is

4.44×10−16.4.44\times10^{-16}.

The computed resonance-gap errors are

∣δΩ0∣=5.55×10−17,∣δΩ1∣=1.67×10−16.\begin{aligned} \left|\delta\Omega_0\right| &=5.55\times10^{-17},\\ \left|\delta\Omega_1\right| &=1.67\times10^{-16}. \end{aligned}

These are floating-point roundoff checks, not evidence that an arbitrary cavity is described exactly by the Jaynes–Cummings Hamiltonian.

Numerical eigenvectors have arbitrary overall phases. Across an avoided crossing, a phase can flip from one sample to the next without changing any observable. Comparing raw vector components is therefore fragile.

The program compares:

  • eigenvalues;
  • orthonormality;
  • resonance splittings; and
  • phase-insensitive component probabilities.

Far from resonance, the lower and upper dressed states approach opposite bare characters on the two sides of the crossing. A label such as “mostly atomic” cannot remain attached to one energy branch across the entire scan.

Set Δ=0\Delta=0 and prepare

∣ψ(0)⟩=∣e,0⟩.|\psi(0)\rangle=|e,0\rangle.

Only the one-excitation manifold is occupied. Its exact evolution is

∣ψ(t)⟩=cos⁡(gt)∣e,0⟩−isin⁡(gt)∣g,1⟩.|\psi(t)\rangle = \cos(gt)|e,0\rangle - i\sin(gt)|g,1\rangle.

Therefore

Pe(t)=cos⁡2(gt),⟨a†a⟩t=sin⁡2(gt),⟨N⟩t=1.\begin{aligned} P_e(t) &= \cos^2(gt),\\ \langle a^\dagger a\rangle_t &= \sin^2(gt),\\ \langle\mathcal N\rangle_t &= 1. \end{aligned}

The oscillation is a coherent exchange of one excitation between emitter and field. It occurs even when the cavity begins in the vacuum; “vacuum” does not mean that the interaction matrix element vanishes.

This benchmark intentionally uses the 2N2N tensor-product Hamiltonian with N=4N=4, not the hand-written 2×22\times2 block. A Hermitian eigendecomposition

HI=V diag⁡(Ej) V†H_I=V\,\operatorname{diag}(E_j)\,V^\dagger

gives

∣ψ(t)⟩=V diag⁡(e−iEjt/ℏ)V†∣ψ(0)⟩.|\psi(t)\rangle = V\, \operatorname{diag} \left( e^{-iE_jt/\hbar} \right) V^\dagger|\psi(0)\rangle.

The calculation samples

0≤gt≤4π0\le gt\le4\pi

at 801801 points. It tests the assembly of the full operator, initial basis index, projection onto the excited atom, number operator, and total excitation operator.

CheckMaximum error
Pe(t)P_e(t) versus cos⁡2(gt)\cos^2(gt)4.44×10−164.44\times10^{-16}
⟨n⟩t\langle n\rangle_t versus sin⁡2(gt)\sin^2(gt)4.44×10−164.44\times10^{-16}
Pe+⟨n⟩=1P_e+\langle n\rangle=16.66×10−166.66\times10^{-16}
state norm6.66×10−166.66\times10^{-16}
total excitation3.33×10−163.33\times10^{-16}

Agreement at this level is expected because the Hamiltonian is time-independent and the eigendecomposition evaluates its exponential directly. The benchmark would be less stringent if it checked only the oscillation frequency: a swapped projector could produce the right frequency and the wrong observable.

Now prepare

∣ψ(0)⟩=∣e⟩⊗∣α⟩,nˉ=∣α∣2=16.|\psi(0)\rangle = |e\rangle\otimes|\alpha\rangle, \qquad \bar n=|\alpha|^2=16.

Each photon-number component evolves with its own resonant Rabi frequency,

Ωn=2gn+1.\Omega_n=2g\sqrt{n+1}.

The atomic inversion is

W(t)=⟨σz⟩t=∑n=0∞Pncos⁡(2gn+1 t),W(t) = \langle\sigma_z\rangle_t = \sum_{n=0}^{\infty} P_n \cos \left( 2g\sqrt{n+1}\,t \right),

where

Pn=e−nˉnˉnn!,Pe(t)=1+W(t)2.P_n = e^{-\bar n} \frac{\bar n^n}{n!}, \qquad P_e(t) = \frac{1+W(t)}{2}.

The program evaluates this infinite-sum reference through n=199n=199. At nˉ=16\bar n=16, the remaining Poisson tail is negligible at double precision.

The initial number components begin in phase. Because n+1\sqrt{n+1} is nonlinear in nn, their oscillations acquire different phases and the weighted sum loses contrast. The full atom–field state still evolves unitarily and remains pure.

The word collapse here means collapse of the summed Rabi-oscillation envelope. It is not:

  • projective state reduction;
  • norm loss;
  • environmental decoherence; or
  • failure of deterministic Schrödinger evolution.

The atom alone can become mixed because it is entangled with the field. That reduced-state mixing is compatible with a pure joint state.

Expanding the frequency about the Poisson peak gives

2gn+1≈2gnˉ+gnˉ(n−nˉ).2g\sqrt{n+1} \approx 2g\sqrt{\bar n} + \frac{g}{\sqrt{\bar n}} (n-\bar n).

Neighboring number components rephase when their relative phase is about 2π2\pi, giving

trev≈2πnˉg.t_{\mathrm{rev}} \approx \frac{2\pi\sqrt{\bar n}}{g}.

For nˉ=16\bar n=16,

gtrev≈8π=25.1327.gt_{\mathrm{rev}} \approx 8\pi = 25.1327.

The conventional short-time Gaussian estimate gives the 1/e1/e collapse scale

tcol≈2g.t_{\mathrm{col}} \approx \frac{\sqrt2}{g}.

These are asymptotic envelope estimates, not exact event definitions. The computed largest ∣W∣|W| in the interval 0.75trev≤t≤1.25trev0.75t_{\mathrm{rev}}\le t\le1.25t_{\mathrm{rev}} is

∣W∣max⁡=0.5611|W|_{\max}=0.5611

at

gt=25.5977.gt=25.5977.

The peak need not occur exactly at the leading-order estimate.

The coherent calculation is repeated with

N=20, 30, 40, 60,N=20,\ 30,\ 40,\ 60,

and compared with both:

  • a tensor-basis calculation at N=100N=100; and
  • the effectively infinite Poisson sum.

The reported cutoff NN is the vector dimension of the field factor, so the highest retained number is N−1N-1.

| NN | Highest nn | Omitted Poisson weight qNq_N | Maximum ∣WN−W100∣|W_N-W_{100}| | Maximum ∣WN−W∞∣|W_N-W_\infty| | | ---: | ---: | ---: | ---: | ---: | | 2020 | 1919 | 1.8775×10−11.8775\times10^{-1} | 3.4987×10−13.4987\times10^{-1} | 3.4987×10−13.4987\times10^{-1} | | 3030 | 2929 | 1.1312×10−31.1312\times10^{-3} | 3.8737×10−33.8737\times10^{-3} | 3.8737×10−33.8737\times10^{-3} | | 4040 | 3939 | 3.2761×10−73.2761\times10^{-7} | 1.5730×10−61.5730\times10^{-6} | 1.5730×10−61.5730\times10^{-6} | | 6060 | 5959 | 2.2204×10−162.2204\times10^{-16} | 2.2204×10−162.2204\times10^{-16} | 6.3421×10−156.3421\times10^{-15} |

The error decreases monotonically over this sequence. The N=100N=100 calculation agrees with the Poisson sum to

6.56×10−15.6.56\times10^{-15}.

Why the observable error can exceed the tail

Section titled “Why the observable error can exceed the tail”

For a bounded observable, omitted probability suggests a useful scale, but it is not an exact error formula for this finite-matrix calculation. Two effects occur:

  1. the retained coherent-state coefficients are renormalized; and
  2. the top state ∣e,N−1⟩|e,N-1\rangle cannot exchange its excitation with the omitted state ∣g,N⟩|g,N\rangle.

At N=30N=30, for example,

q30=1.13×10−3,q_{30}=1.13\times10^{-3},

while the maximum inversion error is

3.87×10−3.3.87\times10^{-3}.

Reporting only the initial tail would understate the measured error.

Choose a cutoff for the observable and time window

Section titled “Choose a cutoff for the observable and time window”

A cutoff is not globally “converged.” It is converged for:

  • a declared initial state;
  • a declared Hamiltonian;
  • a declared observable;
  • a declared time interval; and
  • a declared tolerance.

A driven cavity can populate higher photon numbers at late times even if its initial vacuum state needs almost no field basis. A cutoff accepted for vacuum Rabi exchange therefore says little about a driven steady state.

To demonstrate the transition from a pure-state Hamiltonian calculation to an unconditional open-system calculation, the notebook also solves

ρ˙=−iℏ[HI,ρ]+κD[a]ρ+γD[σ−]ρ,\dot\rho = -\frac{i}{\hbar}[H_I,\rho] + \kappa\mathcal D[a]\rho + \gamma\mathcal D[\sigma_-]\rho,

with

D[L]ρ=LρL†−12{L†L,ρ}.\mathcal D[L]\rho = L\rho L^\dagger - \frac12 \left\{ L^\dagger L,\rho \right\}.

The extension is resonant, begins in ∣e,0⟩|e,0\rangle, uses N=2N=2, and includes the joint ground state ∣g,0⟩|g,0\rangle. Because there is no drive and at most one initial excitation, no higher photon state is dynamically required.

Here:

  • κ\kappa is the cavity energy-decay rate;
  • γ\gamma is the emitter population-decay rate.

For an empty cavity,

⟨n(t)⟩=e−κt⟨n(0)⟩,\langle n(t)\rangle = e^{-\kappa t}\langle n(0)\rangle,

while its field amplitude decays as

⟨a(t)⟩=e−κt/2⟨a(0)⟩.\langle a(t)\rangle = e^{-\kappa t/2}\langle a(0)\rangle.

Some literature uses κ\kappa for the field-amplitude half-width. Translate the convention before comparing plots, cooperativities, or strong-coupling criteria. The Cavity QED page keeps the same energy-decay convention used here.

The master equation averages over all unobserved reservoir records. Population leaving the one-excitation sector accumulates in ∣g,0⟩⟨g,0∣|g,0\rangle\langle g,0|, and the density-matrix trace remains one.

This is not the evolution under the non-Hermitian effective Hamiltonian

Heff=HI−iℏ2(κa†a+γσ+σ−).H_{\mathrm{eff}} = H_I - \frac{i\hbar}{2} \left( \kappa a^\dagger a + \gamma\sigma_+\sigma_- \right).

That Hamiltonian alone describes an unnormalized no-jump branch. Turning its norm loss into unconditional population loss without restoring jumps mixes two different physical questions.

The program propagates:

Caseκ/g\kappa/gγ/g\gamma/gPurpose
closed0000recover unitary vacuum Rabi exchange
balanced0.20.20.20.2equal decay rate for either location of the excitation
leaky cavity110.20.2damp exchange strongly through the cavity

For the balanced case,

ddt⟨N⟩=−0.2g⟨N⟩,\frac{d}{dt}\langle\mathcal N\rangle = -0.2g\langle\mathcal N\rangle,

because both possible excitation locations decay at the same rate. Consequently

⟨N(10/g)⟩=e−2=0.1353353,\langle\mathcal N(10/g)\rangle = e^{-2} = 0.1353353,

which matches the computed value.

For the leaky-cavity case, the retained final total excitation is

⟨N(10/g)⟩=0.00284975.\langle\mathcal N(10/g)\rangle = 0.00284975.

The number is a property of this dimensionless toy model, not a universal cavity-QED decay law.

The density matrix is advanced directly with classical fourth-order Runge–Kutta using an internal step no larger than

h=0.0025/g.h=0.0025/g.

At every output time the program evaluates:

ϵtr=∣Tr⁡ρ−1∣,ϵH=∥ρ−ρ†∥max⁡,λmin⁡=min⁡eigvalsh⁡(ρ+ρ†2).\begin{aligned} \epsilon_{\mathrm{tr}} &= \left|\operatorname{Tr}\rho-1\right|,\\ \epsilon_{\mathrm{H}} &= \|\rho-\rho^\dagger\|_{\max},\\ \lambda_{\min} &= \min\operatorname{eigvalsh} \left( \frac{\rho+\rho^\dagger}{2} \right). \end{aligned}

The retained results are:

CheckValue
closed RK4 population error3.69×10−113.69\times10^{-11}
largest trace error4.11×10−154.11\times10^{-15}
largest Hermiticity error00
minimum density eigenvalue−3.30×10−12-3.30\times10^{-12}

The positivity tolerance is −10−10-10^{-10}, so the run passes. A production calculation should also refine the step and, where appropriate, compare with a positivity-preserving or exponential integrator.

Four numerical cavity-QED benchmarks: a dressed avoided crossing, vacuum Rabi exchange, coherent-state collapse and revival, and lossy unconditional dynamics.

Generated benchmarks. (a) The n=0n=0 dressed shifts avoid the crossing of the bare branches, with a resonant gap 2g2g. (b) One excitation exchanges coherently between ∣e,0⟩|e,0\rangle and ∣g,1⟩|g,1\rangle. (c) A coherent field with nˉ=16\bar n=16 shows unitary collapse and revival; the visibly displaced N=20N=20 curve exposes an inadequate photon cutoff, while N=30N=30 is closer but not converged to high precision. (d) Unconditional Lindblad loss damps the exchange and transfers weight to ∣g,0⟩|g,0\rangle. Every curve is read from the downloadable CSV artifacts.

The figure is a summary, not a convergence certificate. In panel (c), the N=40N=40 and N=60N=60 curves would be visually indistinguishable from the Poisson sum at this scale, yet their numerical errors differ by nine orders of magnitude.

The calculation uses independent checks with different failure sensitivity.

  • H=H†H=H^\dagger;
  • eigenvectors are orthonormal;
  • analytic and numerical 2×22\times2 eigenvalues agree; and
  • resonance gaps follow 2gn+12g\sqrt{n+1}.

These checks catch sign, square-root, and basis-order errors before time propagation.

  • vacuum Pe(t)=cos⁡2(gt)P_e(t)=\cos^2(gt);
  • vacuum ⟨n⟩t=sin⁡2(gt)\langle n\rangle_t=\sin^2(gt);
  • Pe+⟨n⟩=1P_e+\langle n\rangle=1; and
  • ⟨N⟩\langle\mathcal N\rangle is constant.

Matching two complementary observables is stronger than matching one.

  • compute the omitted Poisson weight;
  • repeat at increasing NN;
  • compare the target observable over the full time window; and
  • compare with a structurally independent Poisson sum.

This level catches a perfectly unitary calculation in an inadequate basis.

  • recover the closed limit;
  • preserve trace;
  • preserve Hermiticity;
  • monitor the smallest density eigenvalue; and
  • verify that loss reduces total excitation.

Trace preservation alone would not catch a nonpositive density matrix.

Error sourcePresent in which calculation?Diagnostic or control
two-level reductionalloutside numerical convergence; compare with multilevel physics
rotating-wave approximationalloutside cutoff convergence; compare with a Rabi-model extension
single-mode approximationallinspect cavity spectrum and coupling to other modes
photon cutoffcoherent-state runsomitted tail plus observable convergence
top-edge blockingcoherent-state runscompare with Poisson sum and raise NN
floating-point diagonalizationclosed runsanalytic spectra, norms, invariants
output-time samplingrevival peak reportrefine sample grid or optimize locally
RK4 time steploss extensionclosed limit and step refinement
Markovian decay modelloss extensionmodel assumption, not a solver error
missing detector modelloss extensiondo not call κ⟨n⟩\kappa\langle n\rangle a measured count record without efficiencies and filtering

Errors on different rows need different convergence campaigns. Increasing NN does not repair the rotating-wave approximation; decreasing the RK4 step does not add omitted cavity modes.

The program separates physics construction from output and validation:

  1. operator constructors build aa, a†aa^\dagger a, HIH_I, HJCH_{\mathrm{JC}}, N\mathcal N, and observables;
  2. basis-state and coherent-state constructors define initial vectors;
  3. a Hermitian spectral propagator evaluates all closed trajectories;
  4. dedicated routines produce dressed, vacuum, revival, and cutoff rows;
  5. a direct density-matrix RK4 routine produces the loss extension;
  6. validators reject failed tolerances before metadata is written; and
  7. CSV and JSON writers serialize deterministic outputs.

The code uses numpy.linalg.eigh for Hermitian matrices and numpy.linalg.eigvalsh for Hermitian density-matrix spectra. General eigensolvers would discard useful structure and can introduce avoidable complex roundoff into real eigenvalues.

For a time-independent Hermitian matrix, spectral propagation is:

  • exact up to floating-point diagonalization and phase evaluation;
  • unitary by construction to roundoff;
  • efficient when many output times share one Hamiltonian; and
  • easy to benchmark analytically.

It is not the default answer for:

  • a strongly time-dependent drive;
  • a very large sparse field basis;
  • many emitters;
  • a non-Hermitian generator; or
  • a Liouvillian whose dense matrix scales as the square of Hilbert-space dimension.

The Time-Dependent Two-Level Systems Notebook develops explicit time stepping for driven Hamiltonians, while Solving Lindblad Equations maps broader open-system strategies.

The CSV artifacts preserve more than the plotted columns:

FileSelected columns
dressed spectrumΔ/g\Delta/g, both branch energies, centered shifts, atomic fractions, analytic shifts for n=0,1n=0,1
vacuum Rabigtgt, gt/πgt/\pi, numerical and analytic PeP_e, numerical and analytic ⟨n⟩\langle n\rangle, total excitation
collapse–revivalgtgt, t/trevt/t_{\mathrm{rev}}, infinite-sum WW, PeP_e, and all four finite-cutoff curves
truncationNN, highest nn, omitted tail, errors versus N=100N=100 and infinite sum, norm and excitation drift
lossgtgt, PeP_e, ⟨n⟩\langle n\rangle, total excitation, κ/g\kappa/g, and γ/g\gamma/g for every case

The metadata artifact records definitions and limitations that do not fit naturally into numeric columns. A figure can be regenerated without reverse-engineering its assumptions from line colors.

Within the declared model and tolerances, the outputs establish that:

  • the tensor and manifold formulations agree;
  • dressed doublets have the expected avoided crossings and square-root splittings;
  • the vacuum exchanges one excitation coherently;
  • a coherent photon-number distribution produces collapse and revival;
  • the finite oscillator converges systematically for the selected observable and time window; and
  • a small Lindblad extension recovers the closed limit and remains physical within its integration tolerance.

The outputs do not establish:

  • the validity of the two-level approximation for a particular emitter;
  • the validity of the rotating-wave approximation at arbitrary g/ωcg/\omega_c;
  • strong coupling in a real device;
  • a measured transmission or fluorescence spectrum;
  • single-shot quantum jumps;
  • nonclassicality from the inversion curve alone;
  • convergence of a driven high-photon steady state; or
  • agreement with an experiment that was not included in the model.

An avoided crossing is consistent with hybridization, but a measured avoided crossing needs a forward model including drive, damping, ports, and detector response before fitted parameters receive a cavity-QED interpretation.

Calling the cutoff the maximum photon number

Section titled “Calling the cutoff the maximum photon number”

In this notebook, NN is the field-space dimension. The largest retained number is N−1N-1.

Renormalizing a truncated coherent state forces its norm to one. This says nothing about omitted probability.

Top-edge blocking can amplify observable error beyond the initial tail scale. Compare the observable itself.

A single finite answer has no demonstrated representation convergence. Retain a sequence and a quantitative acceptance rule.

kron(atom, field) and kron(field, atom) have the same dimensions but different index meanings. Projectors and initial states must use the same ordering as the Hamiltonian.

The coupling in manifold nn is gn+1g\sqrt{n+1}, not g(n+1)g(n+1) and not a constant gg.

Here the resonance energy gap and population angular frequency in manifold nn are

Ωn=2gn+1.\Omega_n=2g\sqrt{n+1}.

The vacuum excited population is cos⁡2(gt)\cos^2(gt). A source that calls gg the Rabi frequency is using a different convention.

The collapse in the coherent-state curve results from reversible dephasing among number sectors. The revival is precisely the evidence that the phases were not irreversibly erased by the model.

This notebook uses Δ=ωa−ωc\Delta=\omega_a-\omega_c. Translate formulas that use ωc−ωa\omega_c-\omega_a before comparing eigenvector composition or dispersive shifts.

With this page’s convention, κ\kappa damps photon number as e−κte^{-\kappa t} and field amplitude as e−κt/2e^{-\kappa t/2}.

Using a no-jump Hamiltonian as an unconditional model

Section titled “Using a no-jump Hamiltonian as an unconditional model”

Non-Hermitian norm loss is a conditional survival probability. The unconditional master equation includes recycling terms.

Clipping can hide an unstable integrator. Report the minimum eigenvalue, refine the step, and use a suitable propagator if the violation is not negligible.

Set Δ≠0\Delta\ne0 and compare the numerical one-excitation result with

Pe(t)=1−4g2Δ2+4g2sin⁡2(12Δ2+4g2 t).P_e(t) = 1 - \frac{4g^2}{\Delta^2+4g^2} \sin^2 \left( \frac12 \sqrt{\Delta^2+4g^2}\,t \right).

This adds a simultaneous test of oscillation frequency and contrast.

Adding a term such as

Hd=iℏ(ηa†−η∗a)H_d = i\hbar \left( \eta a^\dagger-\eta^*a \right)

destroys excitation-number conservation and makes the photon cutoff dynamical. Convergence must then cover drive strength, transient duration, and steady-state photon distribution.

A port-resolved model can connect the intracavity field to outgoing modes. Transmission, reflection, and detected count rates require coupling fractions, interference with incident fields, collection efficiency, bandwidth, and noise. Intracavity ⟨n⟩\langle n\rangle alone is not a measured spectrum.

Replace the interaction with the quantum Rabi form

Hint=ℏg(a+a†)σx.H_{\mathrm{int}} = \hbar g \left( a+a^\dagger \right) \sigma_x.

Then N\mathcal N is not conserved, the ground state is dressed, and photon cutoff requirements change. Gauge consistency and diamagnetic terms can matter in ultrastrong-coupling regimes; this is a model change, not merely a larger matrix calculation.

The same Lindblad equation can be unraveled into stochastic quantum-jump records. Ensemble averages should recover the unconditional density matrix within sampling error. The Quantum-Jump Simulation page develops that numerical distinction.

Show that

N=a†a+σ+σ−\mathcal N = a^\dagger a+\sigma_+\sigma_-

commutes with the Jaynes–Cummings Hamiltonian. Explain why this does not guarantee photon-cutoff convergence.

Solution

The free terms are functions of a†aa^\dagger a and σz\sigma_z, so they commute with N\mathcal N. For the exchange terms, use

[a†a,a]=−a,[a†a,a†]=a†,[a^\dagger a,a]=-a, \qquad [a^\dagger a,a^\dagger]=a^\dagger,

and

[σ+σ−,σ+]=σ+,[σ+σ−,σ−]=−σ−.[\sigma_+\sigma_-,\sigma_+]=\sigma_+, \qquad [\sigma_+\sigma_-,\sigma_-]=-\sigma_-.

Then

[N,aσ+]=−aσ++aσ+=0,[N,a†σ−]=a†σ−−a†σ−=0.\begin{aligned} [\mathcal N,a\sigma_+] &= -a\sigma_+ + a\sigma_+ =0,\\ [\mathcal N,a^\dagger\sigma_-] &= a^\dagger\sigma_- - a^\dagger\sigma_- =0. \end{aligned}

Hence [HJC,N]=0[H_{\mathrm{JC}},\mathcal N]=0.

After truncation, the finite Hamiltonian can still commute with the finite version of N\mathcal N. That identity tests internal consistency but not whether appreciable physical amplitude reaches the upper boundary. Cutoff convergence requires increasing NN and comparing the target observable.

Diagonalize

Bn/ℏ=12(Δ2gn+12gn+1−Δ)B_n/\hbar = \frac12 \begin{pmatrix} \Delta&2g\sqrt{n+1}\\ 2g\sqrt{n+1}&-\Delta \end{pmatrix}

and find its resonant splitting.

Solution

The characteristic equation is

det⁡(Bnℏ−εI)=ε2−Δ24−g2(n+1)=0.\det \left( \frac{B_n}{\hbar}-\varepsilon I \right) = \varepsilon^2 - \frac{\Delta^2}{4} - g^2(n+1) =0.

Thus

εn,±=±12Δ2+4g2(n+1).\varepsilon_{n,\pm} = \pm\frac12 \sqrt{\Delta^2+4g^2(n+1)}.

At Δ=0\Delta=0,

εn,±=±gn+1,\varepsilon_{n,\pm} = \pm g\sqrt{n+1},

so

En,+−En,−=2ℏgn+1.E_{n,+}-E_{n,-} = 2\hbar g\sqrt{n+1}.

The common manifold center cancels from the splitting.

Starting from ∣e,0⟩|e,0\rangle at resonance, derive the state and show that Pe+⟨n⟩=1P_e+\langle n\rangle=1.

Solution

In the ordered basis {∣e,0⟩,∣g,1⟩}\{|e,0\rangle,|g,1\rangle\},

HI/ℏ=(0gg0)=gσx.H_I/\hbar = \begin{pmatrix} 0&g\\ g&0 \end{pmatrix} = g\sigma_x.

Therefore

e−iHIt/ℏ=cos⁡(gt)I−isin⁡(gt)σx.e^{-iH_It/\hbar} = \cos(gt)I-i\sin(gt)\sigma_x.

Acting on the first basis vector gives

∣ψ(t)⟩=cos⁡(gt)∣e,0⟩−isin⁡(gt)∣g,1⟩.|\psi(t)\rangle = \cos(gt)|e,0\rangle - i\sin(gt)|g,1\rangle.

Hence

Pe=cos⁡2(gt),⟨n⟩=sin⁡2(gt),P_e=\cos^2(gt), \qquad \langle n\rangle=\sin^2(gt),

and their sum is one. This equality expresses conservation of the single initial excitation.

Let qNq_N be the coherent-state probability above the cutoff. Show that the expectation of any observable fn∈[−1,1]f_n\in[-1,1] under the renormalized conditional Poisson distribution differs from the full Poisson expectation by at most 2qN2q_N. Why can the finite Jaynes–Cummings matrix exceed this bound?

Solution

Write the full distribution as

P=(1−qN)Pin+qNPout,P=(1-q_N)P_{\mathrm{in}}+q_NP_{\mathrm{out}},

where PinP_{\mathrm{in}} is the normalized conditional distribution for n<Nn<N. Then

⟨f⟩P=(1−qN)⟨f⟩in+qN⟨f⟩out.\langle f\rangle_P = (1-q_N)\langle f\rangle_{\mathrm{in}} + q_N\langle f\rangle_{\mathrm{out}}.

Therefore

∣⟨f⟩in−⟨f⟩P∣=qN∣⟨f⟩in−⟨f⟩out∣≤2qN.\left| \langle f\rangle_{\mathrm{in}} - \langle f\rangle_P \right| = q_N \left| \langle f\rangle_{\mathrm{in}} - \langle f\rangle_{\mathrm{out}} \right| \le 2q_N.

This bound assumes that every retained component evolves with its correct function fn(t)f_n(t). The finite Jaynes–Cummings matrix violates that assumption for ∣e,N−1⟩|e,N-1\rangle: its partner ∣g,N⟩|g,N\rangle is absent, so the upper-edge component has the wrong dynamics. The total finite-matrix error can therefore exceed 2qN2q_N, as the N=30N=30 result does over part of the retained time window.

Use the difference between neighboring Rabi frequencies near nˉ\bar n to derive the leading revival time. Evaluate it for nˉ=16\bar n=16.

Solution

The resonant frequencies are

Ωn=2gn+1.\Omega_n=2g\sqrt{n+1}.

Near a large nˉ\bar n,

Ωn+1−Ωn≈dΩndn∣nˉ≈gnˉ.\Omega_{n+1}-\Omega_n \approx \frac{d\Omega_n}{dn} \bigg|_{\bar n} \approx \frac{g}{\sqrt{\bar n}}.

Neighboring components rephase when

(Ωn+1−Ωn)trev≈2π.\left( \Omega_{n+1}-\Omega_n \right)t_{\mathrm{rev}} \approx 2\pi.

Thus

trev≈2πnˉg.t_{\mathrm{rev}} \approx \frac{2\pi\sqrt{\bar n}}{g}.

For nˉ=16\bar n=16,

gtrev≈2π(4)=8π≈25.1327.gt_{\mathrm{rev}} \approx 2\pi(4) = 8\pi \approx 25.1327.

The computed revival-envelope maximum occurs nearby, not exactly at this leading-order estimate.

6. Explain collapse without environmental decoherence

Section titled “6. Explain collapse without environmental decoherence”

The atomic inversion nearly vanishes during the collapse region even though the full state is pure. Reconcile these statements.

Solution

The joint state has the schematic form

∣Ψ(t)⟩=∑ncn[cos⁡(gn+1 t)∣e,n⟩−isin⁡(gn+1 t)∣g,n+1⟩].|\Psi(t)\rangle = \sum_n c_n \left[ \cos \left( g\sqrt{n+1}\,t \right)|e,n\rangle - i\sin \left( g\sqrt{n+1}\,t \right)|g,n+1\rangle \right].

Each number sector evolves coherently, and the joint state remains a unit vector produced by a unitary operator. The inversion is a weighted sum of oscillatory terms with different frequencies. Those terms dephase and cancel without losing their phases.

Tracing out the field can yield a mixed atomic density matrix because the atom is entangled with distinguishable field states. That is subsystem mixing, not impurity of the joint state. Later rephasing produces the revival, which would not occur under irreversible phase erasure in this closed model.

For κ=γ=Γd\kappa=\gamma=\Gamma_d and no drive, show that

⟨N(t)⟩=e−Γdt⟨N(0)⟩.\langle\mathcal N(t)\rangle = e^{-\Gamma_dt} \langle\mathcal N(0)\rangle.
Solution

The Hamiltonian exchange conserves N\mathcal N. A cavity jump aa removes one excitation whenever the excitation is photonic, and an emitter jump σ−\sigma_- removes one whenever it is atomic. The adjoint Lindblad equation therefore gives

ddt⟨N⟩=−κ⟨a†a⟩−γ⟨σ+σ−⟩.\frac{d}{dt}\langle\mathcal N\rangle = -\kappa\langle a^\dagger a\rangle - \gamma \langle\sigma_+\sigma_-\rangle.

When κ=γ=Γd\kappa=\gamma=\Gamma_d,

ddt⟨N⟩=−Γd⟨a†a+σ+σ−⟩=−Γd⟨N⟩.\frac{d}{dt}\langle\mathcal N\rangle = -\Gamma_d \left\langle a^\dagger a+\sigma_+\sigma_- \right\rangle = -\Gamma_d\langle\mathcal N\rangle.

Solving this scalar equation gives the stated exponential. With Γd=0.2g\Gamma_d=0.2g, t=10/gt=10/g, and one initial excitation, the result is e−2=0.1353353e^{-2}=0.1353353.

The retained RK4 run has λmin⁡=−3.30×10−12\lambda_{\min}=-3.30\times10^{-12}. Describe a test that distinguishes time-step error from a physical or implementation error.

Solution

Repeat the same calculation with maximum internal steps

h,h/2,h/4,h,\quad h/2,\quad h/4,

without clipping or renormalizing the density matrix. For each run retain:

  • the minimum eigenvalue over time;
  • the largest trace and Hermiticity errors;
  • the maximum difference in Pe(t)P_e(t) from the finest run; and
  • the closed-limit analytic error.

In the asymptotic RK4 regime, observable differences should decrease by about 24=162^4=16 when the step is halved. The small negative eigenvalue should move toward zero if it is a discretization artifact. Failure to converge, a violation that stays large, or a trace-preserving but increasingly negative state points to a generator, basis, or implementation error.

A completely positive exponential or splitting method provides a useful cross-formulation check, but agreement still needs time-step and representation tests.

Suppose a coherent cavity drive is added. Give an acceptance protocol for the photon cutoff that is stronger than requiring ⟨n⟩≪N\langle n\rangle\ll N.

Solution

A defensible protocol should:

  1. declare the drive, detuning, loss rates, initial state, time window, and target observables;
  2. run an increasing sequence such as NN, N+ΔNN+\Delta N, and N+2ΔNN+2\Delta N;
  3. compare the full time series or steady-state values of all reported observables;
  4. inspect the upper-edge probability ∑n=N−mN−1Pn\sum_{n=N-m}^{N-1}P_n for several edge states, not only the mean;
  5. monitor trace, Hermiticity, positivity, and solver convergence independently;
  6. require the changes to fall below a predeclared absolute or relative tolerance; and
  7. retain the entire convergence record.

The condition ⟨n⟩≪N\langle n\rangle\ll N is insufficient because a broad or heavy-tailed distribution can have small mean relative to NN while still placing consequential weight at the boundary. Correlations and rare-event observables can converge more slowly than the mean photon number.

  • Continue to Laser Cooling before building the next AMO computation, where internal dynamics are coupled to motion through a velocity-dependent scattering force.
  • Reproducibility Benchmarks cross-checks the resonant doublets, vacuum exchange, producer validations, runtime record, and artifact identity.
  • Use the Computational AMO and Quantum Chemistry overview to compare the Jaynes–Cummings splitting with the chapter’s atomic, molecular, and driven-system benchmark ladder.
  • Return to Cavity QED before attaching these dimensionless calculations to a measured cavity linewidth, cooperativity, or output spectrum.