# `polylib`::`coeffRing`

Coefficient ring 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::coeffRing(`P`)
polylib::coeffRing(`p`)
```

## Description

`polylib::coeffRing(p)` returns the coefficient ring of `p`.

`polylib::coeffRing`(p) allows to query in a uniform way the coefficient ring of the polynomial `p` or the polynomial domain `P`.

`P` can be any polynomial domain (`Dom::UnivariatePolynomial`x, `Dom::DistributedPolynomial`[x,y], ...).

`P` can also be of the form `polylib::Poly([x,y],K)`. If `K` is `Expr` or `IntMod(n)`, then the corresponding domains `Dom::ExpressionField()` or `Dom::IntegerMod(p)` is returned. See `poly` for the details about `Expr` and `IntMod(n)`.

`p` can be a kernel polynomial (`DOM_POLY`), or an element of one of the above domains

## Examples

### Example 1

We define a polynomial ring over the ring of integers modulo 4, and query for its coefficient ring:

```P := Dom::UnivariatePolynomial(x, Dom::IntegerMod(4)): polylib::coeffRing(P)```

The coefficient ring of the elements of this domain can be queried the same way:

`polylib::coeffRing(P(x))`

`polylib::coeffRing(Dom::Matrix(Dom::IntegerMod(3)))`

### Example 2

When no coefficient ring is specified, `poly` currently constructs kernel polynomials over the fake domain Expr instead of the mathematically equivalent field `Dom::ExpressionField()` of arbitrary expression (this happens to be more efficient with the current kernels):

`extop(poly(x))`

`polylib::coeffRing(poly(x))`

This makes it possible to plug the result right away as coefficient ring of some other domain:

`Dom::UnivariatePolynomial(x, polylib::coeffRing(poly(x)))`

## Parameters

 `P` A polynomial domain `p` A polynomial

## Return Values

Domain

#### Mathematical Modeling with Symbolic Math Toolbox

Get examples and videos