Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Equations from data, one term at a time
Suppose you film a system that moves and want the equation behind the motion. Physics equations are usually short: a few terms, each a simple product of the variables. SINDy lists many possible terms, such as x, y, x², xy, and asks which few of them, with which weights, reproduce how fast each variable is changing. Terms that barely matter are thrown out, so what remains is an equation a person can read and check.
SINDy has recovered models of fluid wakes, chemical reactions, plasma dynamics and biological networks, and is used to build interpretable models for control.
- 1. SINDy assumes each equation has…
- 2. SINDy regresses…
- 3. The result of SINDy is…
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.By hand
- Model: Ẋ = Θ(X) Ξ, where the columns of Θ(X) are candidate functions (polynomials, trigonometric terms…) evaluated on the data and Ξ is sparse (Brunton, Proctor and Kutz, 2016).
- STLSQ: least squares, set coefficients with |ξ| below a threshold λ to zero, refit on the survivors, repeat. LASSO and SR3 are alternatives.
- Derivatives: finite differences amplify noise by about 1/Δt; smoothing (Savitzky–Golay, total-variation regularisation) reduces it; the integral or weak form (Messenger and Bortz, 2021) avoids differentiating the data at all.
- Library noise: noise also enters Θ(X), which biases coefficients (errors in variables), for example creating constant terms from squared noise.
- Choices to validate: library, threshold λ, and data: check the model by simulating it and comparing with held-out trajectories.
- Extensions: SINDy with control, implicit SINDy for rational terms, PDE-FIND for partial differential equations, ensemble SINDy for uncertainty.
- 1. STLSQ alternates between…
- 2. The weak form of SINDy avoids…
- 3. Noise in the library causes…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.The Lorenz system and its library
Exercise 1.
- RK4 trajectory of the Lorenz system (σ = 10, ρ = 28, β = 8/3) with Δt = 0.002 and 10000 points.
- A library of the 10 monomials of degree ≤ 2 in x, y, z; the true coefficient matrix reproduces the vector field exactly.
- STLSQ with threshold 0.5 on central-difference derivatives of the clean data.
Practice.
- Scale the library columns before thresholding, or set λ relative to the expected coefficient sizes.
- Choose λ by a sweep: plot model size against error and pick the knee; check that the smallest true coefficient survives.
- Handle noise in derivatives: smoothing, total-variation differentiation, or weak SINDy.
- Validate by simulation: integrate the discovered model from new initial conditions.
- Tools: PySINDy (STLSQ, SR3, weak SINDy, PDE-FIND, ensembles, derivative estimators), and the original MATLAB code.
import numpy as np
def stlsq(Theta, dX, lam, iters=10):
Xi = np.linalg.lstsq(Theta, dX, rcond=None)[0]
for _ in range(iters):
small = np.abs(Xi) < lam; Xi[small] = 0
for j in range(dX.shape[1]): # refit each equation on its surviving terms
keep = ~small[:, j]
Xi[keep, j] = np.linalg.lstsq(Theta[:, keep], dX[:, j], rcond=None)[0]
return Xi
Xi = stlsq(library(X), np.gradient(X, dt, axis=0), lam=0.5)- 1. A Python package for SINDy:
- 2. λ is best chosen by…
- 3. A discovered model should be validated by…
Level 3: Advanced
★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.Theory
Why noise hurts. Central differences of white noise of size σ have standard deviation σ/(√2 Δt): with Δt = 0.002 the derivative noise was larger than the signal (relative error 0.49 at 1% noise, 2.4 at 5%). Least squares on 10000 points still averages much of it away, which is why all methods succeeded at 1–2% noise. At 5% two other effects take over: noise in the library shrinks the coefficients of noisy regressors, which can push a true coefficient of size 1 below the threshold; and squared noise in terms like z² adds an offset that least squares turns into a spurious constant term (the failures of the integral form were such constants in dz/dt).
Smoothing is not enough. Savitzky–Golay derivatives were ten times more accurate, yet at 5% noise they failed in all 10 draws, each time by losing the −y term (coefficient −1) of dy/dt: the derivative was better, but the library was just as noisy, and smoothing the derivative does nothing about that. The integral form compares changes in X over windows with integrals of Θ, which averages both kinds of noise, and found the exact model in 7 of 10 draws.
- 1. Central differences of noise scale like…
- 2. At 5% noise, a true term was lost because…
- 3. The integral form worked best because it…
Level 4: Expert
★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.How much measurement noise can SINDy tolerate, and does better differentiation fix it?
History.
- J. Bongard and H. Lipson (2007) and M. Schmidt and H. Lipson (2009) discovered equations with symbolic regression (J6-2).
- S. Brunton, J. Proctor and J. N. Kutz (2016) introduced SINDy; S. Rudy et al. (2017) extended it to PDEs (PDE-FIND).
- D. Messenger and D. Bortz (2021) introduced weak SINDy; U. Fasel et al. (2022) ensemble SINDy.
- PySINDy (de Silva et al., 2020; Kaptanoglu et al., 2022) made the methods widely available.
Exercise 2. Lorenz trajectory, Δt = 0.002, 10000 points; noise with standard deviation a fraction of each variable’s spread; STLSQ with λ = 0.5 on the degree-2 library. Success = exactly the 7 true terms. Ten noise draws per level.
| noise | finite differences | Savitzky–Golay | integral form | derivative error (FD / SG) |
|---|---|---|---|---|
| 1% | 10 of 10 | 10 of 10 | 10 of 10 | 0.49 / 0.048 |
| 2% | 10 of 10 | 10 of 10 | 10 of 10 | 0.98 / 0.096 |
| 5% | 1 of 10 | 0 of 10 | 7 of 10 | 2.4 / 0.24 |
- Clean data: largest coefficient error 0.0013, from the finite-difference truncation error.
- Better derivatives did not mean better models: Savitzky–Golay was 10 times more accurate but failed at 5%.
- Seeds 1 and 2 (other noise draws): at 5% noise, finite differences 4 and 2 of 10, Savitzky–Golay 0 and 0, integral form 8 and 10 of 10; at 1–2% all methods 10 of 10.
SINDy in practice
- Fluids: reduced models of cylinder wakes and turbulent flows from POD coefficients.
- Plasma physics: models of magnetohydrodynamic modes in fusion experiments.
- Biology and chemistry: reaction networks and gene regulation from time-course data.
- Control: SINDy with control inputs for model-predictive control of robots and aircraft.
References
- S. L. Brunton, J. L. Proctor and J. N. Kutz (2016). “Discovering governing equations from data by sparse identification of nonlinear dynamical systems.” PNAS.
- S. H. Rudy, S. L. Brunton, J. L. Proctor and J. N. Kutz (2017). “Data-driven discovery of partial differential equations.” Science Advances.
- D. A. Messenger and D. M. Bortz (2021). “Weak SINDy: Galerkin-based data-driven model selection.” Multiscale Modeling and Simulation.
- U. Fasel, J. N. Kutz, B. W. Brunton and S. L. Brunton (2022). “Ensemble-SINDy: robust sparse model discovery in the low-data, high-noise limit, with active learning and control.” Proceedings of the Royal Society A.
- A. A. Kaptanoglu et al. (2022). “PySINDy: a comprehensive Python package for robust sparse system identification.” Journal of Open Source Software.