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

### `BaseRing(P): RngMPol -> Rng`

### `CoefficientRing(P): RngMPol -> Rng`

Return the coefficient ring of polynomial ring $P$.

### `Category(P): RngMPol -> Cat`

### `Parent(P): RngMPol -> Pow`

### `PrimeRing(P): RngMPol -> Rng`

## Numerical Invariants

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

### `Rank(P): RngMPol -> RngIntElt`

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

### `Characteristic(P): RngMPol -> RngIntElt`

### `#P: RngMPol -> RngIntElt`

## Ring Predicates and Booleans

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

### `IsCommutative(P): RngMPol -> BoolElt`

### `IsUnitary(P): RngMPol -> BoolElt`

### `IsFinite(P): RngMPol -> BoolElt`

### `IsOrdered(P): RngMPol -> BoolElt`

### `IsField(P): RngMPol -> BoolElt`

### `IsEuclideanDomain(P): RngMPol -> BoolElt`

### `IsPID(P): RngMPol -> BoolElt`

### `IsUFD(P): RngMPol -> BoolElt`

### `IsDivisionRing(P): RngMPol -> BoolElt`

### `IsEuclideanRing(P): RngMPol -> BoolElt`

### `IsDomain(P): RngMPol -> BoolElt`

### `IsPrincipalIdealRing(P): RngMPol -> BoolElt`

### `P eq Q: RngMPol, RngMPol -> BoolElt`

### `P ne Q: RngMPol, RngMPol -> BoolElt`

## Changing Coefficient Ring

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

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

### `hom< P -> S | f, y₁, ..., yₙ >: RngMPol, Rng -> Map`

### `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\rightarrow S$ and $n$ elements $y_1, \ldots, y_n\in S$, create the homomorphism $g : P\rightarrow 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$.

### `Example: Homomorphism (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

```
