Описание проекта, Quick Start примеры, API reference, математическое обоснование и ссылки на статью Ремизова. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
7.1 KiB
RemizovNet
Physically exact neural architecture based on Chernoff approximations for solving and discovering second-order linear ODEs with variable coefficients.
a(x)y'' + b(x)y' + c(x)y = g(x)
Since 1834 (Liouville's theorem) it was believed that these equations cannot be solved analytically when coefficients are functions of x. In January 2026, Ivan Remizov published a universal formula using Chernoff approximations that solves them.
This library provides:
- NumPy solver — direct implementation of Remizov's formula
- PyTorch neural architecture — Chernoff steps as differentiable layers
- Equation discovery — learn ODE coefficients from observed data
Key Insight
The Chernoff product formula [S₃(τ)·S₂(τ)]^n is structurally identical to a deep neural network with n layers:
| Chernoff step | Neural network analogue |
|---|---|
| S₂: Gaussian convolution with drift | Convolutional layer |
| S₃: pointwise exp(τ·V(x)) multiplication | Activation function |
| n iterations | Network depth |
| Coefficients a(x), b(x), c(x) | Learnable weights |
After training, the weights are the ODE coefficients — fully interpretable.
Installation
git clone https://git.kazin.ru/anor/remizov-net.git
cd remizov-net
python -m venv .venv
source .venv/bin/activate
pip install -e '.[dev]'
Quick Start
Solve an ODE (NumPy)
import numpy as np
from remizov_net import ODECoefficients, ChernoffStep
# Heat equation with variable diffusivity: a(x) = 1 + 0.5·sin(x)
x = np.linspace(-4, 4, 201)
coeffs = ODECoefficients(
a=lambda x: 1.0 + 0.5 * np.sin(x),
b=0.0,
c=0.0,
)
# Evolve initial condition g(x) = exp(-x²) for time T
step = ChernoffStep(coeffs, x)
g = np.exp(-x**2)
tau, n_steps = 0.5 / 40, 40
y = g.copy()
for _ in range(n_steps):
y = step.apply(y, tau, use_fft=True)
# y is now the solution at time T=0.5
Discover an equation from data (PyTorch)
import torch
from remizov_net import RemizovNet
# Observed data: initial states g_i → evolved states y_i
g_data = torch.randn(20, 64) # 20 samples, 64 grid points
y_data = torch.randn(20, 64) # observed responses
# Train RemizovNet to discover the governing ODE
model = RemizovNet(grid_size=64, n_steps=20, total_time=0.5, dx=0.125)
optimizer = torch.optim.Adam(model.parameters(), lr=1e-3)
for epoch in range(1000):
optimizer.zero_grad()
loss = torch.nn.functional.mse_loss(model(g_data), y_data)
loss.backward()
optimizer.step()
# Extract discovered equation
print(model.equation_string())
# → "1.023·y'' + 0.001·y' + (-0.298)·y = g(x)"
coeffs = model.get_coefficients()
# coeffs['a'], coeffs['b'], coeffs['c'] — learned ODE coefficients
Equation discovery with convenience wrapper
from remizov_net.discover import EquationDiscoverer
discoverer = EquationDiscoverer(
grid_size=64, n_steps=30, total_time=0.3, dx=0.127, lr=3e-3,
)
result = discoverer.fit(g_data, y_data, epochs=2000)
print(result.equation) # discovered equation string
print(result.a.mean().item()) # coefficient a
print(result.converged) # whether training converged
Examples
# Solver: heat equation, damped equation, variable coefficients
python examples/example_solver.py
# Discovery: recover ODE coefficients from synthetic data
python examples/example_discover.py
Solver output (excerpt)
Evolution snapshots at x=0:
T Exact u(0,T) Chernoff Error
--------------------------------------------------
0.10 0.845154 0.845154 3.77e-15
0.25 0.707107 0.707107 2.66e-15
0.50 0.577350 0.577350 5.00e-10
Variable coefficients: a(x) = 1 + 0.5·sin(x)
Successive differences shrink to 5.77e-15 → convergence confirmed
Discovery output (excerpt)
Discovered: 0.866·y'' + 0.000·y' + (-0.250)·y = g(x)
True: 1.000·y'' + 0.000·y' + (-0.300)·y = g(x)
Test relative error: 1.07%
b=0 recovered exactly (no drift/advection)
Project Structure
remizov-net/
├── src/remizov_net/
│ ├── __init__.py # Public API, lazy imports for PyTorch
│ ├── core.py # NumPy: ChernoffStep, ODECoefficients, RemizovSolver
│ ├── net.py # PyTorch: RemizovLayer, RemizovNet
│ └── discover.py # EquationDiscoverer
├── tests/
│ ├── test_core.py # 9 tests for NumPy solver
│ └── test_net.py # 10 tests for PyTorch network
├── examples/
│ ├── example_solver.py
│ └── example_discover.py
└── pyproject.toml
API Reference
ODECoefficients(a, b, c)
Coefficients of a(x)y'' + b(x)y' + c(x)y = g(x). Each can be a float or a callable f(x) -> array.
ChernoffStep(coeffs, x_grid)
Single Chernoff step S(τ) = S₃(τ)·S₂(τ). Methods:
apply_s2(f, tau)— Gaussian convolution with drift (direct, O(N²))apply_s2_fft(f, tau)— FFT-based convolution (O(N log N))apply_s3(f, tau)— pointwise potential multiplicationapply(f, tau, use_fft=False)— full step
RemizovSolver(coeffs, x_grid, n_steps, lam, use_fft)
Full Remizov formula with Laplace integration. Methods:
solve(g, t_max, quad_points)— Gauss-Legendre quadraturesolve_adaptive(g, t_max, tol)— adaptive quadrature (slower, auto-accuracy)
RemizovNet(grid_size, n_steps, total_time, shared_coeffs, dx)
PyTorch network. Applies [S(T/n)]^n · g. Methods:
forward(g)— compute Chernoff compositionget_coefficients()— extract learneda,b,ctensorsequation_string()— human-readable equation
EquationDiscoverer(grid_size, n_steps, total_time, lr, dx)
Convenience wrapper for training. Methods:
fit(g_data, y_data, epochs, tol)→DiscoveryResult
Tests
source .venv/bin/activate
pytest # 19 tests
ruff check src/ tests/ # linter
Mathematical Background
Remizov's formula solves a(x)y'' + b(x)y' + c(x)y = g(x) by representing the solution operator as a limit of Chernoff approximations:
e^{tL} g = lim_{n→∞} [S(t/n)]^n g
where L = a·d²/dx² + b·d/dx + c and each Chernoff step decomposes into:
- S₂(τ): Gaussian convolution —
(1/√(4πτa)) · exp(-(x-y)²/(4τa)) · exp(b(x-y)/(2a)) - S₃(τ): Potential —
exp(τ · (c - b²/(4a)))
The resolvent (stationary solution) is obtained via the Laplace transform:
R_λ g = ∫₀^∞ e^{-λt} · e^{tL} g dt
Error bound (Theorem 6 in the paper): O(1/n) convergence rate for the Chernoff approximation.
References
- Remizov I.D. Chernoff approximations of the solution of linear ODE with variable coefficients // Vladikavkaz Mathematical Journal, 2025. arXiv:2301.06765
- HSE University announcement — "Mathematician solves equation considered unsolvable since 19th century"
- Chernoff P.R. Note on product formulas for operator semigroups // J. Functional Analysis, 1968.
License
MIT