Multivariate Polynomial examplesΒΆ

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)
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
   4     3 3     6       2     4      2
  x  - 2y x  + (y  + 6y)x  - 6y x + 9y
                   Type: MultivariatePolynomial([x,y],Integer)

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

m :: MPOLY([y,x],INT)
   2 6       4     3 3     2     2     4
  x y  - 6x y  - 2x y  + 9y  + 6x y + x
                   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)
                   Type: Void

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
  p
                   Type: Polynomial Integer

Now pull out the variables of interest.

% :: MPOLY([a,b],POLY INT)
  p
                   Type: MultivariatePolynomial([a,b],Polynomial Integer)
Restriction:
FriCAS 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))
                        Type: 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
                            2    2
        4   - 2z - 2  3   4y  + z  + 2z + 1  2   - 4z - 4
  (7)  x  + -------- x  + ----------------- x  + -------- x + 4
                y                  2                 y
                                  y
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))
   2            3     2             2 4       3      2      2            2
  x   2   - 2y x  + 2x  - 4y x     y x  - 2y x  + (4y  + 1)x  - 4y x + 4y
  -- z  + -------------------- z + ---------------------------------------
   2                2                                  2
  y                y                                  y
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))
    4      2     2  3     1  2    2     4y  + 1  2      4     4
   x  + (- - z - -)x  + (-- z  + -- z + -------)x  + (- - z - -)x + 4
           y     y        2       2         2           y     y
                         y       y         y
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, FriCAS provides extraordinary flexibility in the manipulation and display of expressions via its conversion facility.

See Also:

  • )help DistributedMultivariatePolynomial
  • )help UnivariatePolynomial
  • )help Polynomial
  • )show MultivariatePolynomial

Table Of Contents

This Page