Spins Laboratory Simulation
This project is a re-write of Daniel V. Schroeder's spins laboratory simulation, which supplements the first three chapters of David McIntyre's introductory Quantum Mechanics textbook.
The program simulates the results of consecutive ideal measurements of electron spin. Mirroring the textbook, experimental setups are visualized as tree graphs with Stern-Gerlach analyzers as nodes. Experimental setups are configured by the student so that they may reckon with complementary physical variables. This simulation is a useful tool when using a spins-first approach to teaching quantum mechanics.
Demo
A live demo is available (work in progress).
Motivation
This re-write is an extension of my Bachelor's thesis research in Stern-Gerlach experiments and the consistent histories approach to quantum mechanics.
It accomplishes several goals:
- Simplifies computation of probabilities by using the consistent histories approach
- Increases readability of code
- Imports/exports experiment configurations
- Eliminates a counting error in Schroeder's simulation
- Simplifies user interface
- Updates tech stack
Stack
The simulation is written in Javascript adhering to the ES6 specification. The project uses node.js for development and dependency management and webpack for bundling the program for browser execution. Several packages were used to reduce code volume and simplify control flow:
- mathjs for linear algebra computations
- d3-hierarchy for tree visualization
- lodash and deepdash for tree traversal
- katex for math symbol rendering
Installing
- Install nodejs version >= v12.21.0
- Clone the project
git clone git@github.com:wilsonia/spins.git
- Navigate to the project and install dependencies
cd ./spins
npm install
Building and executing
- Bundle with webpack
npm run build
- Open index.html in a browser. You may need to allow CORS in Firefox.
mathjs
mathjs is cloned locally rather than installed via npm. This is so the maxSearchSize
parameter may be increased for the matrix exponential approximation function expm
. Unfortunately this parameter is not configurable, and increasing it is necessary for computing the magnet propagator.
TODO
- Spin-1