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
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
It is easy to see a different variable ordering by doing a conversion.
m :: MPOLY([y,x],INT)
You can use other, unspecified variables, by using Polynomial in the coefficient type of MPOLY.
p : MPOLY([x,y],POLY INT)
p := (a^2*x - b*y^2 + 1)^2
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
Type: Polynomial Integer
Now pull out the variables of interest.
% :: MPOLY([a,b],POLY INT)
Type: MultivariatePolynomial([a,b],Polynomial Integer)
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))
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
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))
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))
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.