LEGENDRE_PRODUCT_POLYNOMIAL
Multivariate Products of Legendre Polynomials
LEGENDRE_PRODUCT_POLYNOMIAL,
a Python library which
can define a Legendre product polynomial (LPP), creating a multivariate
polynomial as the product of univariate Legendre polynomials.
The Legendre polynomials are a polynomial sequence L(I,X),
with polynomial I having degree I.
The first few Legendre polynomials are
0: 1
1: x
2: 3/2 x^2 - 1/2
3: 5/2 x^3 - 3/2 x
4: 35/8 x^4 - 30/8 x^2 + 3/8
5: 63/8 x^5 - 70/8 x^3 + 15/8 x
A Legendre product polynomial may be defined in a space of M dimensions
by choosing M indices. To evaluate the polynomial at a point X,
compute the product of the corresponding Legendre polynomials, with
each the I-th polynomial evaluated at the I-th coordinate:
L((I1,I2,...IM),X) = L(1,X(1)) * L(2,X(2)) * ... * L(M,X(M)).
Families of polynomials which are formed in this way can have useful
properties for interpolation, derivable from the properties of the
1D family.
While it is useful to generate a Legendre product polynomial from
its index set, and it is easy to evaluate it directly, the sum of
two Legendre product polynomials cannot be reduced to a single
Legendre product polynomial. Thus, it may be useful to generate
the Legendre product polynomial from its indices, but then to
convert it to a standard polynomial form.
The representation of arbitrary multivariate polynomials can be
complicated. In this library, we have chosen a representation involving
the spatial dimension M, and three pieces of data, O, C and E.
-
O is the number of terms in the polynomial.
-
C() is a real vector of length O, containing the coefficients of each term.
-
E() is an integer vector of length O, which defines the index (the
exponents of X(1) through X(M)) of each term.
The exponent indexing is done in a natural way, suggested by the
following indexing for the case M = 2:
1: x^0 y^0
2: x^0 y^1
3: x^1 y^0
4: x^0 y^2
5: x^1 y^1
6; x^2 y^0
7: x^0 y^3
8: x^1 y^2
9: x^2 y^1
10: x^3 y^0
...
Licensing:
The computer code and data files described and made available on this web page
are distributed under
the GNU LGPL license.
Languages:
LEGENDRE_PRODUCT_POLYNOMIAL is available in
a C version and
a C++ version and
a FORTRAN90 version and
a MATLAB version and
a Python version.
Related Data and Programs:
LEGENDRE_POLYNOMIAL,
a Python library which
evaluates the Legendre polynomial and associated functions.
LEGENDRE_SHIFTED_POLYNOMIAL,
a Python library which
evaluates the shifted Legendre polynomial, with domain [0,1].
MONOMIAL,
a Python library which
enumerates, lists, ranks, unranks and randomizes
multivariate monomials in a space of M dimensions, with total degree
less than N, equal to N, or lying within a given range.
POLYNOMIAL,
a Python library which
adds, multiplies, differentiates, evaluates and prints multivariate
polynomials in a space of M dimensions.
SUBSET,
a Python library which
enumerates, generates, ranks and unranks combinatorial objects
including combinations, compositions, Gray codes, index sets, partitions,
permutations, subsets, and Young tables.
Source Code:
-
comp_enum.py,
enumerates the compositions of an integer into K parts.
-
comp_next_grlex.py,
returns the next composition of an integer into K parts,
using grlex order.
-
comp_random_grlex.py,
returns a random composition of an integer into K parts,
with the integer between 0 and N.
-
comp_rank_grlex.py,
ranks a composition of an integer into K parts,
using grlex order.
-
comp_unrank_grlex.py,
returns the composition of an integer into K parts of
a given rank, using grlex order.
-
i4_choose.py,
computes the binomial coefficient C(N,K) as an I4.
-
i4_uniform_ab.py,
returns a random integer in a given range.
-
i4vec_permute.py,
applies a 0-based permutation to an I4VEC.
-
i4vec_print.py,
prints an I4VEC.
-
i4vec_sort_heap_index_a.py,
returns an index vector to ascending sort an I4VEC.
-
i4vec_sum.py,
sums an I4VEC.
-
i4vec_uniform_ab.py,
returns a scaled pseudorandom I4VEC between A and B.
-
lp_coefficients.py,
returns the coefficients of a Legendre polynomial
-
lp_value.py,
evaluates a Legendre polynomial at a point.
-
lp_values.py,
returns a table of sample values of Legendre polynomials.
-
lpp_to_polynomial.py,
converts a Legendre Product Polynomial to standard polynomial form.
-
lpp_value.py,
evaluates a Legendre Product Polynomial at a point.
-
mono_next_grlex.py,
next monomial in grlex order.
-
mono_print.py,
prints a monomial.
-
mono_rank_grlex.py,
returns the grlex rank of a monomial in the sequence of all monomials
in D dimensions of degree N or less.
-
mono_unrank_grlex.py,
given the grlex rank, returns the corresponding monomial in the
sequence of all monomials in M dimensions.
-
mono_upto_enum.py,
enumerates monomials in D dimensions of degree between 0 and N.
-
mono_upto_next_grlex.py,
next monomial in grlex order, total degree up to N.
-
mono_upto_random.py,
random monomial with total degree up to N.
-
mono_value.py,
evaluates a monomial.
-
perm_check0.py,
checks a 0-based permutation.
-
perm_uniform.py,
randomly selects a permutation of the integers 0 through N-1.
-
polynomial_compress.py,
"compresses" a polynomial by merging coefficients associated with
the same monomial.
-
polynomial_print.py,
prints a polynomial.
-
polynomial_sort.py,
sorts the terms in a polynomial.
-
polynomial_value.py,
evaluates a polynomial.
-
r8mat_print.py,
prints an R8MAT.
-
r8mat_print_some.py,
prints some of an R8MAT.
-
r8mat_uniform_ab.py,
returns a scaled pseudorandom R8MAT.
-
r8vec_permute.py,
permutes an R8VEC.
-
r8vec_print.py,
prints an R8VEC.
-
r8vec_uniform_ab.py,
returns a random real vector in [A,B].
-
timestamp.py,
prints the YMDHMS date as a timestamp.
Examples and Tests:
You can go up one level to
the Python source codes.
Last modified on 31 October 2014.