This site is version 0.0.1. Most of the code on this site is drafted by an agent and needs review. I apologize for the AI-speak, we are working on rewriting it!
viv-lang.org

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

Regression and GLMs

Machine learning

Neural networks and transformers

A small GPT trained on one paragraph

nanoGPT's layout written in Viv, trained in the browser tab and stepped through call by call.

Look inside this program

  • Atlas

    The program’s map: every function and which calls which.

  • Explore

    Run it and step through what each part did, with the code, values and plots beside it.

Finance

Options and volatility

Science

Quantum chemistry

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

Nuclear

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.

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

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

Partial differential equations

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.

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.

All 15 PDE solvers →

Linear algebra

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

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

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.

All 33 example programs →