# Series::gseries

Generalized series expansions

### Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

## Syntax

```Series::gseries(`f`, `x`, <`order`>, <`Left | Right`>)
Series::gseries(`f`, `x = a`, <`order`>, <`Left | Right`>)
```

## Description

`Series::gseries` is the domain of series expansions generalizing Taylor, Laurent and Puiseux expansions.

The call `Series::gseries(f, x)` computes a series expansion at the right hand side of x = 0.

The system functions `series` and `asympt` are the main application of this domain. The latter function only returns elements of this domain, whereas `series` can return an element of `Series::gseries` in cases, where a Puiseux series expansion does not exist.

There may be no need to explicitly create elements of this domain, but to work with the results of the mentioned system functions.

See the help page of the system function `asympt` for a detailed description of the parameters and examples for working with elements of the domain `Series::gseries`.

 Note:   Note that elements of `Series::gseries` only represents directional (real) series expansions.

## Environment Interactions

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

## Parameters

 `f` An arithmetical expression `x` The series variable: an identifier `a` The expansion point: an arithmetical expression or ±`infinity` `order` The truncation order: a nonnegative integer

## Options

 `Left` Compute a series expansion that is valid for real x smaller than a. `Right` Compute a series expansion that is valid for real x larger than a (the default case).

## Return Values

Object of domain type `Series::gseries`, or the value `FAIL`.

## Function Calls

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

## Operations

`Series::gseries` implements standard arithmetic of generalized series expansions. Use the ordinary arithmetical operators `+`, `-`, `*`, `/`, and `^`.

The system functions `coeff`, `lcoeff`, `nthcoeff`, `lterm`, `nthterm`, `lmonomial`, `nthmonomial`, and `ldegree` work on generalized series expansions. See the corresponding help pages of these functions for calling parameters. See the description of these methods below for further details.

The method `"indet"` returns the series variable of the series expansion, i.e., if `s` is an object of the domain `Series::gseries`, then `s::dom::indet(s)` returns the series variable.

The method `"point"` returns the expansion point of the series.

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

## Operands

A series of the domain type `Series::gseries` consists of four operands:

1. A list of pairs [ci, fi]. Each pair represents a monomialcifi of the series expansion, where the ci are the coefficients and fi the terms of `s`. The coefficients do not contain the series variable.

This list can be empty, if the order of the expansion is zero.

2. An arithmetical expression `g` representing the error term of the form O(g). It may be the integer 0, in which case the expansion is exact.

3. The series variable` x`.

4. The expansion point` a`.

collapse all

## Mathematical Methods

### `_divide` — Divide two series expansions

`_divide(s, t)`

If the arguments are not of domain type `Series::gseries`, then they are converted into such objects. `FAIL` is returned, if one of these conversions fails.

This method overloads the function `_divide` for elements of `Series::gseries`, i.e., you may use it in the form `s/t`.

### `_invert` — Multiplicative inverse of a series expansion

`_invert(s)`

This method overloads the function `_invert` for elements of `Series::gseries`, i.e., you may use it in the form `1/s`.

### `_mult` — Multiply series expansions

`_mult(s, t, …)`

If both `s` and `t` are series expansions of the domain `Series::gseries`, then the result is a series expansion of the domain `Series::gseries`, too. Both series expansions must have the same series variable and expansion point, otherwise `FAIL` is returned.

If `s` or `t` is a series expansion of the domain `Series::Puiseux`, then it is converted into an object of `Series::gseries`. If this fails, then `FAIL` is returned. Otherwise, the product is computed and returned as an object of the domain `Series::gseries`.

If `s` is a series expansion and `t` is an arithmetical expression, then `t` is converted into a series expansion via the constructor `Series::gseries` (and vice versa).

Each argument of this method that is not of the domain type `Series::gseries` is converted into such an element, i.e., a generalized series expansion is computed. If this fails, then `FAIL` is returned.

This method overloads the function `_mult` for elements of `Series::gseries`, i.e., you may use it in the form `s*t*...`.

### `_negate` — Negative of a series expansion

`_negate(s)`

This method overloads the function `_negate` for elements of `Series::gseries`, i.e., you may use it in the form `-s`.

### `_plus` — Add series expansions

`_plus(s, t, …)`

If both `s` and `t` are series expansions of the domain `Series::gseries`, then the result is a series expansion of the domain `Series::gseries`, too. Both series expansions must have the same series variable and expansion point, otherwise `FAIL` is returned.

If `s` or `t` is a series expansion of the domain `Series::Puiseux`, then it is converted into an object of `Series::gseries`. If this fails, then `FAIL` is returned. Otherwise, the sum is computed and returned as an object of the domain `Series::gseries`.

If `s` is a series expansion and `t` is an arithmetical expression, then `t` is converted into a series expansion via the constructor `Series::gseries` (and vice versa).

Each argument of this method that is not of the domain type `Series::gseries` is converted into such an element, i.e., a generalized series expansion is computed. If this fails, then `FAIL` is returned.

This method overloads the function `_plus` for elements of `Series::gseries`, i.e., you may use it in the form `s+t+ ...`.

### `_power` — Exponentiation of a series expansion

`_power(s, n)`

The exponent n must not involve the series variable of s. Otherwise, an error occurs.

If n is a positive integer, then repeated squaring is used for computing the `n`th power of `s`. Otherwise, the binomial theorem is applied after factoring out the leading monomial.

This method overloads the function `_power` for elements of `Series::gseries`, i.e., you may use it in the form `s^n`.

### `_subtract` — Subtract two series expansions

`_subtract(s, t)`

If the arguments are not of domain type `Series::gseries`, then they are converted into such objects. `FAIL` is returned, if one of these conversions fails.

This method overloads the function `_subtract` for elements of `Series::gseries`, i.e., you may use it in the form `s-t`.

## Access Methods

### `coeff` — Extract coefficients

`coeff(s, <n>)`

This method overloads the function `coeff` for elements of `Series::gseries`.

### `indet` — Serie variable

`Series::gseries::indet(s)`

Use the method `"point"` to get the expansion point of `s`.

### `iszero` — Zero test

`iszero(s)`

This method overloads the function `iszero` for elements of `Series::gseries`.

### `lcoeff` — Leading coefficient

`lcoeff(s)`

This method overloads the function `lcoeff` for elements of `Series::gseries`.

### `ldegree` — Leading degree

`ldegree(s)`

This method overloads the function `ldegree` for elements of `Series::gseries`.

### `lmonomial` — Leading monomial

`lmonomial(s)`

This method overloads the function `lmonomial` for elements of `Series::gseries`.

### `lterm` — Leading term

`lterm(s)`

This method overloads the function `lterm` for elements of `Series::gseries`.

### `nthcoeff` — Extract a coefficient

`nthcoeff(s, n)`

This method overloads the function `nthcoeff` for elements of `Series::gseries`.

### `nthmonomial` — Extract a monomial

`nthmonomial(s, n)`

This method overloads the function `nthmonomial` for elements of `Series::gseries`.

### `nthterm` — Extract a term

`nthterm(s, n)`

This method overloads the function `nthterm` for elements of `Series::gseries`.

### `point` — Expansion point

`Series::gseries::point(s)`

Use the method `"indet"` to get the series variable of `s`.

## Conversion Methods

### `convert` — Convert an object into a generalized series expansion

`Series::gseries::convert(x)`

### `convert_to` — Convert a generalized series expansion into other domains

`Series::gseries::convert_to(s, T)`

`T` might be the domain `DOM_POLY`, where the sum of monomials is considered as a polynomial in the indeterminates of the third operand of `s`.

If `T` is the domain `DOM_EXPR`, then the conversion is the same as implemented by the method `"expr"` (see below).

If `T` is the domain `Series::Puiseux`, then the system tries to convert `s` into a Puiseux series. If the conversion is not possible, `FAIL` is returned.

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

### `create` — Create simple and fast a generalized series expansion

```Series::gseries::create(list, errorTerm, x = a)```

 Note:   This method should be used with caution, because no argument checking is performed. Use it to create, not to compute elements of `Series::gseries`.

### `expr` — Convert a generalized series expansion into an element of a kernel domain

`expr(s)`

This method overloads the function `expr` for elements of `Series::gseries`.

### `series` — Apply the function `series` to a generalized series expansion

```series(s, x | x = x0, <order>, <dir>)```

This method overloads the function `series` for elements of `Series::gseries`. See the corresponding help page for a description of the possible arguments.

## Technical Methods

### `combine` — Apply the function `combine` to all terms

`combine(s, <target>)`

This method overloads the system function `combine`. See the corresponding help page for a description of the optional argument `target`.

### `has` — Check whether an object occurs syntactically

`has(s, t)`

This method overloads the system function `has`.

### `map` — Map a function to the coefficients

`map(s, func, …)`

This method overloads the function `map` for elements of `Series::gseries`.

### `print` — Pretty-print routine

`print(s)`

### `subs` — Substitute into a generalized series expansion

`subs(s, x = a, …)`

This method overloads the function `subs` for elements of `Series::gseries`.

### `TeX` — LaTeX formatting

`Series::gseries::TeX(s)`

This method is called by the system function `generate::TeX`.