How I Rediscovered Kepler's Third Law on a Phone, in 204 Lines
Описание и применение
Минимальный движок символического регресса, работающий на Android‑телефоне, в 204 строках кода, успешно воссоздал закон Кеплера за 11 мс.
Задача
Most machine‑learning models are black boxes; for physics, biology, or finance one needs interpretable laws rather than predictions.
Результат
The engine successfully rediscovered y=x*sin(x) and T=a^(3/2) (Kepler’s Third Law) from numeric data, achieving MSEs of 5.36e-33 and 4.77e-31 in 18 ms and 11 ms respectively, on an Android phone.
Рабочий процесс
- Build a library of candidate forms for each input variable (x, x^2, x^3, 1/x, 1/x^2, sqrt(x), sin(x), cos(x), exp(-x), log(x)).
- Generate all pairwise products of candidate forms, yielding ~55 forms.
- Apply Orthogonal Matching Pursuit (OMP) in pure NumPy to select the smallest subset of columns that best reconstructs the target, testing k=1..6 and keeping the best MSE.
- Combine selected terms into a SymPy expression and simplify to obtain the final symbolic formula.
Доказательства
The engine rediscovered it, from raw numbers, in 11 milliseconds, on an Android phone.
Two targets didn't work. Newton's law of gravitation (F = m1*m2/r^2): MSE 1.6. Reason: the library only generates pairwise products.
pip install numpy sympy rich
python flash.py kepler
- Дата записи: 2026-10-04T12:41:04.699Z