## `revert` -- revert lists or character strings, invert series expansions

#### Introduction

`revert` reverses the ordering of the elements in a list and the ordering of characters in a string. For a series expansion, it returns the functional inverse.

#### Call(s)

`revert(object)`

#### Parameters

`object` | - | a list, a character string, or a series expansion of type `Series::Puiseux`

#### Returns

an object of the same type as the input object, or a symbolic call of type `"revert"`.

### Overloadable:

`object`

#### Related Functions

`series`, `substring`

#### Details

- `revert` is a general function to compute inverses with respect to functional composition, or to reverse the order of operands. This type of functionality may be extended to further types of objects via overloading.
- Currently, the MuPAD library provides functionality for strings and lists, where `revert` reverses the order of the elements or characters, respectively. Further, for series expansions, the functional inverse is returned.
- For all other types of MuPAD objects that do not overload `revert`, the symbolic expression `revert``(object)` is returned.

#### Example 1

`revert` operates on lists and character strings:

    >> revert([1, 2, 3, 4, 5])

                                  [5, 4, 3, 2, 1]

    >> revert("nuf si DAPuM ni gnimmargorP")

                           "Programming in MuPAD is fun"

`revert` operates on series:

    >> revert(series(sin(x), x)) = series(arcsin(x), x)

                        3      5                3      5
                       x    3 x       6        x    3 x       6
                   x + -- + ---- + O(x ) = x + -- + ---- + O(x )
                       6     40                6     40

The functional inverse of the expansion of `exp` around `x = 0` is the expansion of the inverse function `ln` around `x = exp(0) = 1`:

    >> revert(series(exp(x), x, 3)) = series(ln(x), x = 1, 3)

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

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

#### Example 2

For all other types of objects, a symbolic function call is returned:

    >> revert(x + y)

                                   revert(x + y)

The following series expansion is not of type `Series::Puiseux`. Instead, a generalized expansion of type `Series::gseries` is produced. Consequently, `revert` does not compute an inverse:

    >> revert(series(exp(-x)/(1 + x), x = infinity, 3))

                        /    1           1        /     1     \ \
                  revert| -------- - --------- + O| --------- | |
                        | x exp(x)    2           |  3        | |
                        \            x  exp(x)    \ x  exp(x) / /

#### Changes

- no changes

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