zoomy_core.model.derivation.symbolic_integrator#
Exact symbolic integration of basis-function products over the basis domain, with strategy dispatch (sympy, knot spans, orthogonality, quadrature). Used by the basis matrices (mass, triple product, derivative products) of the Galerkin projection.
Module Contents#
Classes#
Integrates basis-function expressions symbolically; quadrature only when requested
explicitly. A single integral exceeding |
API#
- class zoomy_core.model.derivation.symbolic_integrator.SymbolicIntegrator(basis, strategy='auto', n_workers=1, integral_timeout=_DEFAULT_INTEGRAL_TIMEOUT)#
Integrates basis-function expressions symbolically; quadrature only when requested explicitly. A single integral exceeding
integral_timeoutseconds raisesTimeoutError.Initialization
Select the integration strategy for
basis.Args
basis: Basisfunction providingbounds(),weight(z)andeval(k, z).strategy:'auto'(knot spans, orthogonal or sympy by basis capability),'sympy','knot_spans'or'quadrature'.n_workers: Parallel workers for matrix computation (1 = serial).integral_timeout: Seconds allowed per integral;Nonedisables the timeout.
- property strategy#
The resolved strategy name.
- integrate(expr, var, domain=None)#
Integrate
exprovervarindomain(default: the basis bounds), exactly unless the strategy is'quadrature'.Returns
Symbolic value of the integral.
- mass_matrix(level)#
M[k,i] = int(phi_k phi_i w)over the domain (symmetric).
- triple_product(level)#
A[k,i,j] = int(phi_k phi_i phi_j w)over the domain, fully symmetric in (k,i,j).
- derivative_product(level)#
D[k,i] = int(phi_k' phi_i' w)over the domain (symmetric).
- boundary_values(level)#
phib[k] = phi_kat the lower bound.
- compute_all_matrices(level)#
All standard basis matrices (
phib, M, A, B, D, Dxi, Dxi2, DD, D1, DT) forlevel, exploiting their symmetries.Returns
Dict of the matrices plus
_elapsedand_strategy.
- project(expr, test_index, weight=None)#
Galerkin projection of
exprontophi_test_index:int(expr phi_k w) / M[k,k].