archimedes.approximationΒΆ
Linear basis-expansion / function approximation infrastructure.
Basis- a basis family (e.g.OrthogonalPolynomialBasis)FunctionSpace- aBasison a domain along with a quadrature-based inner product and associated operations (e.g.FunctionSpace.project()).BasisMatrix- a basis evaluated at a set of quadrature nodes; a generalized Vandermonde matrix.Function- aFunctionSpaceplus a coefficient vector.
Bases are univariate by default. TensorBasis combines one per
dimension into a multivariate basis but otherwise works similarly to the
univariate bases.
Two composition primitives build custom bases out of existing ones.
ConstrainedBasis recombines one basisβs functions by a fixed
matrix (e.g. the nullspace of a boundary condition constraint).
ConcatBasis stacks functions from several bases side by side
(e.g. spectral-element vertex + bubble functions).
Examples
Project a function onto a degree-5 Legendre space and evaluate it:
>>> import numpy as np
>>> from archimedes import approximation as approx
>>> space = approx.FunctionSpace.legendre(n_basis=6)
>>> f = space.project(lambda x: np.sin(np.pi * x))
>>> round(float(f(np.array([0.5]))[0]), 3)
1.005
Classes
|
Univariate B-spline basis on a general knot vector. |
|
A finite-dimensional family of basis functions \(\{\phi_i\}_{i=1}^n\). |
|
A |
|
A basis made of combining other bases. |
|
A basis whose functions are fixed linear combinations of another's |
A basis of cubic Hermite shape functions |
|
|
Trigonometric basis on a periodic interval. |
|
A specific element of a |
|
The linear span of a |
|
Lagrange (nodal) interpolating polynomial basis |
|
Monomial (power series) basis on an interval. |
|
A classical orthonormal polynomial basis |
|
A |
|
Target-domain parameters for a |
|
Tensor product of univariate bases, one per dimension. |