Switch animations to |ψ|² (probability density) instead of Re/Im of ψ#2
Open
sgaofen wants to merge 3 commits into
Open
Switch animations to |ψ|² (probability density) instead of Re/Im of ψ#2sgaofen wants to merge 3 commits into
sgaofen wants to merge 3 commits into
Conversation
Single-file HTML visualization aligned with the Fortran solver: analytic eigenstate expansion on (-1, 1), Wigner phase space matching wigner.f90, bilingual (EN/中文) walkthrough. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Re(psi) and Im(psi) are components of the complex wavefunction, not directly observable. They oscillate at the de Broglie wavelength and drown out |psi|^2 structure (e.g. wall-reflection interference fringes) when p0 is large. Default the position panel to |psi|^2 only; add legend-checkbox toggles to overlay Re/Im on demand. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The original `using 2:3` plotted a curve in the (Re psi, Im psi) complex plane parameterized by x, which is not a physical observable. Switch to `using 1:($2**2+$3**2)` so the animation shows the probability density |psi|^2 against position x. Also tighten the axis ranges to the box [-1, 1] and a positive y-range, and label the axes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Two related fixes — both make the animation output show the physically observable quantity
|ψ|²instead of components of the complex wavefunction:viz/index.html— default the position-space panel to|ψ|²only; hideRe(ψ)andIm(ψ)by default and expose them as legend-checkbox toggles. Dynamics, observables, and Wigner panel unchanged.mp4gen.bash— the gnuplot command was usingusing 2:3 w l, which plots a curve in the (Re ψ, Im ψ) complex plane parameterized by x. Switch tousing 1:($2**2+$3**2)so the generatedout.mp4shows the probability density|ψ(x,t)|²against position. Also tighten axis ranges to the box[-1, 1]and add axis labels.Why
Re(ψ)andIm(ψ)are mathematical components of the complex wavefunction, not directly observable. With nontrivial momentum and the hard walls of the box, they oscillate at the de Broglie wavelengthλ = 2π/|p|, which visually drowns out the|ψ|²structure — in particular the reflection-induced interference fringes that the demo is meant to highlight.|ψ|²carries the physical content (probability density), so it should be the default output of every animation pipeline in this repo.In the interactive page the Re/Im checkboxes still let you opt in for teaching purposes (showing the relation between
ψand|ψ|²).Test plan
viz/index.html:|ψ|²curve + walls render by defaultRe(ψ)/Im(ψ)checkboxes → curves overlay; untick → they disappearmp4gen.bash:psi_*files, thenbash mp4gen.bashout.mp4shows a positive-valued curve overx ∈ [-1, 1](probability density) rather than a closed Lissajous-style loop in the complex plane|psi|^2🤖 Generated with Claude Code