Gallery
Scenes
Water's electron density settles
Checked against PySCF, to 1e-9 hartree
The Ising model at its critical temperature
Its page checks the sampled magnetization at T = 1.8, below Tc, against Onsager and Yang's exact value, and the run at every temperature against a reference Metropolis code
Two solitons pass through each other
Checked against Hirota's exact two-soliton solution
The band structure of silicon
Checked against a NumPy plane-wave code
Landau damping of a Langmuir wave
Checked against a 30-digit mpmath root
A pole balanced on a moving cart
Checked against SciPy's solve_continuous_are
Robertson's stiff chemical kinetics
Checked against the Bari test set
The densities of oxygen-16
Checked against a published Skyrme Hartree-Fock code
The lowest states of neon-20
Checked against BIGSTICK
Electron mobility fitted to NIST data
Checked against NIST's certified values
Programs written in Viv, by topic. Cards marked In vipyr are the ones vipyr's gallery calls from Python.
Data
Dataframes and features
Sessions from a transaction log
Per-customer sessions with state, computed one event at a time; transaction velocity and delinquency sit beside it.
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Statistics
Distributions
The special functions under the distributions
The normal, incomplete gamma and incomplete beta functions that the distributions are computed from.
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Regression and GLMs
Least squares that keeps its digits
Ordinary least squares by QR, the code vipyr checks against NIST's certified regressions.
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Generalized linear models
Iteratively reweighted least squares for GLMs, compared with R's glm.
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Machine learning
Neural networks and transformers
Finance
Options and volatility
Options on a binomial tree
Cox-Ross-Rubinstein trees for European and American options, against the Black-Scholes formula.
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
The Heston model by Fourier cosine series
European prices under stochastic volatility by the COS method, and the smile they imply.
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
An American put by Crank-Nicolson
The early-exercise boundary from a finite-difference solve, checked against a binomial tree.
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
The Black-Scholes equation
The price of an option on a stock at price . It is a heat equation run backward from a known final condition — at expiry a call is worth its payoff, — with diffusion that grows with , a drift, and a decay at the interest rate. Counting time to expiry, , turns it into an ordinary forward march.
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Science
Quantum chemistry
Water by restricted Hartree-Fock, ported from PySCF
The port of PySCF's restricted Hartree-Fock that vipyr calls, run on water in the 6-31G basis.
Look inside this program
In vipyrWater Hartree-Fock energies compared with PySCFOrbital energy levels of water and its cation
The Boys function
The integral behind every Gaussian-basis electron repulsion integral, by series, recursion and asymptotics.
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
The bond length of H2 by geometry optimization
- Result
- H₂ Rₑ = 1.346 a₀
- Checked against
- HF/STO-3G equilibrium
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
The geometry of water by optimization
- Result
- r 1.870 a₀, ∠ 100.0°
- Checked against
- HF/STO-3G water
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Hartree-Fock for the hydrogen molecule
- Result
- −1.11671 Eₕ
- Checked against
- Szabo & Ostlund
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Hartree-Fock for a chain of hydrogen atoms
- Result
- H₈ −4.06498, H₂₀ −4.79091
- Checked against
- C++ interpreter, exact
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Hartree-Fock with a McMurchie-Davidson integral engine
- Result
- −1.11671 Eₕ
- Checked against
- general integral engine
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Hartree-Fock and MP2 for small molecules in STO-3G
- Result
- 12 molecules + MP2
- Checked against
- published HF/STO-3G
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Hartree-Fock for water in STO-3G
- Result
- −74.94208 Eₕ
- Checked against
- Crawford −74.9420787, ~1 µEₕ
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Hartree-Fock for water in 6-31G*
- Result
- −76.0192 Eₕ
- Checked against
- 6-31G*, 19 basis functions
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Atoms and solids
The band structure of silicon
A plane-wave DFT code computes silicon's Kohn-Sham bands along L, Gamma and X, in the browser tab.
Look inside this program
Atoms from hydrogen to uranium
The Viv port of dftatom: radial Kohn-Sham equations for one atom, compared with NIST's LDA tables.
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Nuclear
Oxygen-16 from a Skyrme energy functional
Skyrme Hartree-Fock with SLy5 on a radial mesh: the binding energy, the charge radius and the densities.
Look inside this program
Density mixers for a self-consistent field
Linear, Broyden and Pulay mixing, the library the Skyrme code iterates calcium-40 to self-consistency with.
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
The nuclear shell model in the sd shell
A configuration-interaction shell model with dense and Lanczos eigensolvers, for neon-20 and magnesium-24.
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
In vipyrLevel schemes of neon-20 and magnesium-24 in the sd shellLanczos and dense diagonalization in the sd shell
Nuclear level density by counting states
- Result
- p(40) = 37338
- Checked against
- exact count vs Hardy–Ramanujan
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
The maximum mass of a free-neutron star
- Result
- 0.7087 M☉ maximum
- Checked against
- Oppenheimer–Volkoff 1939
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Plasma
Landau damping from the plasma dispersion function
The roots of the kinetic dielectric function give the damping rate and frequency of a Langmuir wave at each wavelength.
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
In vipyrLandau damping at four wavelengthsThe Faddeeva and plasma dispersion functions on the complex plane
Debye screening from the nonlinear Poisson-Boltzmann equation
- Result
- self-consistent screening
- Checked against
- Debye length recovered
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
A tokamak equilibrium from the Grad-Shafranov equation
- Result
- relaxed equilibrium
- Checked against
- tokamak flux surfaces
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Drift-wave turbulence in the Hasegawa-Wakatani model
- Result
- enstrophy + energy balance
- Checked against
- drift-wave turbulence
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Particle trapping after Landau damping
- Result
- O'Neil trapping regime
- Checked against
- nonlinear saturation
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
The Spitzer-Härm conductivity of a plasma
- Result
- within 2% of NRL
- Checked against
- Spitzer–Härm 1953
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
The two-stream instability in a particle-in-cell code
- Result
- growth rate vs theory
- Checked against
- particle-in-cell
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Landau damping in a Vlasov-Poisson solver
- Result
- γ matches the dispersion root
- Checked against
- Landau damping
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Statistical mechanics
The Ising model by Monte Carlo
Metropolis sampling of the two-dimensional Ising model on either side of its critical temperature.
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
A Lennard-Jones fluid at constant temperature
Molecular dynamics with a thermostat, ported from Allen and Tildesley's Fortran, against the fluid's equation of state.
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
A Lennard-Jones liquid at constant energy
Velocity Verlet molecular dynamics, ported from Allen and Tildesley: energy conservation and diffusion.
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Molecular dynamics of a bead-spring polymer
- Result
- energy conserved ~0.5%
- Checked against
- R_g 11.5 → 6.0
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Math
Differential equations
Stiff and nonstiff ODE solvers
Dormand-Prince, Radau and BDF behind one solve call, for Robertson's stiff kinetics and batches of epidemics.
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
In vipyrRobertson's stiff kinetics over sixteen decadesTen thousand epidemics in one call
Partial differential equations
The heat equation
A rod with its ends held at zero and a half-sine of heat along it. Diffusion damps a mode at the rate , so the exact solution is — one number to get right, at every point.
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
The heat equation in two dimensions
In two dimensions an implicit step couples every point to its four neighbors, and the matrix is no longer tridiagonal. Peaceman and Rachford's way around it: split the step in half, and be implicit in one direction at a time.
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
The advection equation
The simplest wave equation: whatever shape you start with slides along at speed , unchanged. On a ring of length 1 it is back where it began after a time , which makes the exact answer the initial condition itself.
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
The wave equation
A string fixed at both ends, plucked into its fundamental: . Centered differences in both variables give the leapfrog scheme, , with .
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Burgers' equation with a shock and a rarefaction
Take the viscosity away and smooth data stops being enough: characteristics cross, the derivative blows up in finite time, and the solution continues as a shock. A finite difference of a discontinuity means nothing, so the method has to be built on the integral form instead — what flows into a cell minus what flows out.
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
The Euler equations of gas dynamics
Mass, momentum and energy of a compressible gas, with . Sod's problem is a membrane at with dense, high-pressure gas on the left; at it bursts. Three waves come out: a rarefaction fan moving left, a contact discontinuity (density jumps, pressure and velocity do not) and a shock, both moving right.
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Laplace's equation
A square plate: one edge held at 1, the other three at 0. What is the temperature at the center?
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Poisson's equation
The equation of electrostatics, steady heat flow and pressure in an incompressible fluid. There is no time to march through: every unknown depends on every other, and the work is solving a large sparse linear system.
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
The modes of a drum
Separate variables in the wave equation and what is left is an eigenproblem: the shapes a membrane can vibrate in, and the frequencies that go with them. For a unit square fixed at its edge the answer is known, with .
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
The time-dependent Schrödinger equation
Two operators, each trivial in its own basis. The potential multiplies by a phase; the kinetic energy multiplies by a phase. Neither can be applied exactly to the other's representation — but an FFT moves between them, so alternate: half a potential step, a full kinetic step, half a potential step. That is Strang splitting. Every factor is a pure phase, so the norm is conserved to rounding whatever the time step, and the error is , from the two operators failing to commute.
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
The Korteweg-de Vries equation
Shallow-water waves, and the equation solitons were discovered in. Nonlinearity steepens a hump; third-order dispersion spreads it; and for exactly one family of shapes the two cancel: . Taller solitons are narrower and faster — the speed is twice the height.
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
The nonlinear Schrödinger equation
Light in a fiber, a Bose-Einstein condensate, deep-water wave envelopes. Dispersion spreads a pulse; the focusing nonlinearity squeezes it. When they balance the pulse is a soliton, and the simplest is : a shape that does not change at all, with a phase that turns at a steady rate.
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Burgers' equation, viscous
The smallest equation with both of a fluid's habits in it: steepens a wave, and smooths it. Where they balance the wave stops changing shape and simply travels: , a smoothed step from down to , of width about , moving at the mean of the two states.
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
The Fisher-KPP equation
A population that grows logistically and spreads by diffusion: a gene through a species, a flame, an invading plant. Behind the front , ahead of it , and the front advances at a constant speed.
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
The Poisson equation by finite elements
- Result
- error ratio → 4
- Checked against
- O(h²), the P1 rate
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
The same finite-element solver written with records
- Result
- identical to the above
- Checked against
- records are zero-cost
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
The Poisson equation solved spectrally
- Result
- error 1.7e-16
- Checked against
- exact solution, spectral, to rounding
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Linear algebra
Randomized trace estimation and low-rank approximation
Hutch++ for the trace of a matrix seen only through products, and randomly pivoted Cholesky for a kernel matrix.
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Fitting and optimization
Floating-point accuracy
Which digits of a result are real
Cancellation, Kahan summation and a Hilbert solve, the programs vipyr runs under the digits lens.
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Automatic differentiation
The exact derivative as a compiler transform
- Result
- f′(2) = 9.926737
- Checked against
- AD as an IR transform
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Forward-mode differentiation with dual numbers
- Result
- f′(2) = 9.926737
- Checked against
- dual numbers, exact
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Reverse-mode differentiation on a tape
- Result
- ∇g matches forward
- Checked against
- one backward pass
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Computer algebra
Identifying a function through the Meijer G-function
- Result
- log ✓ rational ✓ arctan ✗
- Checked against
- identification by snapping
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
A small computer-algebra system on flat arrays
- Result
- 11 asserts pass
- Checked against
- symbolic diff, simplify to fixpoint
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Finding a symmetry with a neural network
- Result
- exact after the substitution
- Checked against
- the oracle finds x−y
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Recovering a formula from data
- Result
- 4 / 4 recovered exactly
- Checked against
- AI-Feynman inner loop
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Dynamics and control
Linear control and stability
Balancing a cart-pole with LQR
The Riccati equation gives the feedback gains, and the simulated pole comes back upright from 25 degrees.
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Lyapunov equations for the cart-pole's feedback gains
The Lyapunov solver behind vipyr's stability map of the cart-pole, on the Schur form.
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Hardware
Digital logic
A four-bit adder from NAND gates
Gates built from NAND, a full adder from gates, and four of them in a row, checked on every input.
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Processors
Fibonacci on a RISC-V processor
A C program compiled, assembled and run on an RV32IM simulator, each step written in Viv.
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Power systems
Power flow
AC power flow on MATPOWER cases
Newton-Raphson and fast-decoupled power flow with a sparse LU, from the 9-bus case to 9241 buses.
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
In vipyrVoltage profile of the IEEE 118-bus systemPower flow convergence and timing from 9 to 9241 buses
An interconnection study
A new generator added to the IEEE 118-bus system, with every single-line outage checked.
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Transient stability
A PV curve by continuation power flow
The voltage at a bus as the transfer into it grows, traced around the nose of the curve.
Look inside this program
-
Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.