Code Documentation

class pyProximation.base.Foundation[source]

This class contains common features of all modules.

DetSymEnv()[source]

Returns ['sympy'] when sympy is available.

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.

integral(f)[source]

Returns the integral of f with respect to the currwnt measure over the support.

measure(S)[source]

Returns the measure of the set S. S must be a list of 2-tuples.

norm(p, f)[source]

Computes the norm-p of the f with respect to the current measure.

sample(num)[source]

Samples from the support according to the measure.

class pyProximation.orthsys.OrthSystem(variables, var_range, env='sympy')[source]

OrthogonalSystem class 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 variables and the range of each these variables as a list of lists var_range.

Basis(base_set)[source]

To specify a particular family of function as a basis, one should call this method with a list base_set of linearly independent functions.

FormBasis()[source]

Call this method to generate the orthogonal basis corresponding to the given basis via Basis method. The result will be stored in a property called OrthBase which is a list of function that are orthogonal to each other with respect to the measure measure over the given range Domain.

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.

SetOrthBase(base)[source]

Sets the orthonormal basis to be the given base.

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.

inner(f, g)[source]

Computes the inner product of the two parameters with respect to the measure measure.

project(f, g)[source]

Finds the projection of f on g with respect to the inner product induced by the measure measure.

pyProximation.rational.RationalApprox

alias of RationalAprox

class pyProximation.rational.RationalAprox(orth)[source]

RationalAprox calculates a rational approximation for a given function. RationalApprox is the preferred public alias; this class name is retained for backward compatibility. It takes one argument orth which is an instance of OrthSystem and does all the computations in the scope of this object.

RatLSQ(m, n, f)[source]

Calculates a rational function :math:`

rac{p}{q}` where

\(p, q\) consists of the first \(m, n\) elements of the orthonormal basis :math:`||f-

rac{p}{q}||_2` is minimized.

class pyProximation.interpolation.Interpolation(var, env='sympy')[source]

The Interpolation class 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.

MinNumPoints()[source]

Returns the minimum number of points still required.

Monomials()[source]

Generates the minimal set of monomials for interpolation.