## `Series::Puiseux` -- the domain of finite series expansions

#### Introduction

`Series::Puiseux` is a domain for finite series expansions. Elements of this domain represent initial segments of either Taylor, Laurent or Puiseux series expansions.

#### Details

- The system function `series` is the main application of this domain. It tries to compute a Taylor, Laurent, or Puiseux series of a given arithmetical expression, and the result is returned as an element of `Series::Puiseux`.

  There may be no need for you to explicitely create elements of this domain, but to work with the results of `series`.

  Cf. the help page of `series` for a detailed description and examples of how to work with elements of the domain `Series::Puiseux`.

- Use the type expression `Type::Series` to determine for an element of this domain, which kind of series expansion it is.

- The coefficients are allowed to depend on the variable of the series expansion, for example, logarithmic terms in the series variable may appear as coefficients. Be aware that this is no Puiseux series in the mathematical sense. Cf. example 1.

#### Operands

A series of the domain type `Series::Puiseux` consists has operands:

1. the branching order b,
2. the valuation v,
3. the order of the error term e,
4. a list of coefficients l_0,...,l_e-v-1,
5. the series variable x and the expansion point a in form of an equation x = a. The expansion point a may be infinity or -infinity as well.

The series looks as follows: sum_i=0..e-v-1 l_ix^(v+i)/b + O(x^e/b).

#### Related Domains

`Series::gseries`

#### Important Operations

`Series::Puiseux` implements basic arithmetic of series expansions. Use the ordinary arithmetical operators `+, -, *, /,^` and `@` for composition.

The system functions `nthcoeff`, `coeff`, `nthterm`, `lterm`, `nthmonomial` and `lmonomial` as well as `ldegree` work on series expansions. Note that in contrast to polynomials, terms, coefficients and monomials we counted from the order term on. Cf. example 11.

Use the function `expr` to convert a series expansion to an arithmetical expression (as an element of a kernel domain).

#### Result of Evaluation

Evaluating an object of type `Series::Puiseux` returns itself.

#### Function Call

Calling an element of `Series::Puiseux` as a function yields the object itself, regardless of the arguments. The arguments are not evaluated.

#### Method diff: differentiation

- `diff(Puiseux s, any t)`
- - Computes the formal derivative diff(s,t) of a series expansion and returns the result as an element of `Series::Puiseux`.
  - This method overloads the system function `diff`. Cf. example 2.

#### Method _divide: division

- `_divide(any s, Puiseux t)`
- - Tries to convert s into a series expansion via functions `new` and `series`. Then it computes the quotient s/t of series expansions and returns the result as an element of `Series::Puiseux`.
  - This method overloads the system function `_divide` for series expansions, i.e., you may use it in the form `s/t`. Cf. example 3.

#### Method _fconcat: functional composition

- `_fconcat(Puiseux s, Puiseux t...)`
- - Computes the composition s(t(...)) of series expansions and returns the result as an element of `Series::Puiseux`.
  - This method overloads the system function `_fconcat` for series expansions, i.e., you may use it in the form `s@t...`. Cf. example 4.

#### Method int: integration

- `int(Puiseux s, any t)`
- - Computes the formal integral int s dt of a series expansion and returns the result as an element of `Series::Puiseux`.
  - This method overloads the system function `int`. Cf. example 2.

#### Method _mult: multiplication

- `_mult(s, t)`
- - At least one argument has to be a series expansion. Tries to convert the arguments into a series expansion via functions `new` and `series`. Then it computes the product s*t*... of series expansions and returns the result as an element of `Series::Puiseux`.
  - This method overloads the system function `_mult` for series expansions, i.e., you may use it in the form `s*t*...`. Cf. example 3.

#### Method _plus: addition

- `_plus(Puiseux s, any t...)`
- - At least one argument has to be a series expansion. Tries to convert the arguments into a series expansion via functions `new` and `series`. Then it computes the sum s+t+... of series expansions and returns the result as an element of `Series::Puiseux`.
  - This method overloads the system function `_plus` for series expansions, i.e., you may use it in the form `s+t+...`. Cf. example 3.

#### Method _power: exponentiation

- `_power(Puiseux s, rational t)`
- - Computes the power s^t of series expansions and returns the result as an element of `Series::Puiseux`.
  - This method overloads the system function `_power` for series expansions, i.e., you may use it in the form `s^t`. Cf. example 5.

#### Method revert: functional inversion

- `revert(Puiseux s)`
- - Computes inverses of series expansions with respect to composition and returns the result as an element of `Series::Puiseux`.
  - The expansion point of the inverse is the constant term of the series expansion.
  - This method overloads the system function `revert`. Cf. example 4.

#### Method Series::Puiseux::scalmult: multiplication by a single monomial

- `Series::Puiseux::scalmult(Puiseux s, any a, rational k )`
- - Computes the product s*(a*x^k) and returns the result as an element of `Series::Puiseux`. Cf. example 6.

#### Method _subtract: subtraction

- `_subtract(Puiseux s, any t)`
- - Computes the difference s-t of series expansions and returns the result as an element of `Series::Puiseux`.
  - This method overloads the system function `_subtract` for series expansions, i.e., you may use it in the form `s-t`. Cf. example 3.

#### Method coeff: extract coefficients

- `coeff(Puiseux s <, positive integer n>)`
- - Returns a sequence of all coefficients of `s`, or the `n`-th coefficient, counted from the lowest order term on, respectively.
  - This method overloads the system function `coeff`. Cf. examples 11 and 7.

#### Method Series::Puiseux::indet: the series variable

- `Series::Puiseux::indet(Puiseux s)`
- - Returns the variable of `s`. Cf. example 10.

#### Method iszero: zero test

- `iszero(Puiseux s)`
- - Returns `TRUE` if `s` is zero, i.e., if the sum of the monomials of `s` is zero, that is if `s` only consists of an error term.
  - This method overloads the system function `iszero`. Cf. example 8.

#### Method lcoeff: the leading coefficient (of lowest order)

- `lcoeff(Puiseux s)`
- - Returns the first (or leading) coefficient of `s` (see ``Operands'' for the definition of ``coefficient''). This is the coefficient of the lowest order term.
  - This method overloads the system function `lcoeff`. Cf. example 9.

#### Method ldegree: the leading degree (the valuation)

- `ldegree(Puiseux s)`
- - Returns the degree of the lowest order term of `s`, or the value `FAIL`, if `s` consists only of an error term.
  - This method overloads the system function `ldegree`. Cf. example 10.

#### Method lmonomial: the leading monomial (of lowest order)

- `lmonomial(Puiseux s)`
- - Returns the first (or leading) monomial of `s`, i.e., the monomial of lowest order (see ``Operands'' for the definition of ``monomial'').
  - This method overloads the system function `lmonomial`. Cf. example 9.

#### Method lterm: the leading term (of lowest order)

- `lterm(Puiseux s)`
- - Returns the first (or leading) term of `s`, i.e., the term of lowest order (see ``Operands'' for the definition of ``term'').
  - This method overloads the system function `lterm`. Cf. example 9.

#### Method nthcoeff: extract coefficients

- `nthcoeff(Puiseux s, any t)`
- - Returns the `n`-th coefficient of `s`, counted from the lowest order monomial on (see ``Operands'' for the definition of ``monomial'').
  - This method overloads the system function `nthcoeff`. Cf. example 9

#### Method nthmonomial: extract monomials

- `nthmonomial(Puiseux s, positive integer n)`
- - Returns the `n`-th nonzero monomial of `s`, counted from the lowest order monomial on (see ``Operands'' for the definition of ``monomial'').
  - This method overloads the system function `nthmonomial`. Cf. example 9.

#### Method nthterm: extract terms

- `nthterm(Puiseux s, positive integer n)`
- - Returns the `n`-th nonzero term of `s`, counted from the lowest order term on (see ``Operands'' for the definition of ``term'').
  - This method overloads the system function `nthterm`. Cf. example 9.

#### Method Series::Puiseux::order: the order of the error term

- `Series::Puiseux::order(Puiseux s)`
- - Returns the order of the error term of `s`. Cf. example 10.

#### Method Series::Puiseux::point: the expansion point

- `Series::Puiseux::point(Puiseux s)`
- - Returns the expansion point of `s`. Cf. example 10.

#### Method expr: convert a series expansion into an element of a kernel domain

- `expr(Puiseux s)`
- - Returns the sum of the monomials of `s` without the order term.
  - This method overloads the system function `expr`. Cf. example 12.

#### Method float: convert numeric parts of the coefficients into floats

- `float(Puiseux s)`
- - Returns a series expansion with floating-point coefficients.
  - This method overloads the system function `float`. Cf. example 12.

#### Method Series::Puiseux::create: create series expansion

- `Series::Puiseux::create(any bo, any v, any ord, list l,
  identifier x, any x0)`
- - Creates a new series expansion with branch order `bo`, valuation `v` and order `ord` in `x` at point x0. The coefficients are in the list `l`.

#### Method expand: expand coefficients

- `expand(Puiseux s)`
- - Expands all coefficients of `s`.
  - This method overloads the system function `expand`.

#### Method Series::Puiseux::func_call: evaluation at a point

- `Series::Puiseux::func_call(Puiseux s, any t)`
- - Evaluates the sum of the monomials of `s` without the error term at the point x=t, where x is the series variable.
  - This method overloads the system function `evalp`. You may also use it in the form `s(t)`. Cf. example 13.

#### Method has: check whether an object occurs syntactically

- `has(Puiseux s, any t)`
- - Returns TRUE if `t` occurs syntactically in one of the coefficients, the series variable, or the point of expansion, and otherwise returns FALSE.
  - This method overloads the system function `has`. Cf. example 12.

#### Method map: apply a function to all coefficients

- `map(Puiseux s, function func...)`
- - Applies the function `func` to all coefficients.
  - This method overloads the system function `map`. Cf. example 14.

#### Method Series::Puiseux::new: create a new series expansion

- `Series::Puiseux::new(any s, identifier x, positive integer n)`
- - Computes a series expansion of `s` of order `n` with respect to the variable `x`. The point of expansion is the origin. Cf. example 15.

#### Method print: pretty-print routine

- `print(Puiseux s)`
- - This method is used by the system function `print` for printing elements of `Series::Puiseux` to the screen. Cf. example 16.

#### Method subs: replace subexpressions

- `subs(Puiseux s, equation x = a...)`
- - Replaces the subexpression `x` of `s` by `a`.
  - This method overloads the system function `subs`. Cf. example 17.

#### Example 1

    >> f := series(psi(x), x = infinity);
       coeff(f, 0)

                               1      1       1       / 1  \
                      ln(x) - --- - ----- + ------ + O| -- |
                              2 x       2        4    |  5 |
                                    12 x    120 x     \ x  /

                                       ln(x)

#### Example 2

    >> f := series(1 + 2*x^3, x);
       diff(f, x);
       int(f, x)

                                        3      6
                                 1 + 2 x  + O(x )

                                      2      5
                                   6 x  + O(x )

                                       4
                                      x       7
                                  x + -- + O(x )
                                      2

    >> g := series(1 + 2*x^(3/2), x);
       diff(g, x);
       int(g, x)

                                       3/2      6
                                1 + 2 x    + O(x )

                                     1/2      5
                                  3 x    + O(x )

                                       5/2
                                    4 x         7
                                x + ------ + O(x )
                                      5

    >> h := series(1 + 2*x, x = 2);
       diff(h, x);
       int(h, x)

                                                     6
                            5 + (2 x - 4) + O((x - 2) )

                                               5
                                  2 + O((x - 2) )

                                              2            7
                      6 + (5 x - 10) + (x - 2)  + O((x - 2) )

#### Example 3

    >> f := series(1 + 2*x^3, x, 4);
       g := series(1 + 2*x^(3/2), x, 4);
       h := series(1 + 2*x, x = 2, 4)

                                        3      4
                                 1 + 2 x  + O(x )

                                       3/2      4
                                1 + 2 x    + O(x )

                                                     4
                            5 + (2 x - 4) + O((x - 2) )

    >> f + g + h;
       _plus(f, g, h)

                                       3/2      3      4
                          7 + 2 x + 2 x    + 2 x  + O(x )

                                       3/2      3      4
                          7 + 2 x + 2 x    + 2 x  + O(x )

    >> f - g;
       _subtract(f, g);
       g - h;
       _subtract(g, h)

                                   3/2      3      4
                              - 2 x    + 2 x  + O(x )

                                   3/2      3      4
                              - 2 x    + 2 x  + O(x )

                                           3/2      4
                            - 4 - 2 x + 2 x    + O(x )

                                           3/2      4
                            - 4 - 2 x + 2 x    + O(x )

    >> f*g*h;
       _mult(f, g, h)

                                  3/2      5/2       3      4
                    5 + 2 x + 10 x    + 4 x    + 10 x  + O(x )

                                  3/2      5/2       3      4
                    5 + 2 x + 10 x    + 4 x    + 10 x  + O(x )

    >> f/g;
       _divide(f, g);
       g/h;
       _divide(g, h)

                                    3/2      3      4
                             1 - 2 x    + 6 x  + O(x )

                                    3/2      3      4
                             1 - 2 x    + 6 x  + O(x )

                           3/2      2      5/2      3      7/2
                  2 x   2 x      4 x    4 x      8 x    8 x         4
            1/5 - --- + ------ + ---- - ------ - ---- + ------ + O(x )
                  25      5      125      25     625     125

                           3/2      2      5/2      3      7/2
                  2 x   2 x      4 x    4 x      8 x    8 x         4
            1/5 - --- + ------ + ---- - ------ - ---- + ------ + O(x )
                  25      5      125      25     625     125

#### Example 4

    >> f := series(1 + 2*x^3, x, 10);
       g := series(y^2, y, 10);
       f@g = _fconcat(f, g)

                                        3      10
                                 1 + 2 x  + O(x  )

                                     2      10
                                    y  + O(y  )

                              6      10           6      10
                       1 + 2 y  + O(y  ) = 1 + 2 y  + O(y  )

    >> f := series(1 + 2*x^(3/2), x, 10);
       g := series(y^2, y, 10);
       f@g = _fconcat(f, g)

                                       3/2      10
                                1 + 2 x    + O(x  )

                                     2      10
                                    y  + O(y  )

                               3      9           3      9
                        1 + 2 y  + O(y ) = 1 + 2 y  + O(y )

    >> f := series(1 + 2*x^3, x = 2);
       g := series(y^2, y, 10);
       f@g = _fconcat(f, g)

                                          2            3            6
             17 + (24 x - 48) + 12 (x - 2)  + 2 (x - 2)  + O((x - 2) )

                                     2      10
                                    y  + O(y  )
          Error: invalid composition [Series::Puiseux::_fconcat]

We now consider the procedure `revert`. Let f be a series expansion where the constant term is zero.

    >> f := series(5*x + 2*x^3, x);
       g := revert(f);
       f@g

                                         3      6
                                5 x + 2 x  + O(x )

                                    3       5
                             x   2 x    12 x       6
                             - - ---- + ----- + O(x )
                             5   625    78125

                                            6
                                     x + O(x )

Otherwise the expansion point is the constant term.

    >> f := series(1 + x + 2*x^3, x);
       g := revert(f);
       f@g

                                          3      6
                               1 + x + 2 x  + O(x )

                                    3             5            6
                 (x - 1) - 2 (x - 1)  + 12 (x - 1)  + O((x - 1) )

                                                    6
                             1 + (x - 1) + O((x - 1) )

#### Example 5

    >> f := series(1 + 2*x^3, x);
       f^2 = _power(f, 2);
       f^(1/3) = _power(f, 1/3)

                                        3      6
                                 1 + 2 x  + O(x )

                               3      6           3      6
                        1 + 4 x  + O(x ) = 1 + 4 x  + O(x )

                               3                  3
                            2 x       6        2 x       6
                        1 + ---- + O(x ) = 1 + ---- + O(x )
                             3                  3

    >> f := series(1 + 2*x^(3/2), x);
       f^2 = _power(f, 2);
       f^(1/3) = _power(f, 1/3)

                                       3/2      6
                                1 + 2 x    + O(x )

                      3/2      3      6           3/2      3      6
               1 + 4 x    + 4 x  + O(x ) = 1 + 4 x    + 4 x  + O(x )

                 3/2      3       9/2
              2 x      4 x    40 x         6
          1 + ------ - ---- + ------- + O(x ) =
                3       9       81

                    3/2      3       9/2
                 2 x      4 x    40 x         6
             1 + ------ - ---- + ------- + O(x )
                   3       9       81

#### Example 6

    >> f := series(1 + 2*x^3, x);
       Series::Puiseux::scalmult(f, 5, 3) = 5*x^3*f

                                        3      6
                                 1 + 2 x  + O(x )

                       3       6      9       3       6      9
                    5 x  + 10 x  + O(x ) = 5 x  + 10 x  + O(x )

    >> f := series(1 + 2*x^3, x);
       Series::Puiseux::scalmult(f, 5) = 5*x^(0)*f

                                        3      6
                                 1 + 2 x  + O(x )

                               3      6            3      6
                       5 + 10 x  + O(x ) = 5 + 10 x  + O(x )

#### Example 7

    >> f := series(5*x + 2*x^3, x);
       coeff(f) = (coeff(f, 1), coeff(f, 2), coeff(f, 3))

                                         3      6
                                5 x + 2 x  + O(x )

                               (5, 0, 2) = (5, 0, 2)

#### Example 8

    >> f := series(5*x + 2*x^3, x);
       iszero(f);
       g := series(0, x);
       iszero(g)

                                         3      6
                                5 x + 2 x  + O(x )

                                       FALSE

                                          6
                                       O(x )

                                       TRUE

#### Example 9

    >> f := series(5*x + 2*x^3, x);
       nthcoeff(f, 1), nthcoeff(f, 2);
       lcoeff(f), lmonomial(f), lterm(f)

                                         3      6
                                5 x + 2 x  + O(x )

                                       5, 2

                                     5, 5 x, x

    >> nthmonomial(f, 1), nthmonomial(f, 2);
       nthterm(f, 1), nthterm(f, 2)

                                             3
                                     5 x, 2 x

                                           3
                                       x, x

#### Example 10

    >> f := series(5*x + 2*x^3, x);
       ldegree(f),
       Series::Puiseux::order(f),
       Series::Puiseux::indet(f),
       Series::Puiseux::point(f)

                                         3      6
                                5 x + 2 x  + O(x )

                                    1, 6, x, 0

    >> g := series(5*x + 2*x^3, x = 3);
       ldegree(g),
       Series::Puiseux::order(g),
       Series::Puiseux::indet(g),
       Series::Puiseux::point(g)

                                          2            3            6
            69 + (59 x - 177) + 18 (x - 3)  + 2 (x - 3)  + O((x - 3) )

                                    0, 6, x, 3

#### Example 11

Consider the series expansion f:=5*x+2*x^3+O(x^6) of the polynomial g:=5*x+2*x^3.

    >> f := series(5*x + 2*x^3, x);  g := 5*x + 2*x^3

                                         3      6
                                5 x + 2 x  + O(x )

                                             3
                                    5 x + 2 x

We have several access functions for series expansions overloading system functions for polynomials:

    >> coeff(f, 1), coeff(g, 1);
       ldegree(f), ldegree(g)

                                       5, 5

                                       1, 1

Note, however, that the n-th term of a series expansion and the n-th term of a polynomial are different. For example, for polynomials, the leading monomial is the nonzero monomial with the highest degree, while for series expansions it is the nonzero monomial with the lowest degree.

    >> lcoeff(f), lcoeff(g);
       nthmonomial(f, 1), nthmonomial(g, 1);
       lmonomial(f), lmonomial(g);
       lterm(f), lterm(g);
       nthterm(f, 1), nthterm(g, 1)

                                       5, 2

                                             3
                                     5 x, 2 x

                                             3
                                     5 x, 2 x

                                           3
                                       x, x

                                           3
                                       x, x

#### Example 12

    >> f := series(1 + 2*x^3, x)

                                        3      6
                                 1 + 2 x  + O(x )

    >> expr(f);
       float(f)

                                        3
                                     2 x  + 1

                                          3      6
                               1.0 + 2.0 x  + O(x )

    >> has(f, x);
       has(f, y)

                                       TRUE

                                       FALSE

#### Example 13

    >> f := series(1 + 2*x^3, x);
       Series::Puiseux::func_call(f, 3) = f(3);
       Series::Puiseux::func_call(f, y + 1) = f(y + 1)

                                        3      6
                                 1 + 2 x  + O(x )

                                      55 = 55

                                   3                3
                          2 (y + 1)  + 1 = 2 (y + 1)  + 1

#### Example 14

    >> f := series(1 + 2*x^3, x);
       map(f, sin)

                                        3      6
                                 1 + 2 x  + O(x )

                                      3             6
                            sin(1) + x  sin(2) + O(x )

#### Example 15

    >> f := series(2*x^3, x);
       Series::Puiseux::new(2*x^3, x, 6);
       Series::Puiseux::create(1, 0, 6, [0, 0, 0, 2, 0, 0], x, 0)

                                      3      6
                                   2 x  + O(x )

                                      3      9
                                   2 x  + O(x )

                                      3      6
                                   2 x  + O(x )

    >> f := series(sin(x), x) <> Series::Puiseux::new(sin(x), x, 6)

                           3    5
                          x    x        6                 6
                      x - -- + --- + O(x ) <> sin(x) + O(x )
                          6    120

#### Example 16

    >> f := series(1 + 2*x^3, x):
       print(f):

                                        3      6
                                 1 + 2 x  + O(x )

#### Example 17

    >> f := series(1 + 2*x^3, x);
       subs(f, x = a);
       subs(f, x = y + 1)

                                        3      6
                                 1 + 2 x  + O(x )

                                        3      6
                                 1 + 2 a  + O(a )

                                        2      3      6
                           3 + 6 y + 6 y  + 2 y  + O(y )

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000