# Modifiers

The following functions modify the representation of the power series or apply a simple automorphism.

## `ScaleGenerators(s, ls): RngPowAlgElt, SeqEnum -> RngPowAlgElt`

Let $\{\gamma_i\}_i$ be the basis (determined from the representation chosen by Magma) of the exponent lattice of the series $s$, and let $\sigma: {\underline x}^{\gamma_i} \mapsto ls[i] {\underline x}^{\gamma_i}$. Return the series $\sigma(s)$.

## `ChangeRing(s, R): RngPowAlgElt, RngMPol -> RngPowAlgElt`

If $R$ is a multivariate polynomial domain compatible with the approximation domain `Domain(s)`, return the same power series with new approximation domain $R$. This is sort of a “coercion between power series rings”.

## `SimplifyRep(s): RngPowAlgElt -> RngPowAlgElt`

```magma
Factorizing: BoolElt                    Default: true
```

“Simplifies” the internal representation of a series. The result will be a series of atomic type without recursive (substitution) dependencies on other power series. The defining polynomial of the simplified series will be irreducible and therefore a minimal polynomial over `Domain(s)` (unless `Factorizing` is `false` when it will only be guaranteed to be squarefree). After the simplification, [`DefiningPolynomial`](accessors.md#function-rpa-defp) returns this polynomial, which can be useful (*e.g.*, for [`IsPolynomial`](preds.md#function-rpa-isp)). However, experience shows that the resulting representation is in general neither simple nor more efficient for subsequent computations.

There is a **dangerous pitfall:**

Assume we have a series represented by a tree with nodes of type A and B. Assume further that the leaves have been constructed by [`RationalPuiseux`](cons.md#function-rpa-pui) with parameter `Gamma` set to some value. Then the intention was probably to work over the subring of a polynomial ring with restricted support. If now `SimplifyRep`, with `Factorizing` as `true`, is called, then a minimal polynomial over the whole polynomial ground ring is computed which is maybe not what one wants.

## `Example: scale (ex-e60c95)`

We can modify `s2` by mapping generators (of Laurent polynomials) $x^{1/5}y^{-2/5} \mapsto 3 x^{1/5}y^{-2/5}$ and $x^{2/5}y^{1/5} \mapsto 4 x^{2/5}y^{1/5}$.

```magma
> Expand(ScaleGenerators(s2, [3,4]), 15);
true
64/81*x^2*y^11 - 64/3*x^5*y^5 - 16/9*x^2*y^6 + 48*x^5 + 4*x^2*y

```

One can naturally view `h1` as a series in ${\mathbb{Q}}(i)[[u,v]]$.

```magma
> Qi<i> := NumberField(R.1^2 + 1) where R is PolynomialRing(Q);
> Qiuv<u,v> := PolynomialRing(Qi, 2, "glex");
> h4 := ChangeRing(s1, Qiuv);
> Expand(h4, 4); Domain(h4);
true u^3 + 3*u^2*v + 3*u*v^2 + v^3 + u^2 + 2*u*v + v^2 + u + v
Polynomial ring of rank 2 over Qi
Graded Lexicographical Order
Variables: u, v

```

We have seen that the power series `h3` is zero, but its representation does not show this immediately. We can “explicitize” its representation.

```magma
> SimplifyRep(h3 : Factorizing := true);
Algebraic power series
0
> DefiningPolynomial($1);
z

```
