]>
Book Contents Previous Section 9.53 MultiSet Next Section 9.55 None Book Index

## 9.54 MultivariatePolynomial

The domain constructor MultivariatePolynomial is similar to Polynomial except that it specifies the variables to be used. Polynomial are available for MultivariatePolynomial. The abbreviation for MultivariatePolynomial is MPOLY. The type expressions

MultivariatePolynomial([x,y],Integer)

and

MPOLY([x,y],INT)

refer to the domain of multivariate polynomials in the variables x and y where the coefficients are restricted to be integers. The first variable specified is the main variable and the display of the polynomial reflects this.

This polynomial appears with terms in descending powers of the variable x.

m : MPOLY([x,y],INT) := (x**2 - x*y**3 +3*y)**2

x 4-2 y 3 x 3+(y 6+6 y)x 2-6 y 4 x+9 y 2

Type: MultivariatePolynomial([x,y],Integer)

It is easy to see a different variable ordering by doing a conversion.

m :: MPOLY([y,x],INT)

x 2 y 6-6 x y 4-2 x 3 y 3+9 y 2+6 x 2 y+x 4

Type: MultivariatePolynomial([y,x],Integer)

You can use other, unspecified variables, by using Polynomial in the coefficient type of MPOLY.

p : MPOLY([x,y],POLY INT)
Void
p := (a**2*x - b*y**2 + 1)**2

a 4 x 2+(-2 a 2 b y 2+2 a 2)x+b 2 y 4-2 b y 2+1

Type: MultivariatePolynomial([x,y],Polynomial Integer)

Conversions can be used to re-express such polynomials in terms of the other variables. For example, you can first push all the variables into a polynomial with integer coefficients.

p :: POLY INT

b 2 y 4+(-2 a 2 b x-2 b)y 2+a 4 x 2+2 a 2 x+1

Type: Polynomial Integer

Now pull out the variables of interest.

% :: MPOLY([a,b],POLY INT)

x 2 a 4+(-2 x y 2 b+2 x)a 2+y 4 b 2-2 y 2 b+1

Type: MultivariatePolynomial([a,b],Polynomial Integer)

Restriction:

Axiom does not allow you to create types where MultivariatePolynomial is contained in the coefficient type of Polynomial. Therefore, MPOLY([x,y],POLY INT) is legal but POLY MPOLY([x,y],INT) is not.

.

Multivariate polynomials may be combined with univariate polynomials to create types with special structures.

q : UP(x, FRAC MPOLY([y,z],INT))
Void

This is a polynomial in x whose coefficients are quotients of polynomials in y and z.

q := (x**2 - x*(z+1)/y +2)**2

x 4+-2 z-2 y x 3+4 y 2+z 2+2 z+1 y 2 x 2+-4 z-4 y x+4

Type: UnivariatePolynomial(x,Fraction MultivariatePolynomial([y,z],Integer))

Use conversions for structural rearrangements. z does not appear in a denominator and so it can be made the main variable.

q :: UP(z, FRAC MPOLY([x,y],INT))

x 2 y 2 z 2+-2 y x 3+2 x 2-4 y x y 2 z+y 2 x 4-2 y x 3+(4 y 2+1)x 2-4 y x+4 y 2 y 2

Type: UnivariatePolynomial(z,Fraction MultivariatePolynomial([x,y],Integer))

Or you can make a multivariate polynomial in x and z whose coefficients are fractions in polynomials in y.

q :: MPOLY([x,z], FRAC UP(y,INT))

x 4+(-2 y z-2 y)x 3+(1 y 2 z 2+2 y 2 z+4 y 2+1 y 2)x 2+(-4 y z-4 y)x+4

Type: MultivariatePolynomial([x,z],Fraction UnivariatePolynomial(y,Integer))

A conversion like q :: MPOLY([x,y], FRAC UP(z,INT)) is not possible in this example because y appears in the denominator of a fraction. As you can see, Axiom provides extraordinary flexibility in the manipulation and display of expressions via its conversion facility.

For more information on related topics, see PolynomialXmpPage , UnivariatePolynomialXmpPage , and DistributedMultivariatePolynomialXmpPage .

Book Contents Previous Section 9.53 MultiSet Next Section 9.55 None Book Index