boundlab.polysp.legendre.Tanh#
- class boundlab.polysp.legendre.Tanh[source]#
Bases:
LegendreHandlerPlaceholder for a Legendre tanh relaxation (not yet implemented).
Methods
__init__Elementwise range of the residual
fn - pover[c - hw, c + hw].Whether this handler applies to these operands (default: always).
The scalar function being approximated (elementwise, differentiable).
Transform the operands; sub-operations go through
interp.<op>so the enclosing domain's handlers apply to them too.Compute the Legendre coefficients for center
cand half-widthhw.Legendre coefficients plus a sound symmetric bound on the residual.
A copy of this handler that takes precedence over
otherwhen both are ready for the same call.Elementwise bound on
|fn''''|over[lb, ub](forspline3_ibp).- approx_lbub(polyc, c, hw)#
Elementwise range of the residual
fn - pover[c - hw, c + hw].The interpolant
phas degree <= 3, so the residual’s fourth derivative isfn''''andquartic_boundapplies unchanged.
- condition(*args, **kwargs)#
Whether this handler applies to these operands (default: always).
- abstractmethod fn(x)#
The scalar function being approximated (elementwise, differentiable).
- handle(interp, x, **kwargs)#
Transform the operands; sub-operations go through
interp.<op>so the enclosing domain’s handlers apply to them too.
- abstractmethod legendre_coeffs(c, hw, **kwargs)#
Compute the Legendre coefficients for center
cand half-widthhw.\[l_i = \frac{2i+1}{2 a^i} \int_{-1}^{1} P_i(x) f(a x + b) dx\]with
a = hw,b = c, so thatf(x) \approx \sum_i l_i a^i P_i((x - b) / a). Must be finite fora == 0(wherel_itends to the Taylor limit).
- optimized_polynomial(c, hw, **kwargs)#
Legendre coefficients plus a sound symmetric bound on the residual.
The residual’s center is folded into
li[0]so the returned noise is the tightest symmetric enclosure offn - p.Non-finite values saturate soundly instead of leaking NaN into the bounds: bad coefficients (overflow, out-of-domain inputs) are zeroed before the residual is bounded against them, and an overflowing residual bound becomes an infinite noise with a finite center.
With an
optimizer, every element independently keeps the coefficients of the tightest residual width seen anywhere along the trajectory — the closed form is iterate 0, so no element ever ends looser than it — and the noise is recomputed from that selection.
- override_handler(other)#
A copy of this handler that takes precedence over
otherwhen both are ready for the same call.
- abstractmethod quartic_bound(lb, ub)#
Elementwise bound on
|fn''''|over[lb, ub](forspline3_ibp).
- optimizer: AdamConfig | None#