seemps.analysis.expansion.PolynomialExpansion#

class seemps.analysis.expansion.PolynomialExpansion#

Bases: ABC

Abstract base class for polynomial expansions of a function f(x).

A polynomial expansion is defined by coefficients in a chosen basis {P_k(x)} and by the recurrence relation that generates the basis. Subclasses must provide:

  • the canonical domain of the basis (e.g. (-1, 1) for Chebyshev/Legendre),

  • the three-term recurrence coefficients (α_k, β_k, γ_k),

  • the scaling factor κ for P₁(x) = κ·x.

Attributes

coeffs

(Vector) Expansion coefficients of f(x) in the chosen basis.

domain

(tuple[float, float]) Interval [a, b] where the expansion is defined.

canonical_domain

(tuple[float, float]) Canonical interval of the basis polynomials.

abstractmethod get_recurrence(k: int) tuple[float, float, float][source]#

Return the three-term recurrence coefficients (α_k, β_k, γ_k) for P_{k+1}(x) = (α_k x + β_k) P_k(x) - γ_k P_{k-1}(x).

abstract property p1_factor: float#

Return the scalar κ such that the first-degree basis polynomial satisfies P_1(x) = κ·x. Used to correctly seed the three-term recurrence relation.

to_mpo(initial: MPO, clenshaw: bool = True, strategy: Strategy = DEFAULT_STRATEGY, rescale: bool = True) MPO[source]#

Construct the MPO representation of a composed operator using a general orthogonal polynomial expansion.

Given a orthogonal polynomial expansion of a function f(x) (in Chebyshev, Legendre, Hermite, or another polynomial basis) and an initial operator A represented as an MPO, this routine builds an MPO approximation of f(A).

The expansion can be evaluated using the Clenshaw recurrence (recommended for stability) or by direct series evaluation. If rescale=True, the input MPO is mapped to the canonical domain of the polynomial family (e.g. [-1, 1] for Chebyshev/Legendre) before applying the expansion.

Parameters:
expansionPolynomialExpansion

The polynomial expansion object (Chebyshev, Legendre, etc.) encoding the coefficients of f(x).

initialMPO

The operator A to which the expansion is applied, given as an MPO.

clenshawbool, default=True

Whether to use the Clenshaw recurrence for polynomial evaluation.

strategyStrategy, default=DEFAULT_STRATEGY

Simplification strategy for intermediate MPO operations.

rescalebool, default=True

Whether to rescale the initial MPO to the canonical domain of the chosen polynomial basis.

Returns:
MPO

An MPO approximation of the operator function f(A).

to_mps(initial: TypeAliasForwardRef('~seemps.analysis.mesh.Interval') | TypeAliasForwardRef('~seemps.state.MPS'), clenshaw: bool = True, strategy: Strategy = DEFAULT_STRATEGY, rescale: bool = True) MPS[source]#

Construct the MPS representation of a composed function using a general orthogonal polynomial expansion.

Given a orthogonal polynomial expansion of a function f(x) (e.g. in a basis of Chebyshev, Legendre, or other orthogonal polynomials), and an initial representation of g(x) as an Interval or MPS, this routine builds an MPS approximation of the composition f(g(x)).

The construction can be performed either via the Clenshaw recurrence or by direct evaluation of the polynomial series. If rescale=True, the input initial is mapped to the canonical domain of the polynomial family (e.g. [-1, 1] for Chebyshev/Legendre) before applying the expansion.

Parameters:
expansionPolynomialExpansion

The polynomial expansion object (e.g. Power series, Chebyshev, Legendre, etc.) encoding the coefficients of f(x).

initialInterval or MPS

The initial function g(x), given either as an interval (from which an MPS is built) or as an existing MPS.

clenshawbool, default=True

Whether to use the Clenshaw recurrence for polynomial evaluation (recommended for stability).

strategyStrategy, default=DEFAULT_STRATEGY

Simplification strategy for intermediate MPS operations.

rescalebool, default=True

Whether to rescale initial to the canonical domain of the chosen polynomial basis.

Returns:
MPS

An MPS approximation of the composed function f(g(x)).

Notes

  • Efficiency depends on the bond dimensions of the intermediate MPS states and the chosen simplification strategy.

  • Clenshaw recurrence is generally more efficient and numerically stable, though overestimating the expansion order can degrade performance.

Examples

# Expand a Gaussian using Chebyshev polynomials and load it into an MPS
func = lambda x: np.exp(-x**2)
coeffs = interpolation_coefficients(func, start=-1, stop=1)
expansion = Chebyshev(coeffs)
domain = RegularInterval(-1, 1, 2**10)
mps = expansion.to_mps(domain)