Interactive, "Tangle"-style chemical kinetics and quantum chemistry widgets for Python notebooks (marimo, Jupyter, VS Code, Colab), inspired by Bret Victor's Tangle and TangleLatex from wigglystuff.
| Component | Description | Live Molab WASM Notebook |
|---|---|---|
TangleKinetics |
Interactive reaction networks & mass-action ODE kinetics | Launch Kinetics Demo (WASM) |
TangleSchrodinger |
Interactive 1D potential wells, eigenstates & wavefunctions | Launch 1D Schrödinger Demo (WASM) |
Define a system of chemical reactions in plain text, and get:
- Interactive chemical equations where rate constants sit directly on the reaction arrows and can be dragged horizontally (or clicked to type an exact value).
- Interactive initial concentrations (
[A]₀,[B]₀, ...) that can be dragged inline. - Live 60fps concentration-vs-time plots with dashed "before-drag" reference trajectories (
committed_valuesvs livevalues), hover inspection, and a toggleabled[X]/dtdifferential rate equation drawer.
from tanglechem import TangleKinetics
TangleKinetics(
reactions=[
"A ->[k1] B",
"B <->[k2, k_2] C",
],
initial_concentrations={"A": 1.0, "B": 0.0, "C": 0.0},
rate_constants={"k1": 0.8, "k2": 0.4, "k_2": 0.15},
t_max=10.0,
)Define any piecewise or algebraic 1D potential energy curve
-
Interactive potential equation
$V(x)$ where parameters (well width$L$ , barrier height$V_0$ , force constant$k$ , barrier thickness$a$ , particle mass$m$ ) are embedded directly inside the formula as draggable Tangle controls. -
Live 60fps quantum energy-level & wavefunction plot showing quantized eigenvalues
$E_n$ and wavefunctions$\psi_n(x)$ (or probability densities$|\psi_n(x)|^2$ ) sitting on their energy baselines, with dashed pre-drag ghost comparison.
from tanglechem import TangleSchrodinger
# Piecewise potential (Particle in a Box / Finite Well / Double Well)
TangleSchrodinger(
potential=[
"0 for -L/2 <= x <= L/2",
"V0 otherwise",
],
parameters={"L": 2.4, "V0": 10.0},
n_states=4,
)
# Algebraic potential (Harmonic Oscillator, Morse, Quartic Double Well)
TangleSchrodinger(
potential="0.5 * k * (x - x0)^2",
parameters={"k": 2.5, "x0": 0.0},
n_states=5,
)uv run marimo edit demos/kinetics_demo.py
uv run marimo edit demos/schrodinger_demo.py