Documentation

# `content`

Content of a polynomial

MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

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

## Syntax

```content(`p`)
content(`f`, <`vars`>)
```

## Description

`content(p)` computes the content of the polynomial `p` or polynomial expression, i.e., the greatest common divisor of its coefficients.

If `p` is the zero polynomial, then `content` returns 0.

If `p` is a non-zero polynomial with coefficient ring `IntMod(n)` and `n` is a prime number, then `content` returns 1. If `n` is not a prime number, an error message is issued.

If `p` is a polynomial with a library domain `R` as coefficient ring, the `gcd` of its coefficients is computed using the slot `gcd` of `R`. If no such slot exists, then `content` returns `FAIL`.

If `p` is a polynomial with coefficient ring `Expr`, then `content` does the following.

If all coefficients of `p` are either integers or rational numbers, `content(p)` is equivalent to `gcd(coeff(p))`, and the return value is a positive integer or rational number. See Example 1.

If at least one coefficient is a floating point number or a complex number and all other coefficients are numbers, then `content` returns 1. See Example 2.

If at least one coefficient is not a number and all coefficients of `p` can be converted into polynomials via `poly`, then `content(p)` is equivalent to `gcd(coeff(p))`. See Example 3.

Otherwise, `content` returns 1.

A polynomial expression `f` is converted into a polynomial with coefficient ring `Expr` via `p :=````poly(f, vars)```, and then `content` is applied to `p`. See Example 1.

Use `icontent` for polynomials that are known to have integer or rational coefficients, since it is much faster than `content`.

Dividing the coefficients of `p` by its content gives its primitive part. This one can also be obtained directly using `polylib::primpart`.

## Examples

### Example 1

If `p` is a polynomial with integer or rational coefficients, the result is the same as for `icontent`:

`content(poly(6*x^3*y + 3*x*y + 9*y, [x, y]))`
` `

The following call, where the first argument is a polynomial expression and not a polynomial, is equivalent to the one above:

`content(6*x^3*y + 3*x*y + 9*y, [x, y])`
` `

If no list of indeterminates is specified, then `poly` converts the expression into a polynomial with respect to all occurring indeterminates, and we obtain yet another equivalent call:

`content(6*x^3*y + 3*x*y + 9*y)`
` `

Above, we considered the polynomial as a bivariate polynomial with integer coefficients. We can also consider the same expression as a univariate polynomial in `x`, whose coefficients contain a parameter `y`. Then the coefficients and their gcd—the content—are polynomial expressions in `y`:

`content(poly(6*x^3*y + 3*x*y + 9*y, [x]))`
` `

Here is another example where the coefficients and the content are again polynomial expressions:

`content(poly(4*x*y + 6*x^3 + 6*x*y^2 + 9*x^3*y, [x]))`
` `

The following call is equivalent to the previous one:

`content(4*x*y + 6*x^3 + 6*x*y^2 + 9*x^3*y, [x])`
` `

### Example 2

If a polynomial or polynomial expression has numeric coefficients and at least one floating-point number is among them, its content is 1:

`content(2.0*x+2.0)`
` `

### Example 3

If not all of the coefficients are numbers, the gcd of the coefficients is returned:

`content(poly(x^2*y+x, [y]))`
` `

## Parameters

 `p` A polynomial of type `DOM_POLY` `f` `vars` A list of indeterminates of the polynomial: typically, identifiers or indexed identifiers

## Return Values

an object of the same type as the coefficients of the polynomial or the value `FAIL`.

`p`