# Invariants and transformations¶

Invariant class that associates a value with every dimension vector

An invariant can be constructed from a TMPolynomial, a dictionary, a function or another invariant. Every invariant can be transformed to a TMPolynomial or a dictionary. We cache the values of an invariant so that they don’t have to be computed repeatedly.

EXAMPLES:

```sage: from msinvar import *
sage: R=TMPoly(prec=); R
Multivariate Polynomial Ring in x over Rational Field truncated at degree 
sage: x=R.gen(); x.Exp()
1 + x + x^2 + x^3
sage: I=Invariant(x.Exp()); I
Invariant
sage: I.dict()
{(0,): 1, (1,): 1, (2,): 1, (3,): 1}
sage: I.Log().dict()
{(1,): 1}
sage: I.Log().poly()
x
```
class `msinvar.invariants.``Invariant`(f, R=None)[source]

Bases: `object`

Invariant class that associates an invariants I(d) with every dimension vector d.

An argument can be a TMPolynomial, a dictionary, a function or another invariant. Objects have methods that return associated TMPolynomials and dictionaries. If possible, we save the ring (TMPoly) in order to transform our invariant to a polynomial.

• `f` – function, TMPolynomial, dictionary, Invariant.

• `R` – a ring TMPolynomialRing.

`value`()
`get_ring`(I=None)[source]

The ring (TMPolynomialRing) saved by the invariant.

`get_prec`(d=None)[source]

Precision vector of the ring.

`dict`(prec=None, stab=None, slope=0)[source]

Convert invariant to a dictionary, with keys bounded by self.prec().

`poly`(R=None, stab=None, slope=None)[source]

Convert invariant to a TMPolynomial.

`to_series`(R=None, stab=None, slope=None)

Convert invariant to a TMPolynomial.

`series`(R=None, stab=None, slope=None)

Convert invariant to a TMPolynomial.

`term_twist`(f)[source]

Twist every term using the function `f`.

`restrict`(z, slope)[source]

Restrict invariant to dimension vectors d such that z(d)=slope, where `z` is a Stability (or the corresponding vector).

`subs`(**kw)[source]

Apply substitution to every term.

`root_vars`(k=2)[source]

Substitute y^k by y for every variable y.

`simp`(d=None)[source]

Simplify every term.

`plog`(algo='fast')[source]

Take log along every ray.

`pexp`(algo='fast')[source]

Take exp along every ray.

`exp`()[source]

The usual exponential. This method can be quite slow.

`log`()[source]

The usual logarithm. This method can be quite slow.

`Psi`()[source]

Plethystic map Psi.

`IPsi`()[source]

Plethystic map Psi inverse.

`pLog`()[source]

Take plethystic Log along every ray.

`pExp`()[source]

Take plethystic Exp along every ray.

`Exp`()[source]

Take plethystic Exp.

`Log`()[source]

Take plethystic Log.

`msinvar.invariants.``log_map`(I, d=None)[source]

Usual log.

`msinvar.invariants.``exp_map`(I, d=None)[source]

Usual exp.

`msinvar.invariants.``plog_map`(I, d=None)[source]

log along every ray.

`msinvar.invariants.``pexp_map`(I, d=None)[source]

exp along every ray.

`msinvar.invariants.``Psi_map`(I, d=None)[source]

Plethystic Psi.

`msinvar.invariants.``IPsi_map`(I, d=None)[source]

Plethsytic Psi inverse.

`msinvar.invariants.``rat2int_num`(I, d=None)[source]
`msinvar.invariants.``int2rat_num`(I, d=None)[source]
`msinvar.invariants.``recursive_inversion`(T)[source]

Invert the transformation (map on invariants) T, assuming that T(I)(d) is a sum of I(d) and some expression that depends just on I(e) with e<d.

Note that exp and log are not of this form for d=0.

class `msinvar.invariants.``Transform`(F, twist=None)[source]

Bases: `object`

A class to transform invariants. Based on arXiv:2101.07636.

It is encoded by a map from the set of lists of vectors to rational numbers.

We define actions of transforms on 1-collections (Invariant class), plethysm between transforms, inverse transfroms.

INPUT:

• `F` – transformation map from lists of vectors to Q (or base ring).

• `twist` – product twist, map from sequences of vectors to the base ring.

`value`()
`action`(I, d=None)[source]

Action of the transformation on an invariant `I`.

`plethysm`(T, l=None)[source]

Plethysm of self and T.

`inverse`()
`dict`(d)[source]

Dictionary of values for all lists of vectors with the sum <=d.

`msinvar.invariants.``proportional`(a, b=None)[source]

Check if vectors a,b are proportional.

`msinvar.invariants.``exp_transform`(z=None)[source]
`msinvar.invariants.``log_transform`(z=None)[source]
`msinvar.invariants.``reineke_sign`(l, z, tot=None)[source]

Used in `reineke_transform()`.

`msinvar.invariants.``reineke_transform`(z)[source]

Based on arXiv:math/0204059 and arXiv:2101.07636.

`msinvar.invariants.``joyce_sign`(l, z, z1, tot=None)[source]

Used in `joyce_transform()`.

`msinvar.invariants.``joyce_transform`(z, z1)[source]

Based on arXiv:math/0410268 and arXiv:2101.07636.

`msinvar.invariants.``HN_transform`(z)[source]

See arXiv:2101.07636.

`msinvar.invariants.``indivisible`(d)[source]

Return True if `d` is an indivisible vector.

`msinvar.invariants.``plog_fast`(I)[source]

Return the logarithm taken separately along each ray.

We construct a dictionary of such logarithms with keys parametrized by indivisible vectors. The logarithm is taken in the ring of truncated polynomials. Therefore I.R and its precision vector are required.

`msinvar.invariants.``pexp_fast`(I)[source]