pub fn substitute_intercept<const K1: usize, const K: usize>(
f: &Tower4<K1>,
a: &Tower4<K>,
) -> Tower4<K>Expand description
Substitute the intercept tower a(θ) into slot 0 of a constraint
written over K + 1 variables, returning the composite tower over the
K primaries θ: G(θ) = f(a(θ), θ₁, …, θ_K).
This is the exact multivariate chain rule specialised to “slot 0 is a
dependent tower, slots 1..=K are the independent primaries”. It evaluates
f’s fourth-order multivariate Taylor polynomial about the expansion
point, with the slot-0 increment being the non-constant part of a and
the slot-(i) increment being the unit-seeded primary θ_i. The sum is
assembled by the same subset/partition algebra Tower4 arithmetic uses,
so it carries derivatives exactly through order four.