Documentation

# `Series`::`Puiseux`

Truncated Puiseux series expansions

MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

## Syntax

```Series::Puiseux(`f`, `x`, <`order`>, <`dir`>)
Series::Puiseux(`f`, `x = x0`, <`order`>, <`dir`>)
```

## Description

`Series::Puiseux` is a domain for truncated series expansions. Elements of this domain represent initial segments of Taylor, Laurent, or Puiseux series expansions, as well as slightly more general types of series expansions.

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

There is usually no need for you to explicitly create elements of this domain. The methods described on this help page apply if you want to process a result returned by `series` further.

### Note

If you create elements explicitly as described above, then any special mathematical function, such as `sin` or `exp`, involving the series variable is considered as a coefficient. Use `series` to expand such functions as well, and use the constructor only if `f` does not contain any special mathematical functions. Cf. Example 1.

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

### Note

The coefficients are allowed to depend sublinearly 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 4 and the help page for `series`.

## Environment Interactions

The function is sensitive to the global variable `ORDER`, which determines the default number of terms of the expansion.

## Examples

### Example 1

You can create objects of `Series::Puiseux` in various ways. The standard method is to use the constructor. The second argument specifies the series variable and the expansion point, with default 0 if omitted:

```Series::Puiseux(x/(1 - x), x); Series::Puiseux(x/(1 - x), x = 2); Series::Puiseux(x/(1 - x), x = complexInfinity);```

The third argument, if present, specifies the desired number of terms. If it is omitted, the value of the environment variable `ORDER` is used:

```Series::Puiseux(x/(1 - x), x = 2, 4); ORDER := 2: Series::Puiseux(x/(1 - x), x); delete ORDER:```

The methods `const`, `one`, and `zero` provide shortcuts for creating series expansions with only a constant term or no non-zero term at all. Specifying the order of the error term is mandatory:

```Series::Puiseux::const(PI, x, 4); Series::Puiseux::one(x = 2, 3); Series::Puiseux::zero(x = 0, 3/2); Series::Puiseux::zero(x = complexInfinity, 5);```

Note that, e.g., `O(x^(3/2))` is not an element of `Series::Puiseux`, but can be converted by the constructor:

```f := O(x^(3/2)); g := Series::Puiseux(f, x); domtype(f), domtype(g)```

Both the constructor `Series::Puiseux` and the method `const` regard special mathematical functions, such as `exp` or `sin`, as coefficients:

```Series::Puiseux(sin(x)/(1 - x), x, 4); Series::Puiseux::const(cos(x), x = 1, 3);```

Use the system function `series` if you want to have special functions expanded as well:

`series(sin(x)/(1 - x), x, 4);`

The constructor returns `FAIL`, if it cannot convert the input into an element of `Series::Puiseux`. Then `series` may be able to produce a more general expansion:

```delete a: Series::Puiseux(x^a/(1 - x), x); f := series(x^a/(1 - x), x); domtype(f);```

The method `create` is a purely syntactical constructor, where the operands are specified explicitly. The sixth and seventh arguments are optional and default to 0 and `Undirected`, respectively:

```Series::Puiseux::create(3, 1, 5, [1/2, 5], x) = Series::Puiseux::create(3, 1, 5, [1/2, 5], x, 0, Undirected)```

`Series::Puiseux::create(1, -2, 1, [ln(x), 0, 3], x, complexInfinity);`

### Example 2

We demonstrate the internal structure of objects of type `Series::Puiseux`:

```f := series(exp(x), x = 1); g := series(sin(sqrt(1/x)), x = infinity); h := series(sin(sqrt(-x))/x, x = 0)```

```op(f); op(g); op(h)```

The series `f` and `g` are of type 0, while `h` is of type `1`:

`op(f, 1), op(g, 1), op(h, 1)`

The branching order of `f` is 1, and the branching order of both `g` and `h` is 2:

`op(f, 2), op(g, 2), op(h, 2)`

The third and the fourth operand determine the order of the leading term and the error term, respectively:

```ldegree(f) = op(f, 3)/op(f, 2), ldegree(g) = op(g, 3)/op(g, 2), ldegree(h) = op(h, 3)/op(h, 2); Series::Puiseux::order(f) = op(f, 4)/op(f, 2), Series::Puiseux::order(g) = op(g, 4)/op(g, 2), Series::Puiseux::order(h) = op(h, 4)/op(h, 2);```

For series expansions of type 0, the fifth operand contains the coefficients of the expansion:

```op(f, 5) = [coeff(f)]; op(g, 5) = [coeff(g)];```

However, `h` is an expansion of type 1, and then the fifth operand stores the summands:

```op(h, 5); [coeff(h)];```

The sixth operand contains the series variable and the expansion point:

```op(f, 6), Series::Puiseux::indet(f), Series::Puiseux::point(f); op(g, 6), Series::Puiseux::indet(g), Series::Puiseux::point(g); op(h, 6), Series::Puiseux::indet(h), Series::Puiseux::point(h);```

The expansions `f` and `h` are undirected, while `g` is a directed expansion from the left along the real line to the positive infinity:

```op(f, 7) = Series::Puiseux::direction(f), op(g, 7) = Series::Puiseux::direction(g), op(h, 7) = Series::Puiseux::direction(h);```

### Note

Since the internal structure may be subject to changes, accessing the operands of and element of `Series::Puiseux` via `op` should be avoided. Use the corresponding access methods instead.

### Example 3

Around branch points, the series expansions of type 1 can approximate a function in a wider range than those of type 0:

```f := x -> arcsin(x + 1): g := series(f(x), x, 2); h := series(f(x), x, 2, Right);```

The expansion `g`, of type 1, approximates `f` well in an open disc centered at the origin. However, the expansion `h`, of type 0, was requested for positive real values of `x` only, and in fact it does not approximate `f` on the negative real axis and in the upper half plane:

```op(g); op(h);```

```DIGITS := 4: [f(0.01), f(0.01*I), f(-0.01), f(-0.01*I)]; map([g(0.01), g(0.01*I), g(-0.01), g(-0.01*I)], float); map([h(0.01), h(0.01*I), h(-0.01), h(-0.01*I)], float); delete DIGITS:```

The method `convert01` converts a series expansion of type 0 into one of type 1:

```h1 := Series::Puiseux::convert01(h); op(h1);```

The reverse conversion, using the method `convert10`, is in not always possible:

```op(Series::Puiseux::convert10(h1)); op(Series::Puiseux::convert10(g));```

You can enforce a conversion by using properties:

```assume(x > 0): op(Series::Puiseux::convert10(g)); unassume(x):```

### Example 4

Despite the name, elements of `Series::Puiseux` may contain coefficient functions depending on the series variable:

```f := series(psi(x), x = infinity, 4); domtype(f), coeff(f, 0)```

With respect to differentiation, integration, and composition, such expansions behave like functions of the series variable and not like formal series:

`diff(f, x) = series(diff(psi(x), x), x = infinity, 4)`

`int(f, x) = series(int(psi(x), x), x = infinity, 4)`

`f @ series(2*x, x = infinity) = series(psi(2*x), x = infinity, 4)`

### Example 5

The basic arithmetical operations are implemented for elements of `Series::Puiseux`:

```f := series(exp(x), x, 4); g := series(sqrt(x)/(1 - x), x, 4); h := series(cot(x), x, 4);```

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

```f - h = _subtract(f, h); -g = _negate(g);```

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

```f/g = _divide(f, g); 1/h = _invert(h);```

Operands that are not of type `Series::Puiseux` are implicitly converted into series expansions with the same expansion point via the constructor before the arithmetical operation is performed:

```f - 1 - x; h * (sin(x) + x);```

An error occurs when the expansion points differ or the directions of expansion are incompatible:

```f := series(arccot(x), x = 0, Left); g := series(sqrt(sin(x)), x = 0, Right); f + g```

```Error: Inconsistent direction. [Series::Puiseux::plus] ```
```h := series(1/x, x = 2, 4); f * h```

```Error: Both series must use the same variables and expansion points. [Series::Puiseux::mult] ```

If the directions are compatible, then the direction of the result specifies the minimal range where all operands are defined:

`s := series(tanh(x), x, Real);`

```f + s; Series::Puiseux::direction(%)```

### Example 6

The method `scalmult` implements multiplication by a constant or a single term:

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

```g := series(1 + 2*x^3, x = 2, 3); Series::Puiseux::scalmult(g, 1, 3) = (x - 2)^3*g```

```h := series(1 + 2*x^3, x = complexInfinity); Series::Puiseux::scalmult(h, 1, 1/2) = x^(-1/2)*h```

### Example 7

Exponentiation is implemented for integral and rational exponents:

```f := series(exp(x), x, 3); f^2 = _power(f, 2); f^(1/3) = _power(f, 1/3)```

Exponents are allowed to be non-rational, if the series expansion starts with a constant summand independent of the series variable:

`f^I = series(exp(I*x), x, 3);`

```g := series(sin(-x), x); g^I```

```Error: Exponent must be a rational number. [Series::Puiseux::_power] ```

If the exponent contains the series variable, then an error occurs:

`f^x`
```Error: Exponent must not contain the series variable. [Series::Puiseux::_power] ```

For undirected expansions and rational exponents that are not integral, the result has type 1 in general:

```g^(1/2); op(%, 1);```

The result simplifies when you specify one of the directions `Left` or `Right`:

```g := series(sin(-x), x, Left): g^(1/2); op(%, 1);```

```g := series(sin(-x), x, Right): g^(1/2);```

### Example 8

Functional composition of elements of `Series::Puiseux` is implemented by the method `_fconcat`:

```f := series(ln(x), x = 1, 4); g := series(cos(y), y = 0); f@g = _fconcat(f, g); series(ln(cos(y)), y = 0, 4);```

If the left argument is not of type `Series::Puiseux`, it is implicitly expanded around the limit point of the right argument before the composition:

```f := series(sin(-x), x = 0); sqrt(y) @ f = Series::Puiseux(sqrt(y), y) @ f;```

If the right argument is not of type `Series::Puiseux`, it is implicitly expanded around the origin via the constructor before the composition:

`f @ sqrt(y) = f @ Series::Puiseux(sqrt(y), y)`

This may not work if the argument to be converted contains special mathematical functions, but you can explicitly expand it into a series via `series` in this case:

`f @ tan(y)`

`f @ series(tan(y), y = 0)`

Mathematically, the composition of series expansions is not defined if the limit point of the right argument is not the expansion point of the left argument:

```g := series(y^2 - 1, y = 0); f @ g```

`f @ (y^2 - 1)`

`f @ series(y^2 - 1, y = 1, 4)`

The method `revert` computes the inverse of a truncated series expansion with respect to composition. The expansion point of the inverse is the limit point of the input and vice versa:

```f := series(ln(x), x = 1, 4); revert(f) = series(exp(x), x = 0, 5)```

```f := series(cot(x), x = 0); revert(f) = series(arccot(x), x = complexInfinity);```

`f @ revert(f), revert(f) @ f`

If the series variable occurs in the coefficients or the type flag is 1, an error occurs:

```f := series(ln(sin(x)), x); g := series(arcsin(x + 1), x, 2);```

`revert(f)`
```Error: Unable to compute the functional inverse. [Series::Puiseux::revert] ```
`revert(g)`
```Error: Unable to compute the functional inverse. [Series::Puiseux::revert] ```

### Example 9

The methods `diff` and `int` implement term-by-term differentiation and integration:

```f := series(ln(x), x = 1, 4); g := diff(f, x); series(1/x, x = 1, 4); int(g, x);```

If you specify a range of integration, then the result is an arithmetical expression plus a symbolic definite integral of the O-term:

`int(f, x = 1..2);`

### Example 10

Most special mathematical functions are overloaded for `Series::Puiseux`:

```f := series(x/(1 - x), x, 4); exp(f) = series(exp(x/(1 - x)), x, 4); ln(f) = series(ln(x/(1 - x)), x, 4);```

If the system is unable to compute the composition, it returns a symbolic function call with evaluated arguments:

```delete g: g(f)```

`exp(series(x + 1/x, x = infinity, 5))`

In this case, you can try `series` to compute the composition:

`series(exp(x + 1/x), x = infinity, 5)`

### Example 11

The system functions `Re`, `Im`, and `conjugate` work for all real series expansions:

```f := series(exp(I*x), x, Real); Re(f) = series(cos(x), x, Real); Im(f) = series(sin(x), x, Real) + O(x^6); conjugate(f) = series(exp(-I*x), x, Real);```

Except in trivial cases, a symbolic function call is returned for an undirected expansion:

```Re(series(PI, x)); Re(series(exp(I*x), x));```

### Example 12

The method `contfrac` converts a series expansion into a continued fraction:

```f := series(exp(x), x, 10); contfrac(f);```

```g := series(tan(x), x = PI, 10); contfrac(g);```

If the coefficients of a series expansion depend on the series variable, then so do the coefficients of the corresponding continued fraction:

```h := series(ln(x + 1/x), x = infinity); contfrac(h)```

### Example 13

For series expansions around the origin, the method `laplace`, overloading `laplace`, computes the Laplace transform term by term, if the second argument is the series variable. The result is a series expansion around infinity:

```delete s: f := series(exp(x), x); g := laplace(f, x, s); series(laplace(exp(x), x, s), s = infinity);```

Similarly, the method `ilaplace` computes the inverse Laplace transform term by term for series expansions around infinity, if the second argument is the series variable. The result is a series expansion around 0:

`ilaplace(g, s, x)`

The Laplace transform and the inverse Laplace transform, respectively, of a series do not make sense for expansion points other than 0 or infinity, respectively, and in these cases a symbolic function call is returned:

`laplace(series(ln(x), x = 1, 2), x, s);`

If the second argument is not the series variable, then the coefficients are transformed:

```h := series(sin(x*y), x = 1, 2); laplace(h, y, s);```

### Example 14

When called with one argument, the method `coeff` returns the sequence of all coefficients of a series expansion:

```f := series(tan(x), x); coeff(f)```

```g := series(1/(x - 1)^2, x = infinity); coeff(g)```

When called with two arguments, `coeff` returns an individual coefficient:

`coeff(f, -1), coeff(f, 1), coeff(f, 2), coeff(f, 13/2);`

If the second argument exceeds the order of the error term, `coeff` returns `FAIL`:

`coeff(f, 10)`

When the expansion point is `complexInfinity`, ```coeff(s, n)``` returns the coefficient of , where `x` is the series variable of `s`:

`coeff(g, 2), coeff(g, -3), coeff(g, -15/2)`

Specifying the series variable as second or third argument, respectively, is optional:

```coeff(f) = coeff(f, x); coeff(f, 3) = coeff(f, x, 3)```

For series expansions of type 1, the “coefficients” in general involve the series variable:

```h := series(sin(sqrt(-x)), x); coeff(h); coeff(h, 3/2);```

### Example 15

The method `ldegree` returns the order of the leading term of a series expansion. When the expansion point is `complexInfinity` and the leading term is , then this is n:

```f := series(x*sin(sqrt(-x)), x); g := series(cot(x), x = PI); h := series(2*arccot(x), x = infinity);```

`ldegree(f), ldegree(g), ldegree(h)`

The method `lcoeff` returns the coefficient of the leading term. For an expansion of type 1, it generally involves the series variable:

`lcoeff(f), lcoeff(g), lcoeff(h)`

The method `lterm` returns the leading term itself:

`lterm(f), lterm(g), lterm(h)`

Finally, the method `lmonomial` returns the whole summand:

```lmonomial(f) = lcoeff(f)*lterm(f); lmonomial(g) = lcoeff(g)*lterm(g); lmonomial(h) = lcoeff(h)*lterm(h);```

If the series expansion consists only of an O-term, all four methods return `FAIL`:

```s := Series::Puiseux::zero(x, 6); ldegree(s), lcoeff(s), lterm(s), lmonomial(s)```

### Example 16

The methods `nthcoeff`, `nthmonomial`, and `nthterm` return the nth non-zero coefficient, monomial, or term, respectively, of a series expansion. In contrast to polynomials, they count from the term of lowest order on, i.e., the ordering is ascending by exponent for finite expansion points and descending by exponent when the expansion point is `complexInfinity`:

```f := series(x*sin(sqrt(-x)), x); g := series(cot(x), x = PI); h := series(2*arccot(x), x = infinity);```

```nthcoeff(f, 1) = lcoeff(f); nthmonomial(g, 1) = lmonomial(g); nthterm(h, 1) = lterm(h);```

```nthcoeff(f, 3), nthmonomial(f, 3), nthterm(f, 3); nthcoeff(g, 3), nthmonomial(g, 3), nthterm(g, 3); nthcoeff(h, 3), nthmonomial(h, 3), nthterm(h, 3);```

If the second argument is not positive or exceeds the number of non-zero summands, all three methods return `FAIL`:

`nthcoeff(f, -4), nthterm(g, 0), nthmonomial(h, 4)`

### Example 17

We illustrate the difference between the ordering of terms in polynomials and series expansions. The ordering of the terms in a polynomial agrees with the ordering of the terms in a series expansion with expansion point `complexInfinity`:

```f := poly(2*(x^2 + x)^3); g := series(f, x = complexInfinity); [lcoeff(f), lmonomial(f), lterm(f)]; [lcoeff(g), lmonomial(g), lterm(g)];```

```[nthcoeff(f, 2), nthmonomial(f, 3), nthterm(f, 4)]; [nthcoeff(g, 2), nthmonomial(g, 3), nthterm(g, 4)];```

For finite expansion points, however, the ordering of the terms in a series expansion is the reverse of the ordering of the terms in the corresponding polynomial:

```h := series(f, x = 0); [lcoeff(h), lmonomial(h), lterm(h)]; [nthcoeff(h, 2), nthmonomial(h, 3), nthterm(h, 4)];```

### Example 18

The method `iszero` checks whether a series expansion has no non-zero summands apart from the O-term:

```f := series(exp(x), x); g := Series::Puiseux(0, x = 2, 4); iszero(f), iszero(g)```

### Example 19

The methods `convert` tries to convert an arbitrary object into an element of `Series::Puiseux`. If the input does not suggest an expansion point, `convert` uses the origin:

```f := asympt(1/(x + 1), x = infinity); g := sin(x)/(1 - x); h := poly((x + 1)^10); u := O((x - 1)^3, x = 1);```

`domtype(f), domtype(g), domtype(h), domtype(u)`

```F := Series::Puiseux::convert(f); G := Series::Puiseux::convert(g); H := Series::Puiseux::convert(h); U := Series::Puiseux::convert(u);```

`convert` returns `FAIL`, if it is unable to convert the input, e.g., because the input contains no or more than one indeterminate:

```Series::Puiseux::convert(sin(1)), Series::Puiseux::convert([1, y, 3])```

The method `convert_to` tries to convert an element of `Series::Puiseux` into a specified type:

```Series::Puiseux::convert_to(F, Series::gseries); Series::Puiseux::convert_to(F, contfrac); Series::Puiseux::convert_to(G, DOM_EXPR); Series::Puiseux::convert_to(H, DOM_POLY); Series::Puiseux::convert_to(H, O); Series::Puiseux::convert_to(U, O);```

`convert_to` returns `FAIL`, if it is unable to perform the requested conversion:

```Series::Puiseux::convert_to(F, O), Series::Puiseux::convert_to(F, DOM_LIST)```

### Example 20

The method `expr` converts an element of `Series::Puiseux` into an arithmetical expression, discarding the O-term. In general, the ordering of the summands is not preserved:

```f := series(exp(x*y), x); g := series(ln(x), x = 1, 3);```

```expr(f); expr(g);```

The method `float` applies the system function `float` to all coefficients:

```float(f); float(g);```

### Example 21

The methods `combine`, `expand`, and `normal` apply the corresponding system functions to all coefficients:

```delete a, y: f := series(y/(x + y^a), x, 4); g := combine(f); expand(g);```

For efficiency reasons, the arithmetical methods of `Series::Puiseux` usually do not perform any symbolic simplifications. Use `expand` or `normal` to simplify the results:

```h := series(exp(x), x, 4)^a; expand(h); normal(h);```

```u := series(arctanh(x + y), x, 4); normal(u);```

Besides normalizing the coefficients, the method `normal` also removes leading and trailing zeroes from the coefficient list:

```v := Series::Puiseux::create(1, 3, 10, [0, 1/2, 0, 5, 0, 0], x, 2); coeff(v); normal(v); coeff(%);```

The method `map` applies a given function to all coefficients. E.g., the system function `factor` is not overloaded for `Series::Puiseux`, but you can use `map` to express all coefficients in factored form:

`map(u, factor);`

In the next example, we use `map` to multiply all coefficients of a series expansion by a constant:

```w := series(exp(x), x, 3); map(w, _mult, PI) = PI*w```

For series expansions of type 1, `map` applies the function to all non-zero coefficients as returned by `coeff`:

```z := series(sin(sqrt(-x)), x); coeff(z); map(z, cos);```

### Example 22

Three different methods can be used to substitute for the series variable: `_fconcat`, `func_call`, and `subs`. Suppose `f` is an element of `Series::Puiseux` and we want to substitute an expression `t` for the series variable `x`. Then `_fconcat` converts `t` into a series expansion around the origin via the constructor, computes the functional composition, and returns the result as an element of `Series::Puiseux`:

```f := series(exp(x), x = 0, 5); Series::Puiseux::_fconcat(f, y) = f @ y; f @ (y^2 + y);```

The composition may fail if the limit point of `t` around the origin differs from the expansion point of `f` or if `t` contains special mathematical functions:

`f @ (y + 1);`

`f @ sin(y);`

Moreover, the composition does not work if the expression `t` is constant or contains more than one indeterminate:

`f @ PI;`
```Error: Unable to compute composition. [Series::Puiseux::_fconcat] ```
`f @ (x + y);`
```Error: Unable to compute composition. [Series::Puiseux::_fconcat] ```

You can enforce the composition by explicitly converting `t` into a series:

```f @ series(y + 1, y = -1); f @ series(sin(y), y = 0); f @ series(x + y, x = -y);```

Substitution with `func_call` always works. It discards the error term, `t` is substituted literally, and the result is an expression and not an object of type `Series::Puiseux`:

```f(5) = Series::Puiseux::func_call(f, 5); f(y) = Series::Puiseux::func_call(f, y);```

```f(y^2 + y); f(y + 1); f(sin(y)); f(PI); f(x + y);```

Finally, if `subs` is used to substitute for the series variable, only very special substitutions are allowed (see the description of `subs` above for more details). Then a change of variable is performed, and the result is again of type `Series::Puiseux`:

`subs(f, x = y^2 + y)`
```Error: Invalid substitution. [Series::Puiseux::subs] ```
`subs(f, x = y + 1)`

`subs(f, x = sin(y))`
```Error: Invalid substitution. [Series::Puiseux::subs] ```
`subs(f, x = PI)`
```Error: Invalid substitution. Exactly one indeterminate expected. [Series::Puiseux::subs] ```
`subs(f, x = x + y)`
```Error: Invalid substitution. Exactly one indeterminate expected. [Series::Puiseux::subs] ```

All three methods can handle the case where the series variable occurs in the coefficients:

```s := series(ln(x^2 + x), x); s @ (2*y); s(2*y); subs(s, x = 2*y);```

Of course, `subs` can also be used to substitute for other objects than the series variable in the coefficients and in the expansion point:

```g := series(cos(x + y), x, 4); h := series(1/x, x = y, 4);```

```subs(g, y = PI) = series(cos(x + PI), x, 4); subs(h, y = 2) = series(1/x, x = 2, 4);```

Even simultaneous substitutions are possible in the coefficients:

`subs(g, [hold(sin) = cos, hold(cos) = sin, y = 2])`

An error occurs, if the right hand side contains the series variable:

`subs(h, y = x)`
```Error: Invalid substitution. Right side must not contain the series variable. [Series::Puiseux::subs] ```

### Example 23

The method `has` checks, whether an object occurs syntactically in the coefficients, the series variable, the expansion point, or the direction of an element of `Series::Puiseux`:

```f := series(sin(x + 2*y), x = PI, 2); has(f, x), has(f, y), has(f, PI), has(f, 2), has(f, Undirected); has(f, hold(sin)), has(f, 3), has(f, sin(2*y)), has(f, x - PI);```

The last call returns `FALSE` since the expression ```x - PI``` occurs only in the screen output, but not in the internal representation of `f`.

```g := series(sign(x), x, Right); has(g, Right), has(g, Undirected);```

### Example 24

The method `truncate` discards summands up to the given order:

```f := series(x*sin(sqrt(x)), x); Series::Puiseux::truncate(f, 10); Series::Puiseux::truncate(f, 9/2); Series::Puiseux::truncate(f, 7/2); Series::Puiseux::truncate(f, 3); Series::Puiseux::truncate(f, 3/2); Series::Puiseux::truncate(f, 1);```

## Parameters

 `f` An arithmetical expression representing a function in `x` `x` An identifier `x0` The expansion point: an arithmetical expression. If not specified, the default expansion point 0 is used. `order` The number of terms to be computed: a nonnegative integer. The default order is given by the environment variable `ORDER` (default value 6). `dir` Either `Left`, `Right`, `Real`, or `Undirected`. This optional argument can be used to specify that the resulting expansion is possibly valid along the real line only. The default is `Undirected`, which means that the expansion is valid in a neighborhood of the expansion point in the complex plane.

## Return Values

an object of domain type `Series::Puiseux`, or the value `FAIL`, if the `f` cannot be converted, e.g., if powers with non-rational exponents occur in `f`.

## Function Calls

Calling an element of `Series::Puiseux` as a function discards the error term and substitutes the first argument for the series variable. See the description of the method `"func_call"` and Example 22.

## Operations

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

The arithmetical methods of `Series::Puiseux` usually do not perform any symbolic simplifications. Use `combine`, `expand`, or `normal` to request such simplifications explicitly.

See Example 5 and Example 21.

Special mathematical functions, such as `exp` or `sin`, are overloaded for elements of `Series::Puiseux`; cf. Example 10.

The system functions `coeff`, `lcoeff`, `nthcoeff`, `ldegree`, `lmonomial`, `nthmonomial`, `lterm`, and `nthterm` work on truncated series expansions. Note that in contrast to polynomials, coefficients, monomials, and terms are counted from the term of lowest order term on. Cf. Example 17.

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

## Operands

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

1. a type flagt ∈ {0, 1},

2. the branching orderb, a positive integer,

3. an integer v such that is the order of the leading term,

4. an integer ev such that is the order of the error term,

5. a list of coefficients l1, …, ln,

6. the series variablex and the expansion pointx0 in form of an equation x = x0; the expansion point x0 may be `complexInfinity` as well,

7. a direction, `Undirected`, `Real`, `Left`, or `Right`.

The type flag distinguishes between two different internal representations.

If t = 0, then the operands above represent the truncated series expansion

.

If the expansion point x0 is `complexInfinity`, then the operands represent the truncated expansion

.

• A summand (or , respectively) is called a monomial of the expansion,

• the power (or , respectively) is called a term,

• li is the corresponding coefficient, and

• the exponent is the order of the corresponding term or monomial.

If t = 1, then the operands above represent the expansion

.

In this case, the powers of x - x0 are explicitly stored in the list, and li contains only terms of growth order . The corresponding expansion for `x0 = complexInfinity` is

,

and li contains only terms of growth order .

The notions term and order are the same as for t = 0, a summand li is called a monomial, and the corresponding coefficient is

(or

,

respectively).

The latter type of representation serves for correct expansions around branch points. For example, if we want to expand around x = 0, then the truncated Puiseux series does not approximate f(x) in the lower half of the complex plane. With t = 1, the expansion , which approximates f(x) also in the lower part of the complex plane near the origin, can be represented as an object of domain type `Series::Puiseux`.

The direction d has the same meaning as the parameter `dir` of the constructor. If d = Undirected, the operands above represent an expansion valid in some neighborhood of the expansion point in the complex plane. Usually, this is an open disc centered at `x0`. If dUndirected and x0 represents a real number, this means that the expansion is valid for real values of x only. If d = Left or d = Right, then the expansion is valid for x < x0 or x > x0, respectively.

In the case `x_0 = complexInfinity`, and if d = Undirected, we have an expansion valid in the neighborhood of the north pole of the Riemann sphere, i.e., for all of sufficiently large absolute value. If d = Left, we have an expansion around the positive real infinity valid for sufficiently large real values of x. Similarly, if d = Right, we have an expansion around the negative real infinity valid for sufficiently large negative real values of x. Finally, if d = Real, the expansion is valid both around infinity and around - ∞.

Cf. Example 2.

## Element Creation

Typically, objects of type `Series::Puiseux` are generated by calls to `series` or `taylor`.

## Methods

expand all

#### Mathematical Methods

`conjugate(s)`

This method overloads the system function `conjugate`. Cf. Example 11.

`contfrac(s)`

This method overloads the system function `contfrac`. Cf. Example 12.

`diff(s, t)`

This method overloads the system function `diff`. Cf. Example 9.

`_divide(s, t)`

`_fconcat(s, t)`

If both `s` and `t` are of type `Series::Puiseux`, then the functional composition can only be defined if the limit point of t for values close to its expansion point is equal to the expansion point of s. Otherwise, an error occurs.

At least one of the arguments must be of type `Series::Puiseux`. If one of the arguments is not of this type, then it is converted into an element of `Series::Puiseux` via the constructor. If s is not of type `Series::Puiseux`, then it is converted into a series expansion around the limit point of t. If t is not of type `Series::Puiseux`, then it is converted into a series expansion around 0. The implicit conversion is performed only if the corresponding expression contains exactly one free variable.

This method overloads the system function `_fconcat` for series expansions, i.e., you may use it in the form `s@t`. See Example 8 and Example 22.

`Im(s)`

This method overloads the system function `Im`. Cf. Example 11.

```int(s, t | t = a .. b)```

This method overloads the system function `int`. Cf. Example 9, and the help page of `int` for a description of further optional arguments.

`_invert(s)`

This method overloads the system function `_invert`, i.e., you may use it in the form `1/s`.

`ilaplace(s, u, v)`

If `u` is not the series variable of `s`, then the coefficients of `s` are transformed, but not the expansion point. Otherwise, the expansion point of `s` must be infinity, `v` must be an identifier, and `s` is transformed term by term. The result is then a series expansion around v = 0.

This method overloads the function `ilaplace` for series expansions. Cf. Example 13.

`laplace(s, u, v)`

If `u` is not the series variable of `s`, then the coefficients of `s` are transformed, but not the expansion point. Otherwise, the expansion point of `s` must be 0, the order of the leading term of `s` must be nonnegative, `v` must be an identifier, and `s` is transformed term by term. The result is then a series expansion around v = ∞.

This method overloads the function `laplace` for series expansions. Cf. Example 13.

```_mult(s, t, , …)```

Use the method `Series::Puiseux::scalmult` to multiply a series expansion `s` by a constant or a power of x - x0.

This method overloads the system function `_mult` for series expansions, i.e., you may use it in the form `s*t*...`. Cf. Example 5.

`_negate(s)`

This method overloads the system function `_negate`, i.e., you may use it in the form `-s`.

```_plus(s, t, , …)```

This method overloads the system function `_plus` for series expansions, i.e., you may use it in the form `s+t+...`. Cf. Example 5.

`_power(s, n)`

If n is a rational number, the direction of `s` is `Undirected` or `Real`, and the leading coefficient of `s` is not positive, then the type flag of the result is 1 in general.

If n is not a rational number, then the leading summand of s must not contain the series variable. Otherwise, an error occurs.

This method overloads the system function `_power` for series expansions, i.e., you may use it in the form `s^n`. Cf. Example 7.

`Re(s)`

This method overloads the system function `Re`. Cf. Example 11.

`revert(s)`

The expansion point of the inverse is the limit point of `s`.

This method overloads the system function `revert`. Cf. Example 8.

`Series::Puiseux::scalmult(s, a, k)`

```series(s, y | y = y0, <order>, <dir>)```

This method overloads the system function `series`.

`_subtract(s, t)`

#### Access Methods

`coeff(s, <x>, n)`

`coeff(s, <x>)`

The second call returns the sequence of all coefficients of `s`, starting with the coefficient of lowest order. (This is the coefficient of the term with the highest exponent if x0=`complexInfinity`.)

Specifying the variable `x` is optional; if it is present, it must coincide with the series variable of `s`.

This method overloads the system function `coeff`. Cf. Example 14.

`Series::Puiseux::direction(s)`

`Series::Puiseux::indet(s)`

`iszero(s)`

This method overloads the system function `iszero`. Cf. Example 18.

`lcoeff(s)`

This method overloads the system function `lcoeff`. See Example 15 and Example 17.

`ldegree(s)`

This method overloads the system function `ldegree`. See Example 2 and Example 15.

`lmonomial(s)`

This method overloads the system function `lmonomial`. See Example 15 and Example 17.

`lterm(s)`

This method overloads the system function `lterm`. See Example 15 and Example 17.

`nthcoeff(s, n)`

This method overloads the system function `nthcoeff`. See Example 16 and  Example 17

`nthmonomial(s, n)`

This method overloads the system function `nthmonomial`. See Example 16 and Example 17.

`nthterm(s, n)`

This method overloads the system function `nthterm`. See Example 16 and Example 17.

`Series::Puiseux::order(s)`

`Series::Puiseux::point(s)`

#### Conversion Methods

`convert(f)`

If no expansion point can be determined from `f`, the origin is used. Cf. Example 19.

`convert_to(s, T)`

Use the function `expr` to convert `s` into an object of a kernel domain.

`Series::Puiseux::convert01(s)`

`Series::Puiseux::convert10(s)`

For undirected expansions, the conversion is not possible in general, and then `s` is returned. However, you can enforce a conversion (with a not necessarily equivalent result) by using properties. Cf. Example 3.

`expr(s)`

This method overloads the system function `expr`. Cf. Example 20.

`float(s)`

This method overloads the system function `float`. Cf. Example 20.

#### Technical Methods

`combine(s)`

This method overloads the system function `combine`; see the corresponding help page for further optional arguments. Cf. Example 21.

```Series::Puiseux::const(f, x | x = x0, n, <d>)```

If the expansion point `x0` is omitted, ```x0 = 0``` is assumed. If the direction `d` is omitted, `d = Undirected` is assumed.

Use with care, since this function does not perform type checking. Cf. Example 1.

```Series::Puiseux::create(b, v, e, l, x, <x0>, <d>)```

If the expansion point `x0` is omitted, ```x0 = 0``` is assumed. If the direction `d` is omitted, `d = Undirected` is assumed.

Use with care, since this function does not perform type checking. Cf. Example 1.

`expand(s)`

This method overloads the system function `expand`; see the corresponding help page for further optional arguments. Cf. Example 21.

`Series::Puiseux::func_call(s, t)`

You may also use this method in the form `s(t)`. Cf. Example 22.

`has(s, t)`

This method overloads the system function `has`. Cf. Example 23.

```map(s, f, <arg1, , …>)```

This method overloads the system function `map`. Cf. Example 21.

`normal(s)`

This method overloads the system function `normal`. Cf. Example 21.

```Series::Puiseux::one(x, <x0>, n, <d>)```

If the expansion point `x0` is omitted, ```x0 = 0``` is assumed. If the direction `d` is omitted, `d = Undirected` is assumed.

Use with care, since this function does not perform type checking. Cf. Example 1.

`print(s)`

`Series::Puiseux::truncate(s, n)`

Cf. Example 24.

`subs(s, old = new)`

```subs(s, [old1 = new1, old2 = new2, …])```

If the series variable `x` of `s` does not occur in the left hand sides `old, old1, old2, ...`, then the substitution takes place in the coefficients and in the expansion point of `s`. The series variable must not occur in the right hand sides `new, new1, new2, ...`.

### Note

In contrast to the usual behavior of `subs`, the result of the substitution is subjected to an additional evaluation.

In the second call, the series variable `x` of `s` must not occur anywhere in the substitution equations. In the first call, `x` is allowed to occur in `old` only if `old` equals `x`. In this case, a change of variable is performed, and `new` must be of the form

`x0 + a*(b*y - c)^k`

if `x0 <> complexInfinity` and

`a*(b*y - c)^k`

if `x0 = complexInfinity`, where

• `x0` is the expansion point of `s`

• `k` is a non-zero rational number

• `y` is an identifier, which may well be equal to `x`, and otherwise `y` must not occur in the coefficients of `s`.

• `a, b, c` are arithmetical expressions not involving `y`, with `a, b` being non-zero. If the direction of `s` is not `Undirected`, then `a` and `b` must represent real numbers.

• `c` is zero if either ```x0 <> complexInfinity``` and `k` is positive or `x0 = complexInfinity` and `k` is negative. In this case, the result of the substitution has expansion point `complexInfinity`.

• If `c` is non-zero, then the result of the substitution has expansion point `c/b`.

Use one of the methods `"_fconcat"` or `"func_call"` for more general substitutions for the series variable.

This method overloads the system function `subs`; Cf. Example 22.

```Series::Puiseux::zero(x, <x0>, n, <d>)```

If the expansion point `x0` is omitted, ```x0 = 0``` is assumed. If the direction `d` is omitted, `d = Undirected` is assumed.

### Note

Although `Series::Puiseux::zero(x, n)` and `O(x^n)` are mathematically equivalent and are printed in the same way, they are different MuPAD® objects. The former is an element of type `Series::Puiseux`, while the latter is an element of type `O`.

Use with care, since this function does not perform type checking. Cf. Example 1.