1==================================================================== 2MultivariatePolynomial examples 3==================================================================== 4 5The domain constructor MultivariatePolynomial is similar to Polynomial 6except that it specifies the variables to be used. Polynomial are 7available for MultivariatePolynomial. The abbreviation for 8MultivariatePolynomial is MPOLY. The type expressions 9 10 MultivariatePolynomial([x,y],Integer) 11 MPOLY([x,y],INT) 12 13refer to the domain of multivariate polynomials in the variables x and 14y where the coefficients are restricted to be integers. The first 15variable specified is the main variable and the display of the polynomial 16reflects this. 17 18This polynomial appears with terms in descending powers of the variable x. 19 20 m : MPOLY([x,y],INT) := (x^2 - x*y^3 +3*y)^2 21 4 3 3 6 2 4 2 22 x - 2y x + (y + 6y)x - 6y x + 9y 23 Type: MultivariatePolynomial([x,y],Integer) 24 25It is easy to see a different variable ordering by doing a conversion. 26 27 m :: MPOLY([y,x],INT) 28 2 6 4 3 3 2 2 4 29 x y - 6x y - 2x y + 9y + 6x y + x 30 Type: MultivariatePolynomial([y,x],Integer) 31 32You can use other, unspecified variables, by using Polynomial in the 33coefficient type of MPOLY. 34 35 p : MPOLY([x,y],POLY INT) 36 Type: Void 37 38Conversions can be used to re-express such polynomials in terms of 39the other variables. For example, you can first push all the 40variables into a polynomial with integer coefficients. 41 42 p :: POLY INT 43 p 44 Type: Polynomial Integer 45 46Now pull out the variables of interest. 47 48 % :: MPOLY([a,b],POLY INT) 49 p 50 Type: MultivariatePolynomial([a,b],Polynomial Integer) 51 52Restriction: 53 FriCAS does not allow you to create types where MultivariatePolynomial 54 is contained in the coefficient type of Polynomial. Therefore, 55 MPOLY([x,y],POLY INT) is legal but POLY MPOLY([x,y],INT) is not. 56 57Multivariate polynomials may be combined with univariate polynomials 58to create types with special structures. 59 60 q : UP(x, FRAC MPOLY([y,z],INT)) 61 Type: Void 62 63This is a polynomial in x whose coefficients are quotients of polynomials 64in y and z. 65 66 q := (x^2 - x*(z+1)/y +2)^2 67 2 2 68 4 - 2z - 2 3 4y + z + 2z + 1 2 - 4z - 4 69 (7) x + -------- x + ----------------- x + -------- x + 4 70 y 2 y 71 y 72 Type: UnivariatePolynomial(x,Fraction MultivariatePolynomial([y,z],Integer)) 73 74Use conversions for structural rearrangements. z does not appear in a 75denominator and so it can be made the main variable. 76 77 q :: UP(z, FRAC MPOLY([x,y],INT)) 78 2 3 2 2 4 3 2 2 2 79 x 2 - 2y x + 2x - 4y x y x - 2y x + (4y + 1)x - 4y x + 4y 80 -- z + -------------------- z + --------------------------------------- 81 2 2 2 82 y y y 83 Type: UnivariatePolynomial(z,Fraction MultivariatePolynomial([x,y],Integer)) 84 85Or you can make a multivariate polynomial in x and z whose 86coefficients are fractions in polynomials in y. 87 88 q :: MPOLY([x,z], FRAC UP(y,INT)) 89 4 2 2 3 1 2 2 4y + 1 2 4 4 90 x + (- - z - -)x + (-- z + -- z + -------)x + (- - z - -)x + 4 91 y y 2 2 2 y y 92 y y y 93 Type: MultivariatePolynomial([x,z],Fraction UnivariatePolynomial(y,Integer)) 94 95A conversion like q :: MPOLY([x,y], FRAC UP(z,INT)) is not possible in 96this example because y appears in the denominator of a fraction. As 97you can see, FriCAS provides extraordinary flexibility in the 98manipulation and display of expressions via its conversion facility. 99 100See Also: 101o )help DistributedMultivariatePolynomial 102o )help UnivariatePolynomial 103o )help Polynomial 104o )show MultivariatePolynomial 105 106