Richard Hoekstra

Engineering prototype

Hybrid symbolic-numeric optimization in a ring substrate

Research note
Richard Hoekstra · April 2026

The claim

A practical question is whether simplifying a derivative once reduces the cost of repeated numerical evaluation. This prototype carries algebraic expressions and parameter values through a single implementation.

A ring-algebra substrate with βK-rewrite and autodiff in the same data structures removes the boundary. Symbolic simplification and numerical iteration live on the same expressions. Three applications follow immediately.

Newton-Raphson with simplified gradients

Standard Newton: xk+1 = xk − f(xk)/f'(xk). In a pure numerical framework, f' is computed at each iteration via autodiff or finite differences. Per-iteration cost: O(|f|).

With symbolic βK: compute f' symbolically once, simplify via βK, evaluate the simplified form N times. Per-iteration cost: O(|f'simplified|), amortized.

Measured on three functions:

f(x)f' raw sizef' simplifiedReductionIterations
x² − 29367%3 → √2
(x² + 0·x) − (x+x−x)21576%5 → root 1.0
x³ − 2x − 5251156%3 → 2.0946

The recorded derivative-expression sizes fell by 67%, 76% and 56%, respectively. These are node counts. End-to-end time also depends on simplification cost, sharing and numerical evaluation.

Equation discovery from data

Given data (xi, yi) and a hypothesis template with unknown coefficients — say y = a·x² + b·x + c — recover the coefficients.

The template is a symbolic expression with parameter-variables and input-variables:

template: (:add (:add (:mul (:var a) (:mul (:var x) (:var x)))
                      (:mul (:var b) (:var x)))
                (:var c))

For each data point (xi, yi), build the residual squared: (template(xi) − yi)2. Sum over points to get total loss, a symbolic expression in parameters a, b, c.

βK simplifies the loss. Finite-difference gradient on parameters. Gradient descent iterates.

The pipeline: symbolic template → βK simplify → numerical gradient descent. Equation discovery without hand-written solvers.

Implementation present; convergence results pending validation.

Cartpole control

The classic pole-balancing benchmark. State s = [x, ẋ, θ, ω]. Control u ∈ ℝ (horizontal force). Dynamics: second-order ODE linearized around θ = 0. Goal: keep pole upright.

Standard RL approaches use Q-learning (discrete actions) or policy gradient with neural network. The ring substrate does neither. Instead:

Policy u(s) = w1·x + w2·ẋ + w3·θ + w4·ω, clipped to [−Fmax, Fmax]. Four coefficients, linear in state.
Loss L(w) = Σt=0..T θ(t)2 + 0.01·u(t)2. Pole-upright plus control-cost. Continuous, differentiable.

The dynamics are symbolic ring-expressions. A rollout symbolically substitutes initial state, iterates the dynamics T times, and evaluates L. Finite-difference gradient on w. Update w. Repeat.

For linear dynamics and a quadratic cost, a Riccati solution gives a reference for the corresponding LQR problem. The prototype updates a symbolic-rollout controller by finite differences. Agreement with the reference requires a matched horizon and terminal cost and has not been demonstrated here.

Implementation present in hecke-lisp/learn/cartpole.lisp. Survival measurements pending validation runs; results will be added to this note when available.

The substrate that enables this

One data type (ring-expression tree) serves three roles:

No context switch. No translation layer. The same tree is manipulated by βK, differentiated by chain rule, and evaluated by numerical substitution. Information moves between symbolic and numeric phases without loss.

Why this matters beyond demos

Cartpole is a toy. But the method generalizes:

Comparison boundary

The table above compares expression sizes within this prototype. It includes no matched measurement against a computer algebra system or compiled autodifferentiation framework. A timing comparison would require the same expressions, numeric precision, reuse count and convergence tolerance.

The L(x) = K(x | π(x)) framework explains why βK is a valid pre-processor: it preserves π-equivalence while reducing L, which shortens numerical evaluation cost. The auto-discovery paper shows how the algebraic laws exploited by βK can themselves be found without human input — completing the loop from structure-discovery to structure-exploitation.

Cite this page

Richard Hoekstra. Hybrid symbolic-numeric optimization in a ring substrate. https://richardhoekstra.nl/papers/hybrid-substrate.html