Revert polynomials, lists, character strings and tables, invert series expansions
This functionality does not run in MATLAB.
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
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
the order of the elements, coefficients, or characters, respectively.
In tables, entries are turned into indices and vice versa. E.g.,
= 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
the symbolic expression
revert(object) is returned.
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,
the number of table operands:
revert(table(x = 1, y = 1, z = 3))
revert(series(exp(x), x, 3)) = series(ln(x), x = 1, 2)
delete t, T:
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))
For all other types of objects, a symbolic function call is returned:
revert(x + y)
revert(series(exp(-x)/(1 + x), x = infinity, 3))
Object of the same type as the input object, or a symbolic call