## `linalg::sylvester` -- Sylvester matrix of two polynomials

#### Introduction

`linalg::sylvester``(p, q)` returns the Sylvester matrix of the two polynomials p and q.

#### Call(s)

`linalg::sylvester(p, q)`
`linalg::sylvester(f, g, x)`

#### Parameters

`p, q` | - | polynomials
`f, g` | - | polynomials or polynomial expressions of positive degree
`x` | - | a variable

#### Returns

a matrix of the domain `Dom::Matrix(R)`, where `R` is the coefficient domain of the polynomials (see below).

#### Related Functions

`polylib::discrim`, `polylib::resultant`

#### Details

- If no variable is specified, then the polynomials `p` and `q` must be either of the domain `DOM_POLY` or from a domain of category `Cat::Polynomial`. Polynomial expressions are not allowed.
- If the polynomials `p` and `q` are of the domain `DOM_POLY`, then they must be univariate polynomials. The component ring of the Sylvester matrix is the common coefficient ring R of `p` and `q`, except in the following two cases for built-in coefficient rings: If R is `Expr` then the domain `Dom::ExpressionField()` is the component ring of the Sylvester matrix. If R is `IntMod(m)`, then the Sylvester matrix is defined over the ring `Dom::IntegerMod(m)` (see example 2).
- Otherwise, if the polynomials `p` and `q` are from a domain of category `Cat::Polynomial`, then the Sylvester matrix is computed with respect to the main variable of `p` and `q` (see the method `"mainvar"` of the category `Cat::Polynomial`). In the case of univariate polynomials the Sylvester matrix is defined over the common coefficient ring of `p` and `q`. In the case of multivariate polynomials, the Sylvester matrix is defined over the component ring `Dom::DistributedPolynomial(ind, R)`, where `ind` is the list of all variables of `p` and `q` except `x`, and `R` is the common coefficient ring of the polynomials.
- If `f` and `g` are polynomial expressions or multivariate polynomials of type `DOM_POLY`, then you must specifiy the variable `x`.
- In the case of polynomial expressions, the component ring of the Sylvester matrix is the domain `Dom::ExpressionField()` (see example 3).
- In the case of multivariate polynomials the Sylvester matrix is defined over the component ring `Dom::DistributedPolynomial(ind, R)`, where `ind` is the list of all variables of `f` and `g` except `x`, and `R` is the common coefficient ring of the polynomials (see example 4).
- At least one of the input polynomials must have positive degree with respect to the main variable or `x`, respectively, but it is not necessary that both of them have positive degree.

#### Example 1

The Sylvester matrix of the two polynomials p = x^2+2*x-1 and q = x^4+1 over Z is the following 6 x 6 matrix:

    >> delete x: Z := Dom::Integer:
       S := linalg::sylvester(poly(x^2 + 2*x - 1, Z), poly(x^4 + 1, Z))

                            +-                      -+
                            |  1, 2, -1,  0,  0,  0  |
                            |                        |
                            |  0, 1,  2, -1,  0,  0  |
                            |                        |
                            |  0, 0,  1,  2, -1,  0  |
                            |                        |
                            |  0, 0,  0,  1,  2, -1  |
                            |                        |
                            |  1, 0,  0,  0,  1,  0  |
                            |                        |
                            |  0, 1,  0,  0,  0,  1  |
                            +-                      -+

#### Example 2

If the polynomials have the built-in coefficient ring `IntMod(m)`, then the Sylvester matrix is defined over the domain `Dom::IntegerMod(m)`:

    >> delete x:
       S:= linalg::sylvester(
         poly(x + 1, IntMod(7)), poly(x^2 - 2*x + 2, IntMod(7))
       )

                          +-                           -+
                          |  1 mod 7, 1 mod 7, 0 mod 7  |
                          |                             |
                          |  0 mod 7, 1 mod 7, 1 mod 7  |
                          |                             |
                          |  1 mod 7, 5 mod 7, 2 mod 7  |
                          +-                           -+

    >> domtype(S)

                          Dom::Matrix(Dom::IntegerMod(7))

#### Example 3

The Sylvester matrix of the following two polynomial expressions with respect to the variable `x` is:

    >> delete x, y:
       S := linalg::sylvester(x + y^2, 2*x^3 - 1, x)

                                +-               -+
                                |      2          |
                                |  1, y ,  0,  0  |
                                |                 |
                                |          2      |
                                |  0,  1, y ,  0  |
                                |                 |
                                |              2  |
                                |  0,  0,  1, y   |
                                |                 |
                                |  2,  0,  0, -1  |
                                +-               -+

    >> domtype(S)

                                   Dom::Matrix()

The Sylvester matrix of these two polynomials with respect to `y` is the following 2 x 2 matrix:

    >> linalg::sylvester(x + y^2, 2*x^3 - 1, y)

                             +-                    -+
                             |     3                |
                             |  2 x  - 1,     0     |
                             |                      |
                             |               3      |
                             |      0,    2 x  - 1  |
                             +-                    -+

#### Example 4

Here is an example for computing the Sylvester matrix of multivariate polynomials:

    >> delete x, y: Q := Dom::Rational:
       T := linalg::sylvester(poly(x^2 - x + y, Q), poly(x + 2, Q), x)

                                  +-          -+
                                  |  1, -1, y  |
                                  |            |
                                  |  1,  2, 0  |
                                  |            |
                                  |  0,  1, 2  |
                                  +-          -+

    >> domtype( T )

          Dom::Matrix(Dom::DistributedPolynomial([y], Dom::Rational,

             LexOrder))

The Sylvester matrix of these two multivariate polynomials with respect to `y` is:

    >> linalg::sylvester(poly(x^2 - x + y, Q), poly(x + 2, Q), y)

                                     +-     -+
                                     | x + 2 |
                                     +-     -+

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000