Work in a two-level sudden quench (source code)

= Work in a two-level sudden quench
{title2=$\langle W\rangle=(\Delta_i-\Delta_f\cos\theta)/2$}

The drive can supply or extract <work> while the <quantum state> stays approximately fixed. For a differentiable bounded <Hamiltonian operator>, the <Schrödinger equation> gives
$$
\frac{d}{dt}\langle H(t)\rangle=\left\langle\frac{\partial H(t)}{\partial t}\right\rangle.
$$
The state-evolution terms cancel, leaving the external drive's <power>. For a finite ideal step the change in mean <energy> is $\langle\psi|H_f-H_i|\psi\rangle$. Thus <conservation of energy> for a closed system with a time-independent <Hamiltonian operator> does not assert conservation of the driven subsystem's <energy> during switching.

Specify <work> operationally by two <energy measurements>: one before the switch and one after. For the prepared initial <ground state>, the first outcome is definite; the second samples the new <Born rule> <probabilities>. This protocol gives a distribution of measured <energy> differences, rather than generally the measurement distribution of the single operator $H_f-H_i$.<Fluctuation theorems: Work is not an observable by Peter Talkner and others>[Talkner, Lutz and Hänggi, p. 2, equations (8)–(10): initial energy outcome, conditional transition probability and two-measurement work distribution]{ref}
$$
W_g=\frac{\Delta_i-\Delta_f}{2}\quad\hbox{with probability }c^2,\qquad
W_e=\frac{\Delta_i+\Delta_f}{2}\quad\hbox{with probability }s^2,
$$
and hence
$$
\langle H_f\rangle=-\frac{\Delta_f}{2}\cos\theta,\qquad
\langle W\rangle=\frac{\Delta_i-\Delta_f\cos\theta}{2},\qquad
\operatorname{Var}(W)=\frac{\Delta_f^2}{4}\sin^2\theta.
$$
For $\Delta_i=\Delta_f=\Delta$ and $\theta=\pi/3$, the <work> is $0$ or $\Delta$, with <probabilities> $3/4$ and $1/4$; its <expectation> is $\Delta/4$ and its <variance> is $3\Delta^2/16$. The initial mean <energy> $-\Delta/2$ becomes $-\Delta/4$. Using different initial and final scalar offsets would also shift the measured <work>; the displayed <Hamiltonian operators> fix that convention explicitly.