---
title: "Structure Operations"
canonical: "https://docs.magma-maths.org/v2.30-1/BasicRings/MultivariatePolynomialRings/operation.html"
source: "https://docs.magma-maths.org/v2.30-1/BasicRings/MultivariatePolynomialRings/operation.md"
part: "Basic Rings"
chapter: "Multivariate Polynomial Rings"
breadcrumbs:
  - {"title": "Magma Handbook", "source": "https://docs.magma-maths.org/v2.30-1/index.md"}
  - {"title": "Basic Rings", "source": "https://docs.magma-maths.org/v2.30-1/BasicRings/index-basic-rings.md"}
  - {"title": "Multivariate Polynomial Rings", "source": "https://docs.magma-maths.org/v2.30-1/BasicRings/MultivariatePolynomialRings/index-multivariate-polynomial-rings.md"}
prev: {"title": "Polynomial Rings and Polynomials", "source": "https://docs.magma-maths.org/v2.30-1/BasicRings/MultivariatePolynomialRings/rings.md"}
next: {"title": "Element Operations", "source": "https://docs.magma-maths.org/v2.30-1/BasicRings/MultivariatePolynomialRings/operation-element.md"}
intrinsics:
  - {"name": "BaseRing", "signature": "BaseRing(P): RngMPol -> Rng"}
  - {"name": "CoefficientRing", "signature": "CoefficientRing(P): RngMPol -> Rng"}
  - {"name": "Category", "signature": "Category(P): RngMPol -> Cat"}
  - {"name": "Parent", "signature": "Parent(P): RngMPol -> Pow"}
  - {"name": "PrimeRing", "signature": "PrimeRing(P): RngMPol -> Rng"}
  - {"name": "Rank", "signature": "Rank(P): RngMPol -> RngIntElt"}
  - {"name": "Characteristic", "signature": "Characteristic(P): RngMPol -> RngIntElt"}
  - {"name": "#", "signature": "#P: RngMPol -> RngIntElt"}
  - {"name": "IsCommutative", "signature": "IsCommutative(P): RngMPol -> BoolElt"}
  - {"name": "IsUnitary", "signature": "IsUnitary(P): RngMPol -> BoolElt"}
  - {"name": "IsFinite", "signature": "IsFinite(P): RngMPol -> BoolElt"}
  - {"name": "IsOrdered", "signature": "IsOrdered(P): RngMPol -> BoolElt"}
  - {"name": "IsField", "signature": "IsField(P): RngMPol -> BoolElt"}
  - {"name": "IsEuclideanDomain", "signature": "IsEuclideanDomain(P): RngMPol -> BoolElt"}
  - {"name": "IsPID", "signature": "IsPID(P): RngMPol -> BoolElt"}
  - {"name": "IsUFD", "signature": "IsUFD(P): RngMPol -> BoolElt"}
  - {"name": "IsDivisionRing", "signature": "IsDivisionRing(P): RngMPol -> BoolElt"}
  - {"name": "IsEuclideanRing", "signature": "IsEuclideanRing(P): RngMPol -> BoolElt"}
  - {"name": "IsDomain", "signature": "IsDomain(P): RngMPol -> BoolElt"}
  - {"name": "IsPrincipalIdealRing", "signature": "IsPrincipalIdealRing(P): RngMPol -> BoolElt"}
  - {"name": "eq", "signature": "P eq Q: RngMPol, RngMPol -> BoolElt"}
  - {"name": "ne", "signature": "P ne Q: RngMPol, RngMPol -> BoolElt"}
  - {"name": "ChangeRing", "signature": "ChangeRing(P, S): RngMPol, Rng -> RngMPol"}
  - {"name": "hom", "signature": "hom< P -> S | f, y₁, ..., yₙ >: RngMPol, Rng -> Map"}
  - {"name": "hom", "signature": "hom< P -> S | y₁, ..., yₙ >: RngMPol, Rng -> Map"}
examples:
  - "ex-a59b0c"
---

# Structure Operations

## Related Structures

The main structure related to a polynomial ring is its coefficient ring. Multivariate polynomial rings belong to the Magma category `RngMPol`.

<a id="function-basering-rngmpol"></a>
### `BaseRing(P): RngMPol -> Rng`

<a id="function-coefficientring-rngmpol"></a>
### `CoefficientRing(P): RngMPol -> Rng`

Return the coefficient ring of polynomial ring $P$.

<a id="function-category-rngmpol"></a>
### `Category(P): RngMPol -> Cat`

<a id="function-parent-rngmpol"></a>
### `Parent(P): RngMPol -> Pow`

<a id="function-primering-rngmpol"></a>
### `PrimeRing(P): RngMPol -> Rng`

## Numerical Invariants

Note that the `#` operator only returns a value for finite (quotients of) polynomial rings.

<a id="function-rank-rngmpol"></a>
### `Rank(P): RngMPol -> RngIntElt`

Return the number of indeterminates of polynomial ring $P$ over its coefficient ring.

<a id="function-characteristic-rngmpol"></a>
### `Characteristic(P): RngMPol -> RngIntElt`

<a id="operation-operation-rngmpol-rngintelt"></a>
### `#P: RngMPol -> RngIntElt`

## Ring Predicates and Booleans

The usual ring functions returning Boolean values are available on polynomial rings.

<a id="function-iscommutative-rngmpol"></a>
### `IsCommutative(P): RngMPol -> BoolElt`

<a id="function-isunitary-rngmpol"></a>
### `IsUnitary(P): RngMPol -> BoolElt`

<a id="function-isfinite-rngmpol"></a>
### `IsFinite(P): RngMPol -> BoolElt`

<a id="function-isordered-rngmpol"></a>
### `IsOrdered(P): RngMPol -> BoolElt`

<a id="function-isfield-rngmpol"></a>
### `IsField(P): RngMPol -> BoolElt`

<a id="function-iseuclideandomain-rngmpol"></a>
### `IsEuclideanDomain(P): RngMPol -> BoolElt`

<a id="function-ispid-rngmpol"></a>
### `IsPID(P): RngMPol -> BoolElt`

<a id="function-isufd-rngmpol"></a>
### `IsUFD(P): RngMPol -> BoolElt`

<a id="function-isdivisionring-rngmpol"></a>
### `IsDivisionRing(P): RngMPol -> BoolElt`

<a id="function-iseuclideanring-rngmpol"></a>
### `IsEuclideanRing(P): RngMPol -> BoolElt`

<a id="function-isdomain-rngmpol"></a>
### `IsDomain(P): RngMPol -> BoolElt`

<a id="function-isprincipalidealring-rngmpol"></a>
### `IsPrincipalIdealRing(P): RngMPol -> BoolElt`

<a id="operation-op-eq-rngmpol-rngmpol"></a>
### `P eq Q: RngMPol, RngMPol -> BoolElt`

<a id="operation-op-ne-rngmpol-rngmpol"></a>
### `P ne Q: RngMPol, RngMPol -> BoolElt`

## Changing Coefficient Ring

The `ChangeRing` function enables the changing of the coefficient ring of a polynomial ring.

<a id="function-changering-rngmpol-rng"></a>
### `ChangeRing(P, S): RngMPol, Rng -> RngMPol`

Given a polynomial ring $P=R[x_1, \ldots, x_n]$ of rank $n$ with coefficient ring $R$, together with a ring $S$, construct the polynomial ring $Q=S[x_1, \ldots, x_n]$. It is necessary that all elements of the old coefficient ring $R$ can be automatically coerced into the new coefficient ring $S$.

## Homomorphisms

In its general form, a ring homomorphism taking a polynomial ring $R[x_1, \ldots, x_n]$ as domain requires $n+1$ pieces of information, namely, a map (homomorphism) telling how to map the coefficient ring $R$ together with the images of the $n$ indeterminates.

<a id="constructor-constructor-hom-rngmpol-rng-map"></a>
### `hom< P -> S | f, y₁, ..., yₙ >: RngMPol, Rng -> Map`

<a id="constructor-constructor-hom-rngmpol-rng-map-2"></a>
### `hom< P -> S | y₁, ..., yₙ >: RngMPol, Rng -> Map`

Given a polynomial ring $P=R[x_1,\ldots, x_n]$, a ring $S$, a map $f : R\ar S$, and $n$ elements $y_1, \ldots, y_n\in S$, create the homomorphism $g : P\ar S$ by applying the rules that $g(rx_1^{a_1}\cdots x_n^{a_n})=f(r)y_1^{a_1}\cdots y_n^{a_n}$ for monomials and linearity, that is, $g(M+N)=g(M)+g(N)$. The coefficient ring map may be omitted, in which case the coefficients are mapped into $S$ by the unitary homomorphism sending $1_R$ to $1_S$. Also, the images $y_i$ are allowed to be from a structure that allows automatic coercion into $S$.

<a id="example-ex-a59b0c"></a>
### `Example: Homomorphism into a Number Field (ex-a59b0c)`

In this example we map ${\mathbb{Q}}[x, y]$ into the number field ${\mathbb{Q}}(\root 3 \of 2, \sqrt{5})$ by sending $x$ to $\root 3 \of 2$ and $y$ to $\sqrt{5}$ and the identity map on the coefficients (which we omit).

```magma
> Q := RationalField();
> R<x, y> := PolynomialRing(Q, 2);
> A<a> := PolynomialRing(IntegerRing());
> N<z, w> := NumberField([a^3-2, a^2+5]);
> h := hom< R -> N | z, w >;
> h(x^11*y^3-x+4/5*y-13/4);
-40*w*z^2 - z + 4/5*w - 13/4
```
