Add thermodynamic-foundations companion to the discontinuity analysis#3
Open
maresb wants to merge 11 commits into
Open
Add thermodynamic-foundations companion to the discontinuity analysis#3maresb wants to merge 11 commits into
maresb wants to merge 11 commits into
Conversation
A self-contained, first-principles derivation of the moist-parcel entropy
that tcpyPI holds fixed on ascent (utilities.entropy_S), plus why it is
conserved and how the temperature inversion recovers T from it. Builds with
`latexmk -pdf` in the same setup as discontinuity_analysis.tex.
Chain, tied at every step to the source (constants.py, utilities.py, pi.py):
- Statistical origin: the operator picture (Z = Tr e^{-bH}, the spectrum as
the {E_i}, ensembles as Legendre transforms), the Boltzmann distribution
derived from energy conservation with its assumptions stated, then
Sackur-Tetrode and its polyatomic generalisation to s = c_p ln T - R ln p.
- Classical scaffolding: entropy as a state function via the 1/T integrating
factor.
- The parcel as a Dalton mixture; Gibbs additivity; phase equilibrium giving
Clausius-Clapeyron and the L_v/T vaporisation entropy.
- Assembly into Emanuel (1994) eq. 4.5.9 = entropy_S, term for term.
- Conservation on the reversible adiabat (adiabatic => no flux, reversible =>
no production), with the Liouville / adiabatic-theorem reading.
- The moist adiabat and the well-posed inversion s(T,p)=s0 -> T, whose
monotonicity and Newton step match solve_temperature_from_entropy.
Generated-with: Claude Opus 4.8 (1M context)
New subsection 2.4 derives the Boltzmann weights of 2.3 from a single
pure state of one closed system, replacing the equal-a-priori postulate
and the external reservoir with the Popescu-Short-Winter canonical
typicality theorem. Worked out concretely on n harmonic oscillators:
- the reduced density matrix rho_S = Tr_E |phi><phi| is exhibited
explicitly and shown to be diagonal (dephasing by the fixed-total-
quanta conservation law);
- its Haar average is the microcanonical marginal varrho_S, and the PSW
bound <||rho_S - varrho_S||_1> <= sqrt(d_S/d_E^eff) = sqrt((M+1)/C(M+n-1,n-1))
gives thermality to ~1e-28 already for n=100, mu=1;
- the geometric/Planck limit recovers e^{-beta hbar omega k}/Z with
beta = d ln Omega/dE, meeting the reservoir derivation of 2.3 and
making its Taylor truncation an explicit O(1/n) step;
- a short note on why the integrable oscillator fails the dynamical
(ergodicity/ETH) test: intra-shell degeneracy freezes rho_S, the
commensurate spectrum gives exact revivals, and product-Fock
eigenstates reduce to pure (non-thermal) subsystem states.
Cross-linked with the microscopic reading in 7.3 (labelled ssec:micro)
as the two faces of the same closed-system, no-reservoir stance. Builds
clean with latexmk (17 pp., 0 overfull/underfull, no undefined refs);
entropy_S and all physics are unchanged.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LZzvFfJYN7oiMWW5wZ5bhG
\mathbb 1 has no digit glyph in the AMS msbm font, so the projector in rho_mc = 1_R/d_R (eq. 10 and its inline form) rendered as a garbled crossed-bar character. Switch to \mathbb I_R, a clean identity symbol consistent with the document's existing blackboard-bold use (R^3, Z_+^3 in 2.1) and needing no extra package. Build unchanged: 17 pp., 0 overfull/underfull, no undefined references. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LZzvFfJYN7oiMWW5wZ5bhG
Two follow-ups on the canonical-typicality subsection:
- Add \usepackage{bbm} and render the microcanonical projector as
\mathbbm{1}_R, a genuine double-struck 1 (msbm/\mathbb has no digit
glyph). Requires the bbm package (texlive-fonts-extra).
- Define Tr_E where it first appears (eq. 10). New eq. (11) gives the
partial trace on product operators, Tr_E(A (x) B) = A Tr B, contrasted
with the full trace Tr(A (x) B) = Tr A Tr B, extended to all operators
by linearity; and notes it returns an operator on H_S (a density
matrix), not a scalar -- the point that distinguishes it from the full
trace.
Build clean: 17 pp., 0 overfull/underfull, no undefined references.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LZzvFfJYN7oiMWW5wZ5bhG
The binomial ratios inside \frac (and under \sqrt) in the marginal eq. and the PSW-bound eq. were rendered at script size and cramped. Switch those nested \binom to \dbinom so they typeset full size and stay legible; the standalone d_R binomial is unchanged. Build clean: 17 pp., 0 overfull/underfull, no undefined references. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LZzvFfJYN7oiMWW5wZ5bhG
Section 2.1 (the operator picture):
- Spoiler for the spectral functionals: give F = -kT ln Z,
<E> = -d ln Z/d beta, and S = (<E>-F)/T = -dF/dT inline where Z is
called the Laplace transform of rho(E) (full derivation deferred to
2.5, noted).
- Define the three symmetric functions and the Maxwell-Boltzmann count:
elementary e_N (fermions, strictly increasing indices = Pauli),
complete homogeneous h_N (bosons, repeats allowed), and the leading
power sum p_1^N/N! = z^N/N! (classical count, dilute limit; deferred
to 2.5/2.6, noted).
- Gloss the Legendre conjugate pairs: pressure p and chemical potential
mu (free-energy cost of one particle).
Section 2.4 (canonical typicality):
- New Remark 1 "where canonical typicality fails": the exceptional set
is the low-S:E-entanglement states; the product Fock state
|M,0,...,0> gives rho_S = |M><M|, trace distance 1 - 1/d_R from the
thermal state (maximal, ~28 orders past the typical bound), yet
measure-zero (~e^{-cn}). Ties the kinematic exception to the
integrable oscillator's dynamical non-thermalisation. Forward pointer
added at the PSW bound; the cautionary tale now cites the remark.
Build clean: 18 pp., 0 overfull/underfull, no undefined references.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LZzvFfJYN7oiMWW5wZ5bhG
New subsection after "From Z to entropy" making the microcanonical/
canonical relationship explicit:
- Z(beta) is the Laplace transform of the density of states
Omega(E) = e^{S/k_B}; invertible (Bromwich), so the two carry the same
information. SHO concretisation: Z = sum Omega(M,n) x^M = (1-x)^{-n},
the generating function whose coefficients are the shell dimensions.
- Thermodynamic limit = Legendre transform: the saddle S'(E*) = 1/T
gives F = E* - T S(E*), ln Z and S/k_B Legendre-dual with beta,E
conjugate; the ensemble table of 2.1 is the N->infty shadow of the
Laplace transform (Cramer/large-deviation duality noted).
- Why Z is elegant: distribution -> analytic function; convolution ->
product (so the sec-2.3 reservoir maneuver is a convolution done by
saddle point, and Z dissolves it); ln Z generates the cumulants
(Var E = k T^2 C_V); Z is what one actually computes.
- Caveat: Legendre returns only the concave hull, so non-concave S(E)
(first-order transitions, long-range/gravitating, negative T, small
systems) gives ensemble inequivalence and S(E) is the faithful
object; equivalence holds for short-range, N->infty -- the parcel's
regime.
Build clean: 20 pp., 0 overfull/underfull, no undefined references.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LZzvFfJYN7oiMWW5wZ5bhG
Adds the inverse-transform reading of the S(E) <-> Z(beta) bridge,
answering why exact energy conservation on the whole and the Boltzmann
distribution on a part are the "same" only asymptotically:
- Hard (microcanonical, delta(E_tot - H), zero fluctuation) vs soft
(canonical, e^{-beta H}, beta a Lagrange multiplier). Linked by the
operator identity delta(E_tot - H) = (1/2pi i) int e^{beta(E_tot-H)}
d beta -- the hard projector is a superposition of soft weights over
imaginary temperature (inverse Bromwich of the Laplace bridge).
- Whole-system equivalence guarded by 1/sqrt(N): the saddle collapses
to one temperature, relative energy fluctuation
sqrt(Var E)/<E> = sqrt(k T^2 C_V)/<E> ~ 1/sqrt(N).
- Subsystem equivalence guarded by N_S/N_B: marginalising the shell over
the bath gives p(E_S) ~ Omega_S Omega_B(E_tot - E_S); linearising the
bath entropy (stiff temperature, C_B ~ N_B) yields the Boltzmann
weight -- this IS the sec-2.3 Taylor truncation, small parameter named.
- When the guard fails: non-concave S(E) (competing saddles) or small
systems -> the ensembles genuinely diverge.
Build clean: 21 pp., 0 overfull/underfull, no undefined references.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LZzvFfJYN7oiMWW5wZ5bhG
The 2.6 "transform" paragraph wrongly equated the density of states
rho(E) with the count Omega(E) and then took log of "the density of
states," which is ill-defined. Rewritten to keep them distinct:
- rho(E) = Tr delta(E - H) = sum_i delta(E - E_i): a distribution (comb
of spikes); note delta(E - H) is the operator function of H traced
AFTER (same rule as Z = Tr e^{-beta H}), and its log is meaningless.
- Omega(E) = int_E^{E+dE} rho ~ rhobar(E) dE: the dimensionless count of
levels in a thin shell, and S = k_B ln Omega. Omega and rhobar agree
inside the log but differ by the units-carrying window dE -- hence the
two symbols.
- Laplace transform is of the density: Z = int rho e^{-beta E}
= sum_i e^{-beta E_i}, the kernel coarse-graining the comb for free
(why Z needs no window). Bromwich inverse recovers rho, not Omega.
- SHO noted as the clean case: discrete spectrum, Omega(M,n) an honest
integer degeneracy, no window needed.
- Consistency fixes in the elegance bullets: rho(E) = Tr delta(E - H)
and rho = rho_1 * rho_2.
Build clean: 21 pp., 0 overfull/underfull, no undefined references.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LZzvFfJYN7oiMWW5wZ5bhG
Exposition sweep extrapolating the review principles applied so far
(never conflate objects; define or explicitly defer everything at first
use; spoil payoffs; exact worked examples with counterexamples; tie
every claim to code or a named theorem):
New "notational hazards" remark (Remark 1) collecting every symbol
collision: Omega count vs grand potential, rho(E) vs density matrices vs
T_rho, single-particle epsilon vs eps=Rd/Rv, mu chemical potential vs
mean occupancy, H vs Hhat vs mathcal-H, R gas constant vs code argument.
Definitions added where first used: trace norm (with the Helstrom
operational meaning), Haar measure (with the Gaussian sampling recipe),
Levy's lemma (explicit concentration inequality, footnote), effective
dimension as inverse purity/participation number, stars-and-bars
(footnote).
Physics fix: the ergodicity "cure" was stated as a bilinear coupling
lambda x_i x_{i+1}, which is still quadratic hence integrable; corrected
to the cubic FPUT term, with the bilinear trap called out explicitly.
Sloppiness fix: buoyancy "(a length)" replaced by the real relations
b = g dTrho/Trho and CAPE = int Rd dTrho dlnp, matching the PFAC
trapezoid accumulated in pi.py.
Eight figures, all generated by the new scripts/foundations_figs.py
(numpy/matplotlib; colorblind-validated palette; the inversion figure
transcribes es_cc/Lv/ev/rv/entropy_S and the solver loop and asserts
against the source docstring examples):
- fig_sf_classical_marginal: hard constraint -> Boltzmann as n grows
- fig_sf_quantum_marginal: exact shell marginal vs Planck limit
- fig_sf_typicality: exact Dirichlet sampling of ||rho_S - varrho_S||_1
vs the PSW bound vs the atypical Fock state
- fig_sf_comb: DOS delta comb vs envelope vs windowed count
- fig_sf_bridge: Legendre tangent geometry + saddle sharpening
- fig_sf_nonconcave: convex intruder, Maxwell tangent, what Z loses
- fig_sf_fput: integrable freeze vs alpha-FPUT mixing + recurrence
- fig_sf_inversion: monotone s_sat per level + guarded Newton error
Abstract and synthesis updated to cover the typicality and bridge
material and the figure provenance; date bumped. Build clean: 26 pp.,
0 overfull/underfull, no undefined references.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LZzvFfJYN7oiMWW5wZ5bhG
New subsection 2.5 "The flat prior as a gauge choice: how little
postulate (i) does": striking the equal-a-priori postulate and putting
arbitrary weights w_i on the shell generalises the reservoir marginal to
p(eps) ~ wbar(eps) Omega_S Omega_B, so the postulate's entire
operational content is |d ln wbar / d eps| << beta -- the coarse-grained
prior's tilt must be subdominant to the bath's clamping slope. Four-tier
hierarchy on the oscillator: (1) tilt conjugate to the conserved total =
exact gauge; (2) i.i.d. randomness of any magnitude washed out at
e^{-S_B/2k} by bath averaging -- with the observation that the Haar
weights |c_i|^2 of the typicality figure are exactly such a wildly
non-flat prior, so canonical typicality IS prior-robustness quantified;
(3) smooth tilt << beta shifts the saddle at subleading order; (4) tilt
conjugate to a subsystem observable = a genuine temperature shift
(x -> x e^{-lambda}), the one dangerous prior, with the atypical Fock
state as its lambda -> -infinity extreme. Closes with the subextensive
Shannon-entropy statement, the stationarity/ETH reading, and Jaynes as
gauge fixing.
Restructure for pedagogical flow: sec 2 now runs derivation (2.1-2.3)
-> audit of the postulate (2.4 typicality, 2.5 prior class) ->
uninterrupted canonical computation (2.6 Z-to-entropy through 2.10
polyatomic) -> the S(E)<->Z bridge relocated as the reflective capstone
(2.11) -> the building block (2.12). Added a roadmap paragraph at the
top of sec 2, a forward pointer at the end of 2.3, and rewrote the
bridge's entry/exit transitions for its new position. Abstract (now
three interludes) and synthesis updated; date bumped.
Build clean: 28 pp., 0 overfull/underfull, no undefined references.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LZzvFfJYN7oiMWW5wZ5bhG
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A self-contained, first-principles derivation of the moist-parcel entropy that
tcpyPIholds fixed on ascent (utilities.entropy_S), why it is conserved, and how the temperature inversion recoversTfrom it. Companion todiscontinuity_analysis.tex; builds withlatexmk -pdfin the same setup (now additionally needs thebbmLaTeX package, in TeX Live's fonts-extra collection).Motivated by a series of questions probing the foundations of the parcel thermodynamics behind the pressure solver. Every formula is tied back to the specific function/constant it corresponds to in the source (
constants.py,utilities.py,pi.py), and every figure is generated from those same formulas byscripts/foundations_figs.py— the inversion figure by running the solver's own transcribed algebra, cross-checked against the source docstring examples.Contents
The statistical section runs in four sweeps: derivation → audit of the postulate → the canonical computation → the microcanonical mirror.
Z = Tr e^{-βĤ}, spectrum as the{E_i}, ensembles as Legendre transforms, the symmetric-function encoding of exchange statistics spelled out); the Boltzmann distribution derived from energy conservation with its four assumptions stated; the canonical partition function and indistinguishability; Sackur–Tetrode with every step, the fate of the two5/2's, and the polyatomic generalisation tos = c_p ln T − R ln p.ρ_S = Tr_E |φ⟩⟨φ|exhibited explicitly fornoscillators (diagonal by the conservation law), the PSW bound in closed form (~e^{-nσ(μ)/2}, thermal to 28 digits byn = 100), the Planck limit recovering the reservoir section's Taylor truncation as an explicitO(1/n)step, the exceptional product-Fock states where typicality fails maximally, and why the integrable oscillator fails ergodicity/ETH — with an FPUT simulation showing the integrable freeze vs. mixing-plus-recurrence.|d ln w̄/dε| ≪ β; a four-tier hierarchy (conserved-total tilt = exact gauge; generic randomness of any magnitude washed out by bath averaging, with the Haar weights of the typicality figure as the worked demonstration; smooth sub-β tilt = subleading; observable-conjugate tilt = a genuine temperature shift, the one dangerous prior).S(E) ↔ Z(β)bridge (as capstone, after the canonical computation) — density of states vs. windowed count kept distinct;Zas Laplace transform / generating function ((1−x)^{−n}for the SHO); the thermodynamic limit as a Legendre transform; whyZis the elegant object (convolution → product dissolves the reservoir); non-concaveS(E), Maxwell construction, and ensemble inequivalence; hard vs. soft constraints as Laplace duals guarded by the1/√NandN_S/N_Bseparations of scale.1/Tintegrating factor (Carathéodory).ev/rvas mutual inverses), Gibbs additivity.g_v = g_ℓ→ Clausius–Clapeyron and theL_v/Tvaporisation entropy; Kirchhoff's law →Lv; the CC integral →es_cc.entropy_S, term for term.ds=0→ the path; buoyancy and the CAPE integral in the exact form∫ R_d ΔT_ρ d ln pthe code accumulates; the well-posed inversions(T,p)=s₀ ↦ T, whose monotonicity∂s/∂T > 0and guarded Newton step matchsolve_temperature_from_entropy— drawn with the code's own formulas.Notes
discontinuity-analysis(where the writeup lives).thermodynamic_foundations.texand the compiled.pdf(28 pp.), eight figures underfigures/fig_sf_*(pdf+png, matching how the discontinuity figures are tracked), and their generatorscripts/foundations_figs.py. Build is clean: 0 overfull boxes, no undefined references.🤖 Generated with Claude Code