MuPAD - Demo

# ... Polynomials

## Contents

1. Arithmetic and manipulating
2. Factorization of polynomials
3. Polynomials over Gaussian Integers
4. Index of algebraic examples

### Arithmetic and manipulating

Many functions exist to abtain the different constitutes of a polynomial expression.

- `>> p:= 2*x^3*z^2 + 7*x^2*y^2 + 5*y - 3*z;`
  `

                     2  2      3  2
      5 y - 3 z + 7 x  y  + 2 x  z

  `

  Get the coefficients of p with respect to the indeterminates x and y.

- `>> coeff( p, [x,y] );`
  `

         2
      2 z , 7, 5, - 3 z

  `

  Get the coefficients of y^2.

- `>> coeff( p, y, 2 );`
  `

         2
      7 x

  `

  Get the degree of p with respect to x.

- `>> degree( p, x );`
  `3`

  Get the total degree of p with respect to x, y and z.

- `>> degree( p );`
  `5`

  The leading coeffient of p with respect to x and y according to a lexicographical ordering of the terms.

- `>> lcoeff( p, [x,y] );`
  `

         2
      2 z

  `

  The leading coeffient according to a total degree ordering.

- `>> lcoeff( p, [x,y], DegreeOrder );`
  `7`

- `>> lmonomial(p,[x,y]); lterm(p,[x,y]);`
  `

         3  2
      2 x  z

       3
      x

  `

  Get the list of exponents of the leading term.

- `>> degreevec( p , [x,y] );`
  `[3, 0]`

  Get the trailing coeffient.

- `>> tcoeff( p, [x,y] );`
  `- 3 z`

  A long division of polynomial expressions is performed by devide, returning the quotient and the remainder.

- `>> p:= 6*x^2 +4: q:= 2*x +1: divide(p,q);`
  `3 x - 3/2, 11/2`

  By using one of the options Rem or Quo the user may obtain the remainder or the quotient alone.

- `>> divide(p,q,Quo); divide(p,q,Rem);`
  `3 x - 3/2
  11/2`

  With option Exact one gets the quotient, but only if the division is without remainder.

- `>> divide(p,q, Exact);`
  `FAIL`

- `>> divide(x^2-1, x+1, Exact);`
  `x - 1`

  The function pdivide performs a pseudo division of polynomial expressions such that the coefficients are not devided. The first factor 4 times p equals the first expression times q plus the second expression:

- `>> pdivide(p,q);`
  `4, 12 x - 6, 22`

  The greatest common divisior and least common multiple of two polynomial expressions over the rationals can be computed.

- `>> gcd( x^2-1, x^2+2*x+1 );`
  `x + 1`

- `>> gcd( x^2-y^2, x^3-y^3 );`
  `x - y`

- `>> lcm( x^2-y^2, x^3-y^3 );`
  `

       4    4      3    3
      x  - y  - x y  + x  y

  `

  Rational functions may be normalized such that common factors of the numerator and denominator are removed.

- `>> normal( (x^2 - 1) / (x^2 + 2*x + 1) );`
  `

      x - 1
      -----
      x + 1

  `

- `>> normal( (x^2 - y^2) / (x^3 - y^3) );`
  `

          x + y
      -------------
             2    2
      x y + x  + y

  `

  Factorization of multivariate polynomial expressions over the rationals is available.

- `>> factor( 6*x^2 + 18*x - 24 );`
  `[6, x + 4, 1, x - 1, 1]`

- `>> factor( 4*x^3 + 4*x^2*y + 3*x*y + 3*y^2 );`
  `

      --                       2    --
      |  1, x + y, 1, 3 y + 4 x , 1  |
      --                            --

  `

  With function evalp the user can evaluate a polynomial expression at certain points.

- `>> p:= x^2*y^2+2: evalp(p,x=2); evalp(p,x=2,y=1 );`
  `

         2
      4 y  + 2

      6

  `

  The function norm computes the maximum-norm or the p-norm of a polynomial expression.

- `>> a:= 2*x+3: norm(a); norm(a,2);`
  `3
  3.605551275`

  Mapping a function to all coefficients.

- `>> mapcoeffs( a, sin );`
  `sin(3) + x sin(2)`

  Internally MuPAD use a special data type for polynomials. Polynomials of this type can be created by the user by using the function poly

- `>> poly( x^2*y^2 + x*y + 1 );`
  `

           /        2  2             \
      poly \ x y + x  y  + 1, [x, y] /

  `

  Using poly polynomials can be defined over predefined (also user-defined) rings or fields like Z/Z7.

- `>> poly( x^2*y^2 + 6*x*y - 2*x - 5, IntMod(7) );`
  `

           /                2  2                         \
      poly \ - 2 x - x y + x  y  + 2 , [x, y], IntMod(7) /

  `

  For polynomials the arithmetical operators +, -, * and ^ are defined as usual.

- `

      >> a:= poly(x^2*y^2-2, IntMod(7)): b:=poly(2*x+2*y,IntMod(7)):
         a + b; a * b; a^3;

  `
  `

           /              2  2                        \
      poly \ 2 x + 2 y + x  y  - 2, [x, y], IntMod(7) /

           /                2  3      3  2                    \
      poly \ 3 x + 3 y + 2 x  y  + 2 x  y , [x, y], IntMod(7) /

           /      2  2    4  4    6  6                         \
      poly \ - 2 x  y  + x  y  + x  y  - 1 , [x, y], IntMod(7) /

  `

  Each of the polynomial functions mentioned so far may also be used with polynomials instead of expressions. This is especially usefull in procedures, because polynomials can internally be handled much faster than expressions.

- `

      >> a:= poly( 2*x^3 + 7*x^2*y^2 + 5*y, [x,y] ):
         coeff(a); coeff(a, x,2); degreevec(a);

  `
  `

      2, 7, 5

           /    2      \
      poly \ 7 y , [y] /

      [3, 0]

  `

  Factorization of univariate polynomials over the finite fields Z/pZ (where p is prim) is also available.

- `>> factor( poly(6*x^2 + 18*x -24, IntMod(7)) );`
  `
  [- 1, poly(x-1,[x],IntMod(7)), 1, poly(x-3,[x],IntMod(7)), 1]`

  The user can also obtain a recursive representation of polynomials. Domains of polynomials created by Poly are used as coefficient domains.

- `>> a:= poly( 5*x^2*y^2 + 2*y + 3, [x], Poly([y]) );`
  `

           /                          /    2     \  2                      \
      poly \ poly(2 y +3, [y]) + poly \ 5 y, [y] / x, [x], Poly([y], Expr) /

  `

- `>> coeff( a );`
  `

           /    2      \
      poly \ 5 y , [y] /, poly(2 y + 3, [y])

  `

  At least we show an example for decomposing a polynomial. That is for a given polynomial P a sequence of polynomials P1,...,Pn such that P(X)=P1(P2(...(Pn(x))...)).

- `>> decompose( x^6+6*x^4+x^3+9*x^2+3*x-5 );`
  `

       2             3
      x + x  - 5, 3 x + x

  `

- `>> decompose( poly(x^4-3*x^3-x+5, [x], IntMod(5)) );`
  `

           /       2                \      /     2                \
      poly \- x + x , [x], IntMod(5)/, poly\x + x , [x], IntMod(5)/

  `

### Factorisation of polynomials

Factorization of polynomial over Z.

- `>> factor( x^3+1 );`
  `

      --                     2         --
      |  1, x + 1, 1, - x + x  + 1 , 1  |
      --                               --

  `

  Let's proof that the following polynomial P in Z is irreducible over Z (and therefore over the rationals Q).

- `

      >> P:= x^8+8*x^7+28*x^6+56*x^5+70*x^4+56*x^3+28*x^2+8*x^2+8*x+1:
         factor(P);

  `
  `

      --             2     3      4      5      6     7   8      --
      | 1, 8 x +36 x  +56 x  +70 x  +56 x  +28 x  +8 x  +x  +1, 1 |
      --                                                         --

  `

  An example with a result of a more complex structure:

- `>> factor( poly(x^26 + x^13 + 1, [x]) );`
  `

      --         /      2          \          /        3    4
      |  1, poly \ x + x  + 1, [x] /, 1, poly \ - x + x  - x  +
      --

       6    7    9    10    12    14    15    17    18    20
      x  - x  + x  - x   + x   - x   + x   - x   + x   - x   + x

                   21    23    24           \    --
                      - x   + x   + 1 , [x] /, 1  |
                                                 --

  `

  Factorization of polynomial in the field in Z/2Z:

- `>> factor( poly(x^3+1,[x],IntMod(2)) );`
  `

      --                                   /   2               \   --
      | 1, poly(x+1,[x],IntMod(2)), 1, poly\x+x+1,[x],IntMod(2)/, 1 |
      --                                                           --

  `

  Use the function Factor to get a more natural form of the factorization.

- `>> Factor( x^100-1 );`
  `

                      /  2     \ /      2    3    4     \ /
      (x - 1) (x + 1) \ x  + 1 / \ x + x  + x  + x  + 1 / \ - x

         2    3    4      \ /    2    4    6    8      \ /  5
      + x  - x  + x  + 1  / \ - x  + x  - x  + x  + 1  / \ x  +

       10    15    20     \ /    5    10    15    20      \ /
      x   + x   + x   + 1 / \ - x  + x   - x   + x   + 1  / \ -

                     10    20    30    40      \
                    x   + x   - x   + x   + 1  /

  `

### Polynomials over Gaussian Integers

- `>>`
  ``