zoomy_core.symbolic.primitives_basis module#
Basis-projection primitives: the only place we evaluate
∫ kernel(ζ̂) dζ̂ for ζ̂ ∈ [0, 1] with kernel containing
opaque phi_* calls.
Decomposes the legacy ProjectBasisIntegrals (ins_generator.py:2188)
3-pass operation into separable primitives:
canonicalize_phi_derivative_subs()— rewriteSubs(Derivative(phi(ξ), ξ), ξ, val) → Derivative(phi(val), val). Purexreplace; no math change, just normalisation of the chain-rule artifact sympy emits when basis arguments substitute.project_basis_integrand()— for eachIntegral(kernel, (ζ̂, 0, 1))whose kernel contains aphi_*call, look up viaBasisIntegralCacheand substitute the polynomial result.
The legacy operation also bundled
zoomy_core.symbolic.primitives_canonical.split_integral_over_add()
between Pass 1 and Pass 3, plus an end-of-pipeline Subs.doit()
walk (ins_generator.py:2319). The redesigned recipe asks the caller
to invoke those primitives explicitly.
- zoomy_core.symbolic.primitives_basis.canonicalize_phi_derivative_subs(expr)#
Subs(Derivative(phi_k(ξ), ξ), ξ, val) → Derivative(phi_k(val), val).The chain-rule artefact sympy creates when a
phi_k(arg)is substituted into aDerivativecontext. Recanonicalising as a plainDerivative(phi_k(val), val)makes the pattern visible to downstream basis-cache lookups.Lifted verbatim from
ProjectBasisIntegrals._canon(ins_generator.py:2236). Purexreplace— no math change.
- zoomy_core.symbolic.primitives_basis.project_basis_integrand(expr, basis_cache)#
Look up every
Integral(kernel, (ζ̂, 0, 1))whose kernel contains aphi_*call in the givenbasis_cacheand substitute the polynomial result.Single-pass: walks the expression once, replacing each matching Integral in place. Outer factors are pulled out structurally: integrand factors that don’t reference the integration variable become an outer coefficient; the rest is the kernel handed to the cache.
Lifted from the Pass-3
_mapofProjectBasisIntegrals(ins_generator.py:2282), with the surrounding fixpoint loop (lines 2339-2344) removed — the caller is expected to compose this primitive withcanonicalize_phi_derivative_subs()andzoomy_core.symbolic.primitives_canonical.un_subs()for any boundary-Subs resolution.
- zoomy_core.symbolic.primitives_basis.has_phi_call(e)#
True iff
econtains anyphi_*function call.