Multivariate Polynomials

**POLYNOMIAL**,
a MATLAB library which
adds, multiplies, differentiates, evaluates and prints multivariate
polynomials in a space of M dimensions.

Any polynomial in M variables can be written as a linear combination of monomials in M variables. The "total degree" of the polynomial is the maximum of the degrees of the monomials that it comprises. For instance, a polynomial in M = 2 variables of total degree 3 might have the form:

p(x,y) = c(0,0) x^0 y^0 + c(1,0) x^1 y^0 + c(0,1) x^0 y^1 + c(2,0) x^2 y^0 + c(1,1) x^1 y^1 + c(0,2) x^0 y^2 + c(3,0) x^3 y^0 + c(2,1) x^2 y^1 + c(1,2) x^1 y^2 + c(0,3) x^0 y^3The monomials in M variables can be regarded as a natural basis for the polynomials in M variables.

When listing the monomials that form a polynomial, it is useful to have an ordering that organizes them. One natural ordering can be illustrated for the 3-dimensional case:

1 x, y, z x^2, xy, xz, y^2, yz, z^2 x^3, x^2y, x^2z, xy^2, xyz, xz^2, y^3, y^2z, yz^2, z^3 x^4, x^3y, ...Here, a monomial precedes another if it has a lower degree. If the monomials have the same degree, then a monomial precedes another if its exponent vector lexically precedes that of the other. In other words, we compare the two exponent vectors, reading from left to right, looking for the first location where the exponents differ. The monomial with the higher exponent at this point precedes the other.

The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.

**POLYNOMIAL** is available in
a C version and
a C++ version and
a FORTRAN77 version and
a FORTRAN90 version and
a MATLAB version and
a Python version.

COMBO, a MATLAB library which includes routines for ranking, unranking, enumerating and randomly selecting balanced sequences, cycles, graphs, Gray codes, subsets, partitions, permutations, restricted growth functions, Pruefer codes and trees.

LEGENDRE_PRODUCT_POLYNOMIAL, a MATLAB library which defines Legendre product polynomials, creating a multivariate polynomial as the product of univariate Legendre polynomials.

MONOMIAL, a MATLAB 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.

SET_THEORY, a MATLAB library which demonstrates MATLAB commands that implement various set theoretic operations.

SUBSET, a MATLAB library which enumerates, generates, ranks and unranks combinatorial objects including combinations, compositions, Gray codes, index sets, partitions, permutations, subsets, and Young tables.

- i4_choose.m, computes the binomial coefficient C(N,K) as an I4.
- i4_choose_test.m
- i4_fall.m, computes the falling factorial function.
- i4_fall_values.m, returns selected values of the falling factorial function..
- i4_fall_test.m
- mono_next_grlex.m, computes, one by one in grlex order, the monomials of D variables of successively higher degrees.
- mono_rank_grlex.m, returns the grlex rank of a monomial in the sequence of all monomials in D dimensions of degree N or less.
- mono_total_next_grlex.m, computes, one by one in grlex order, the monomials of D variables of total degree N.
- mono_unrank_grlex.m, given the grlex rank, returns the corresponding monomial in the sequence of all monomials in D dimensions.
- mono_upto_enum.m, enumerates the monomials of D variables of total degree up to N.
- mono_value.m, evaluates a monomial.
- polynomial_add.m, adds two polynomials.
- polynomial_add_test.m
- polynomial_axpy.m, adds a multiple of one polynomial to another.
- polynomial_axpy_test.m
- polynomial_compress.m, "compresses" a polynomial by merging coefficients associated with the same monomial.
- polynomial_compress_test.m
- polynomial_dif.m, differentiates a polynomial several times with respect to several variables.
- polynomial_dif_test.m
- polynomial_mul.m, multiplies two polynomials.
- polynomial_mul_test.m
- polynomial_print.m, prints a polynomial.
- polynomial_print_test.m
- polynomial_scale.m, multiplies a polynomial by a scale factor.
- polynomial_scale_test.m
- polynomial_sort.m, sorts the terms in a polynomial.
- polynomial_sort_test.m
- polynomial_value.m, evaluates a polynomial.
- polynomial_value_test.m
- timestamp.m, prints the YMDHMS date as a timestamp.

- polynomial_test.m, calls all the tests;
- polynomial_test_output.txt, the output file.

You can go up one level to the MATLAB source codes.