Documentation

# `polylib`::`primpart`

Primitive part 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

```polylib::primpart(`f`)
polylib::primpart(`q`)
polylib::primpart(`{xpr}`, <`{inds}`>)
```

## Description

`polylib::primpart(f)` returns the primitive part of the polynomial `f`.

If the input is a `polynomial`, the greatest common divisor of its coefficients is removed. The function `gcd` must be able to calculate this gcd.

If the first argument is an expression, it is converted into a polynomial in the indeterminates specified by the second argument, or in all of its indeterminates if no second argument is given. `polylib::primpart` returns `FAIL` if the expression cannot be converted into a polynomial.

For a rational number, its sign is returned.

## Examples

### Example 1

In the following example, a bivariate polynomial is given. Its coefficients are the integers 3, 6, and 9; the primitive part is obtained by dividing the polynomial by their gcd.

`polylib::primpart(poly(6*x^3*y + 3*x*y + 9*y, [x, y]));`

However, consider the same polynomial viewed as a univariate polynomial in `x`. Its coefficients are polynomials in `y` in this case, and their gcd `3*y` is divided off.

`polylib::primpart(poly(6*x^3*y + 3*x*y + 9*y, [x]));`

### Example 2

`polylib::primpart` divides the coefficients by their gcd, but does not normalize the result. This must be done explicitly:

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

`normal(polylib::primpart(4*x*y + 6*x^3 + 6*x*y^2 + 9*x^3*y, [x]))`

## Parameters

 `f` Polynomial `q` Rational number `xpr` Expression `inds` List of identifiers

## Return Values

`polylib::primpart` returns an object of the same type as the input, or `FAIL`.

`f`

## Algorithms

The primitive part of a polynomial f is a polynomial g whose coefficients are relatively prime such that f = rg for some element r of the coefficient ring.