# Constructors

Using constructors one can construct power series starting from polynomial data or using other power series recursively.

## `PolyToSeries(s): RngMPolElt -> RngPowAlgElt`

Given a multivariate polynomial $s$, returns the series representation of $s$.

## `AlgebraicPowerSeries(dp, ip, L, e): RngUPolElt, RngMPolElt, Lat, RngIntElt -> RngPowAlgElt`

## `AlgebraicPowerSeries(dp, ip, e): RngUPolElt, RngMPolElt, RngIntElt -> RngPowAlgElt`

## `AlgebraicPowerSeries(dp, ip): RngUPolElt, RngMPolElt -> RngPowAlgElt`

```magma
subs: SeqEnum                    Default: []
```

Define a power series root of a polynomial $p$ using an initial expansion $ip$ and its exponent lattice $1/\hbox{\tt e}~\hbox{\tt L}$. The defining polynomial $p$ is either $dp$ when $subs$ is empty or obtained by substituting the elements of $subs$ into the variables of $dp$. The initial expansion has to be sufficiently long in order to uniquely identify a root, see [[Beck, 2007](../../references.md#cite-tb2007), Cond. 4.3]. In this initial finite expansion and in subsequent ones, the variables occurring actually represent $e$-th roots, *ie* $x_1x_2^2$ is really $x_1^{1/e}x_2^{2/e}$. All exponents of monomials occurring in these expansions and the coefficients of $p$ should lie in $L$ (although this is not checked in many places), monomials of $p$ giving true values rather than $e$-th roots.

There are simpler constructors where $L$ is omitted (when it is assumed to be the standard integral lattice) or $e$ is (when it is taken as 1).

As noted earlier, no strong checks are performed at construction time on the correctness of $L$ or $e$ or whether $ip$ is indeed the initial expansion of a unique root in this “raw data” constructor. Incorrect initial data will only be revealed when failure occurs in further expansion of the series. The preferred methods of series creation are [`ImplicitFunction`](#function-rpa-imp), [`EvaluationPowerSeries`](#function-rpa-eval) and [`RationalPuiseux`](#function-rpa-pui) because in these cases the sanity checks are more easily verified.

## `EvaluationPowerSeries(s, nu, v): Tup, SeqEnum, SeqEnum -> RngPowAlgElt`

Given a series $s$, a sequence $nu$ of vectors in the dual of its exponent lattice of $s$ and a sequence $v$ (of the same length) of power series in some other common domain (with compatible coefficient field). Returns the series obtained by substituting ${\underline x}^{\mu} \mapsto \prod_i \hbox{\tt v[i]}^{\langle \hbox{\tt nu[i]}, \mu \rangle}$. This requires that $nu$ and $v$ fulfill a certain condition on the orders to guarantee convergence of the resulting series, see [[Beck, 2007](../../references.md#cite-tb2007), Cond. 4.6].

## `ImplicitFunction(dp): RngUPolElt -> RngPowAlgElt`

```magma
subs: SeqEnum                    Default: []
```

The unique series with zero constant term defined by a polynomial $p \in k[x_1,..,x_n][z]$ or $k[[x_1,\dots,x_n]][z]$, fulfilling the conditions of the implicit function theorem, *i.e.*, $p(0,\dots,0)=0$ and $\partial p / \partial z(0,\dots,0) \neq 0$. The polynomial $p$ is equal to $dp$ possibly substituted with the series in $subs$ as in [`AlgebraicPowerSeries`](#function-rpa-aps). $dp$ should have coefficients in a multivariate polynomial ring.

## Rational Puiseux Expansions

Let $p \in k[[x_1,\dots,x_n]][z]$ be a quasi-ordinary polynomial over a field $k$ of characteristic zero. This means that $p$ is non-zero, squarefree and monic (i.e., its leading coefficient in $z$ is a unit in the power series ring) and if $d \in k[[x_1,\dots,x_n]]$ denotes its discriminant then $d = x_1^{e_1} \cdots x_n^{e_n} u(x_1,\dots,x_n)$ where $u$ is a unit in the power series ring.

In this case the Theorem of Jung-Abhyankar states that $p$ has $\deg(p)$ distinct Puiseux series roots, i.e., power series roots with fractionary exponents and coefficients in the algebraic closure of $k$.

These roots are computed by a generalization of the so called Newton-Puiseux algorithm. Also Duval’s extension for computing rational parametrization has been implemented.

### `RationalPuiseux(p): RngUPolElt -> Tup, SeqEnum, RngIntElt`

```magma
Gamma       : Lattice                      Default: StandardLattice
subs        : SeqEnum                      Default: []
Duval       : BoolElt                      Default: false
OnlySingular: BoolElt                      Default: false
ExtName     : MonStgElt                    Default: "gamma"
ExtCount    : RngIntElt                    Default: 0
```

We first specify the behavior of this function in the case that no special value of $subs$ has been given. This function assumes that $p$ is a univariate polynomial over a multivariate polynomial ring $S = k[x_1, ..., x_r]$ and that $p$ is quasi-ordinary. In this case it will compute a set of rational parametrizations of $p$. Note that for reasons of efficiency the user has to make sure that $p$ is actually quasi-ordinary! (Otherwise, further processing of the output may result in runtime errors.)

The first return value will be the exponent lattice of the input polynomial in the usual format $<\Gamma_0, e_0>$. If the parameter `Gamma` has been specified, then $\Gamma_0 = \hbox{\tt Gamma}$ and $e_0 = 1$. In this case `Gamma` has to be an integral ‘r’-dimensional lattice of full rank containing all the exponents of $p$. Otherwise $\Gamma_0$ will be set to the $r$-dimensional standard lattice and again $e_0=1$.

As a second value a complete list of rational parametrizations in the format $<\lambda, s, N, E>$ is returned. Here $\lambda$ is a sequence of $r$ field elements and $s$ is a fractionary algebraic power series of type `RngPowAlgElt`. Let $p_1$ denote the image of $p$ under the transformation $x^{\mu_i} \mapsto \lambda_i x^{\mu_i}$ where $(\mu_i)_i$ is the basis of the exponent lattice $e_0^{-1} \Gamma_0$ then $s$ is a solution of $p_1$, i.e., we have $p_1(s) = 0$. Note that if neither `Gamma` nor `subs` have been supplied this just means that $x_i$ is substituted by $\lambda_i x_i$. Finally $N$ is the index of $e_0^{-1} \Gamma_0$ in the exponent lattice of $s$ and $E$ is the degree of the extension of the coefficient field needed for defining $s$.

The behavior described above corresponds to the Newton-Puiseux algorithm with Duval’s trick. The field extensions that are used for expressing the series fulfill a certain minimality condition. If `Duval` is set to `false` then the function returns a complete set of representatives (up to conjugacy) of Puiseux series roots of the original polynomial $p$, in other words, the $\lambda$-vectors will always be vectors of ones.

If `OnlySingular` is set to `true` then only those parametrizations that correspond to singular branches are returned.

If the ground field has to be extended, the algebraic elements will be assigned the name $\hbox{\tt ExtName}\_i$ where $i$ starts from `ExtCount`. The last return value is the value of `ExtCount` plus the number of field extensions that have been introduced during the computation.

Finally, if the parameter `subs` is passed, then it has to be a sequence of $r$ power series in a common domain and internally the variables in $p$ will be substituted by the corresponding series. Again the resulting polynomial has to be quasi-ordinary. In this case $\Gamma_0$ and $e_0$ are determined by building the sum of the exponent lattices of all series in `subs`. The parameter `Gamma` then has no effect.

For further details on the algorithm and other references see [[Beck, 2007](../../references.md#cite-tb2007), Sec. 4.3]

### `Example: constructors (ex-da4682)`

We illustrate the constructors by examples. For displaying results we already use the command [`Expand`](accessors.md#function-rpa-exp) that will be explained later.

```magma
> Q := Rationals(); Qs<s> := FunctionField(Q);
> Qxy<x,y> := PolynomialRing(Q, 2, "glex");
> Qxyz<z> := PolynomialRing(Qxy);
> Qst<t> := PolynomialRing(Qs, 1, "glex");
> Qstu<u> := PolynomialRing(Qst);

```

One can consider polynomials as series.

```magma
> s0 := PolyToSeries(1 - 3*x + x^2*y + y^20);
> Expand(s0, 10);
true x^2*y - 3*x + 1

```

One can define series by the implicit function theorem at the origin.

```magma
> s1 := ImplicitFunction(z*(1 - x - y) - x - y);
> Expand(s1, 4);
true x^3 + 3*x^2*y + 3*x*y^2 + y^3 + x^2 + 2*x*y + y^2 + x + y

```

One can define a power series if an initial expansion is known. Note that the following power series has exponent lattice ${\mathbb{Z}}({{1}\over{5}},-{{2}\over{5}}) + {\mathbb{Z}}({{2}\over{5}},{{1}\over{5}})$ but its “expansions” are polynomials supported on ${\mathbb{Z}}(1,-2) +  {\mathbb{Z}}(2,1)$.

```magma
> defpol := (1+5*y+10*y^3+10*y^2+5*y^4+y^5)*z^5+(-20*y^3*x-
>   30*y^2*x-5*y^4*x-5*x-20*y*x)*z^4+(10*x^2+30*y^2*x^2+10*y^3*x^2+
>   30*x^2*y)*z^3+(-20*y*x^3-10*x^3-10*y^2*x^3)*z^2+
>   (5*y*x^4+5*x^4)*z-x^5-x^2*y;
> Gamma := Lattice(RMatrixSpace(Integers(), 2, 2) ! [1,-2, 2,1]);
> init := x^2*y;
> s2 := AlgebraicPowerSeries(defpol, init, Gamma, 5);
> Expand(s2, 20);
true
-x^2*y^16 + x^5*y^10 + x^2*y^11 - x^5*y^5 - x^2*y^6 + x^5 + x^2*y

```

We can “substitute” series into each other.

```magma
> X := AlgebraicPowerSeries(u^3-t+s*t^2, t, StandardLattice(1), 3);
> Y := PolyToSeries(t);
> duals := [RSpace(Integers(), 2) | [1, 3], [2, 1]];
> s3 := EvaluationPowerSeries(s2, duals, [X, Y]);
> Expand(s3, 13);
true (-1/9*s^2 - 1/3*s - 1)*t^10 + (-1/3*s + 1)*t^7 + t^4

```

We can compute all the Puiseux series roots of a quasi-ordinary polynomial up to conjugacy over ${\mathbb{Q}}$.

```magma
> qopol := z^6 + 3*x*y^2*z^4 + x*y*z^3 + 3*x^2*y^4*z^2 + x^3*y^6;
> _, prms := RationalPuiseux(qopol : Duval := false); prms;
[*
    <[ 1, 1 ], Algebraic power series -x*y, 3, 1>,
    <[ 1, 1 ], Algebraic power series gamma_0*x*y, 3, 2>,
    <[ 1, 1 ], Algebraic power series -x^2*y^5, 3, 1>,
    <[ 1, 1 ], Algebraic power series gamma_1*x^2*y^5, 3, 2>
*]
> Domain(prms[2][2]); ExponentLattice(prms[2][2]);
Polynomial ring of rank 2 over Number Field with defining
polynomial $.1^2 - $.1 + 1 over the Rational Field
Graded Lexicographical Order
Variables: x, y
<
    Lattice of rank 2 and degree 2
    Basis:
    ( 1  1)
    ( 1 -2),

    3
>
> Expand(prms[2][2], 15);
true x^3*y^9 + (gamma_0 - 1)*x^2*y^5 + gamma_0*x*y

```

We find that the sum over all field extensions $1+2+1+2 = 6$ is equal to the degree of the defining polynomial `qopol`. The third parametrization involves a field extension of ${\mathbb{Q}}$ by `gamma_0` s.t. $\hbox{\tt gamma\_0}^2 - \hbox{\tt gamma\_0} + 1 = 0$ and an extension of the exponent lattice to ${\mathbb{Z}}({{1}\over{3}},{{1}\over{3}}) + {\mathbb{Z}}({{1}\over{3}},-{{2}\over{3}})$. It turns out that the field extension is not necessary if we are only interested in parametrizations.

```magma
> _, prms := RationalPuiseux(qopol : Duval := true); prms;
[*
    <[ -1, -1 ], Algebraic power series -x*y, 3, 1>,
    <[ -1, 1 ], Algebraic power series -x^2*y^5, 3, 1>
*]

```

No field extensions have been introduced, but this required the application of automorphisms ${\mathbb{Q}}[[x, y]]\to {\mathbb{Q}}[[x, y]]$ in advance (more precisely $x \mapsto -x, y \mapsto -y$ resp. $x \mapsto -x, y \mapsto y$). This time we can sum up the overall extension degrees (*i.e.*, for fields and lattices) $3 \cdot 1 + 3 \cdot 1 = 6$ to the degree of `qopol`.
