Coefficients Functions

With the Coefficients.m package

Roberto Colistete Júnior
<roberto@cce.ufes.br>
11/95

Commands

The Coefficients.m package provides some additional functions to deal with coefficients of low order multivariable polynomials, without any "dominant variable" :

<<Coefficients`

?Coefficients`*

The main function of the package, CoefficientListToPolynomial, inverts the operation of CoefficientList :

?CoefficientListToPolynomial

By using CoefficientList and CoefficientListToPolynomial, the function MapCoefficients allows to apply any function to the coefficients in a straightforward way :

?MapCoefficients

The other functions are just simple applications of MapCoefficients. One interesting result from using CoefficientList / CoefficientListToPoynomial (or MapCoefficients) is the absence of a "dominant variable" in multivariable polynomials :

?ExpandCoefficients

?FactorCoefficients

?CollectCoefficients

?SimplifyCoefficients

Examples

CoefficientListToPolynomial

p1 = a + b*x + c*y + d*x*y + e*x^2 + f*y^2 + g*x^2*y + h*x*y^2 + i*x^2*y^2

coef1 = CoefficientList[p1, {x, y}]

CoefficientListToPolynomial[coef1, {x, y}]

p2 = (1 + a)^2 + (1 + b)^2*x //Expand

coef2 = CoefficientList[p2, x]

CoefficientListToPolynomial[coef2, x]

p3 = 1 + x^5 + y^5

coef3 = CoefficientList[p3, {x, y}]

CoefficientListToPolynomial[coef3, {x,y}]

coef4 = Array[a, {2, 3}]

CoefficientListToPolynomial[coef4, {x, y}]

MapCoefficients

p1 = (1 + a)^2 + (1 + b)^2*x //Expand

MapCoefficients[f, p1, x]

MapCoefficients[Factor, p1, x]

MapCoefficients[Sqrt, p1, x]

p2 = (1 + x + y)^2 //Expand

MapCoefficients[f, p2, x]

MapCoefficients[f, p2, y]

MapCoefficients[f, p2, {x, y}]

ExpandCoefficients

p1 = (1 + a)^2 + (1 + b)^2*x

Expand[p1]

ExpandCoefficients[p1, x]

p2 = (1 + a)^2 + (1 + b)^3*x*y + (1 + c)^2*x^2 + (1 + d)^4*y^2

Expand[p2]

ExpandCoefficients[p2, {x, y}]

FactorCoefficients

p1 = (1 + a)^2 + (1 + b)^2*x //Expand

Factor[p1]

FactorCoefficients[p1, x]

p2 = (1 + a)^2 + (1 + b)^3*x*y + (1 + c)^2*x^2 + (1 + d)^4*y^2 //Expand

Factor[p2]

FactorCoefficients[p2, {x, y}]

CollectCoefficients

p1 = Expand[(1 + x + 2y + 3z)^3]

Collect[p1, {x, y}]

CollectCoefficients[p1, {x, y}]

SimplifyCoefficients

p1 = 1/((3 + 2w)^2)*((3 - 2w)/2)x*y + 1/((3 + 2w)^2)*2w*x*y + x^2 + y^2 + a

Simplify[p1]

SimplifyCoefficients[p1, {x, y}]

Limitations

The user should be wary about high order polynomials, since CoefficientList may return large arrays in such cases - for example, the simple polynomial 1 + x^1000 + y^1000 yields an array with about 3000 elements !
Thus, as all the functions defined here work with CoefficientList (or CoefficientListToPolynomial), the main shortcoming of the package is its limitation to low and medium order polynomials.