# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

# `linalg`::`sylvester`

Sylvester matrix of two polynomials

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

## Syntax

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

## Description

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

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.

## Examples

### Example 1

The Sylvester matrix of the two polynomials p = x2 + 2 x - 1 and q = x4 + 1 over is the following 6×6 matrix:

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

### 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)) )```

`domtype(S)`

### 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)```

`domtype(S)`

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

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

### 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)```

`domtype( T )`

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)`

## Parameters

 `p`, `q` Polynomials `f`, `g` Polynomials or polynomial expressions of positive degree `x` A variable

## Return Values

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