Polynomial expansions#
Consider a function \(f(x)\) expressed as a finite polynomial expansion
Smooth functions can often be accurately approximated by truncated expansions over a complete polynomial basis \(\{P_k(x)\}\). SeeMPS provides tools for both direct encoding of functions and function composition using polynomial expansions.
SeeMPS provides two distinct but related sets of polynomial approximation tools:
Exact construction of MPS for 1D polynomials, when the coefficients are known explicitly.
Polynomial expansions of operators or states, evaluating \(f(A)\) where \(A\) is either an MPS or an MPO.
Exact polynomial MPS constructions#
The function mps_from_polynomial() constructs the
exact MPS corresponding to a one-dimensional polynomial expressed in the monomial
basis \(p_k(x)=x^k\) over some equispaced discretization \([a, b]\), represented
by the class RegularInterval.
Any degree-\(d\) polynomial can be constructed using an MPS with bond dimension \(\chi \leq d+1\) (in practice, often smaller if compression routines are used). This function can either take the coefficients \(\{p_i\}\) or convert a NumPy representation of a polynomial to MPS form.
Polynomial expansions of MPS and MPOs#
This implements the remaining functionality using the to_mps()
and to_mpo() methods. These apply
the Clenshaw evaluation method, a numerically stable technique to evaluate polynomials
in situations of finite precision.
Function composition#
Given an MPS \(\mathbf{v}\) encoding a function \(g(x)\), we can compute the encoding \(\mathbf{w}\) of the composed function through the expansion:
The same technique applies straightforwardly to operator-valued functions, allowing the evaluation of \(f(O)\) for an operator \(O\) represented as an MPO.
Available expansion classes#
SeeMPS currently provides the following expansion classes:
PowerExpansion: A polynomial expansion in the monomial basis \(p_k(x)=x^k\). In this scenario, Clenshaw’s evaluation formula reduces to Horner’s method, an efficient and robust technique for evaluating polynomial expansions. The user must explicitly provide the coefficients \(\{c_k\}\).ChebyshevExpansion: An expansion in the orthogonal basis of Chebyshev polynomials. The use of Chebyshev polynomials yields an approximation framework analogous to Matlab’s “ChebFun” package, but formulated entirely within the MPS/MPO formalism.LegendreExpansion: An expansion in the orthogonal basis of Legendre polynomials.
Three-term recurrence#
Orthogonal polynomial expansions rely on three-term recurrence relations:
which are evaluated using numerically stable Clenshaw formulas. The user provides the target function \(f\) together with an initial MPS or MPO encoding the argument.
This expansion framework is easily extensible to any orthogonal polynomial family by
subclassing OrthogonalExpansion, requiring only
the three-term recurrence relation and the canonical domain of definition.
Coefficient computation#
All expansion objects can be constructed by providing the coefficients \([c_0,c_1,...]\) explicitly. Alternatively, the coefficients can be computed by projecting the target function onto the orthogonal basis through projection methods, which estimate a finite-order expansion of a scalar function over a given domain \([a, b]\) using numerical quadratures.
Limitations#
The applicability of this technique is limited by the regularity of the target function. Highly differentiable functions present favorable convergence rates, while functions with discontinuities or sharp features—such as Heaviside functions—are poorly approximated by polynomial expansions, requiring prohibitively large expansion orders.
Example#
An example demonstrating the use of these functions for the case of Chebyshev polynomials is shown in Chebyshev.ipynb.
The following example encodes a multivariate function \(f(x, y) = e^{x + y}\) using a Chebyshev expansion:
>>> import numpy as np
>>> from seemps.state import mps_tensor_sum
>>> from seemps.analysis.mesh import RegularInterval
>>> from seemps.analysis.factories import mps_interval
>>> from seemps.analysis.expansion import ChebyshevExpansion
>>>
>>> interval = RegularInterval(-1, 1, 10)
>>> mps_x = mps_interval(interval)
>>> mps_xy = mps_tensor_sum([mps_x] * 2)
>>> f = lambda x: np.exp(x)
>>> expansion = ChebyshevExpansion.project(f)
>>> mps_f = expansion.to_mps(initial=mps_xy)
Abstract base class for polynomial expansions of a function f(x). |
|
Polynomial expansion in the power basis {1, x, x^2, ...}. |
|
Polynomial expansion in an orthogonal polynomial basis. |
|
Expansion in the Chebyshev basis. |
|
Expansion in the Legendre basis. |
|
|
Project func defined on (start, stop) onto the orthogonal polynomial basis up to the given order. |
|
Construct a tensor representation of a polynomial. |
See also#
Tensor cross-interpolation (TCI) - Tensor cross-interpolation for function encoding
Multiscale interpolative constructions - Multiscale interpolative constructions