Documentation

# `revert`

Revert polynomials, lists, character strings and tables, invert 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

```revert(`object`)
```

## Description

`revert` reverses the ordering of the elements in a list and the ordering of characters in a string, as well as the ordering of the coefficients in a polynomial. For tables, it swaps indices and entries. For a series expansion, it returns the functional inverse.

`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, polynomials, lists, and tables, where `revert` reverses the order of the elements, coefficients, or characters, respectively. In tables, entries are turned into indices and vice versa. E.g., ```revert(table(x = y, 2 = 4))``` yields the table ```table(y = x, 4 = 2)```. 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.

## Examples

### Example 1

`revert` operates on lists and character strings:

`revert([1, 2, 3, 4, 5])`
` `
`revert("nuf si DAPuM ni gnimmargorP")`
` `

`revert` operates on series:

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

`revert` operates on tables:

```t := table(): t[x] := 1: t[y] := 2: t[z] := 3: T := revert(t): T, T, T```
` `

Beware: if an entry is stored under several distinct indices, `revert` reduces the number of table operands:

`revert(table(x = 1, y = 1, z = 3))`
` `

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, 2)`
` `
`delete t, T:`

### Example 2

`revert` computes the reverse of a polynomial:

`revert(poly(x^3 + 2*x + 5))`
` `

The same works for multivariate polynomials, too:

`revert(poly(x^3 + 2*x*y + 5*x + 6*y + 7))`
` `

We could have achieved the same by substituting all indeterminates by their inverses; however, `revert` works faster.

`numer(evalp(poly(x^3 + 2*x*y + 5*x + 6*y + 7), x = 1/x, y = 1/y))`
` `

### Example 3

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

`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))`
` `

## Parameters

 `object` A polynomial, a list, a character string, a table, or a series expansion of type `Series::Puiseux`

## Return Values

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

`object`