Code Documentation¶
- class pyProximation.measure.Measure(dom, w=None)[source]¶
- An instance of this class is a measure on a given set supp. The support is either
a python variable of type set, or
a list of tuples which represents a box in euclidean space.
- Initializes a measure object according to the inputs:
- dom must be either
a list of 2-tuples
a non-empty dictionary
- w must be a
a function if dom defines a region
left blank (None) if dom is a dictionary
- boxCheck(B)[source]¶
Checks the structure of the box B. Returns True id B is a list of 2-tuples, otherwise it returns False.
- check(dom, w)[source]¶
Checks the input types and their consistency, according to the __init__ arguments.
- class pyProximation.orthsys.OrthSystem(variables, var_range, env='sympy')[source]¶
OrthogonalSystemclass produces an orthogonal system of functions according to a suggested basis of functions and a given measure supported on a given region.This basically performs a ‘Gram-Schmidt’ method to extract the orthogonal basis. The inner product is obtained by integration of the product of functions with respect to the given measure (more accurately, the distribution).
To initiate an instance of this class one should provide a list of symbolic variables variables and the range of each variable as a list of lists
var_range.To initiate an orthogonal system of functions, one should provide a list of symbolic variables
variablesand the range of each these variables as a list of listsvar_range.- Basis(base_set)[source]¶
To specify a particular family of function as a basis, one should call this method with a list
base_setof linearly independent functions.
- FormBasis()[source]¶
Call this method to generate the orthogonal basis corresponding to the given basis via
Basismethod. The result will be stored in a property calledOrthBasewhich is a list of function that are orthogonal to each other with respect to the measuremeasureover the given rangeDomain.
- FourierBasis(n)[source]¶
Generates a Fourier basis from variables consisting of all \(sin\) & \(cos\) functions with coefficients at most n.
- PolyBasis(n)[source]¶
Generates a polynomial basis from variables consisting of all monomials of degree at most
n.
- Series(f)[source]¶
Given a function f, this method finds and returns the coefficients of the series that approximates f as a linear combination of the elements of the orthogonal basis.
- SetMeasure(M)[source]¶
To set the measure which the orthogonal system will be computed, simply call this method with the corresponding distribution as its parameter dm; i.e, the parameter is d(m) where m is the original measure.
- TensorPrd(Bs)[source]¶
Takses a list of symbolic bases, each one a list of symbolic expressions and returns the tensor product of them as a list.
- pyProximation.rational.RationalApprox¶
alias of
RationalAprox
- class pyProximation.rational.RationalAprox(orth)[source]¶
RationalAproxcalculates a rational approximation for a given function.RationalApproxis the preferred public alias; this class name is retained for backward compatibility. It takes one argument orth which is an instance ofOrthSystemand does all the computations in the scope of this object.
- class pyProximation.interpolation.Interpolation(var, env='sympy')[source]¶
The
Interpolationclass provides polynomial interpolation routines in multi variate case.var is the list of symbolic variables and env is the the symbolic tool.
- Delta(idx=-1)[source]¶
Construct the matrix corresponding to idx’th point, if idx>0 Otherwise returns the discriminant.
- Interpolate(points, vals)[source]¶
Takes a list of points points and corresponding list of values vals and return the interpolant.
Since in multivariate case, there is a constraint on the number of points, it checks for the valididty of the input. In case of failure, describes the type of error occured according to the inputs.