# Truncated multivariate polynomials¶

Truncated Multivariate polynomials

EXAMPLES:

```sage: from msinvar import TMPoly
sage: R=TMPoly(QQ,2,'x',prec=(2,2))
sage: R.inject_variables(verbose=False)
sage: (x0+x1).Exp()
1 + x0 + x1 + x0^2 + x0*x1 + x1^2 + x0^2*x1 + x0*x1^2 + x0^2*x1^2
```
class `msinvar.tm_polynomials.``TMPolynomial`(parent, x)[source]

Bases: `sage.rings.polynomial.multi_polynomial_element.MPolynomial_polydict`

The element class for truncated multivariate polynomials. The parent class is `TMPolynomialRing`.

Implementation details:

1. The parent should have a method `le_prec()` to test if a given degree should be present.

2. Truncation is performed in the `__init__()` method.

3. Arithmetic operations are inherited from `MPolynomial_polydict`.

4. We implement Adams operation adams, exp, log and plethystic Exp, Log.

5. Function for the twisted multilpication is given by self.parent().prod_twist

`le_prec`(v)[source]
`prec_num`()[source]
`exp`()[source]
`log`()[source]
`invert`()[source]

For simplicity we invert only poly with constant coefficient 1

`Psi`()[source]
`IPsi`()[source]
`Exp`()[source]
`Log`()[source]
`term_twist`(f)[source]

Multiply every term c*x^v by f(v)

`coeff`(e)[source]

Return the coefficient of degree e monomial as an element of the base_ring.

Note that coefficient returns an element of the polynomial ring.

`subs_base`(**kw)[source]
`subs`(**kw)[source]

Fixes some given variables in a given multivariate polynomial and returns the changed multivariate polynomials. The polynomial itself is not affected. The variable,value pairs for fixing are to be provided as a dictionary of the form {variable:value}.

This is a special case of evaluating the polynomial with some of the variables constants and the others the original variables.

INPUT:

• `fixed` - (optional) dictionary of inputs

• `**kw` - named parameters

OUTPUT: new MPolynomial

EXAMPLES:

```sage: R.<x,y> = QQbar[]
sage: f = x^2 + y + x^2*y^2 + 5
sage: f((5,y))
25*y^2 + y + 30
sage: f.subs({x:5})
25*y^2 + y + 30
```
`restrict`(z, slope)[source]

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

`invar`()[source]
`pLog`()[source]

Plethystic logarithm along every ray.

`pExp`()[source]

Plethystic logarithm along every ray.

class `msinvar.tm_polynomials.``TMPolynomialRing`(base_ring=Rational Field, n=1, names='x', order='negdegrevlex', prec=None, prod_twist=None)[source]

Bases: `sage.rings.polynomial.multi_polynomial_ring.MPolynomialRing_polydict`

Truncated Multivariate polynomial ring.

Multivariate polynomials up to degree `prec`, where `prec` is a degree vector or an integer (total degree). Monomials of degree `prec` are included. We implement Adams operations, plethystic Exp and Log (we introduce the category of lambda rings `msinvar.lambda_rings.LambdaRings` and embed our ring into it).

This is the parent class for truncated multivariate polynomials. It has an alias `TMPoly`. The element class is `TMPolynomial`.

PARAMETERS:

1. `base_ring` – the base of our polynomial algebra.

2. `n` – the number of vairables.

3. `names` – names of variables; can be just ‘x’ or ‘x,y,..’.

4. `prec` - precision vector (or integer, or None) for truncation

5. `order` – the order of variables.

6. `prod_twist` - function that maps exponents (d,e) to the base_ring. The new product is x^d*x^e=prod_twist(d,e)*x^(d+e)

EXAMPLES:

```sage: from msinvar import TMPoly
sage: R=TMPoly(QQ,2,prec=(2,2)); R
Multivariate Polynomial Ring in x0, x1 over Rational Field truncated at degree (2, 2)
sage: x=R.gens(); (x+x)**3
3*x0^2*x1 + 3*x0*x1^2

sage: QR=Frac(PolynomialRing(QQ,'y,t'))
sage: S=TMPoly(QR,2,'x',prec=(2,2))
sage: y,t=QR.gens(); x=S.gens()
y^2*x0^2 + x1^2
sage: (y*x).Exp()
1 + y*x0 + y^2*x0^2

sage: R=TMPoly(QQ,1,prec=2, prod_twist=lambda a,b:2)
sage: x=R.gen(); x*x
2*x^2
```
`Element`
`adams`(a, n)[source]
`zero_tuple`()[source]
`prec`(d=None)[source]
`prec_num`()[source]
`le_prec`(v)[source]
`msinvar.tm_polynomials.``TMPoly`
`msinvar.tm_polynomials.``Exp`(f)[source]
`msinvar.tm_polynomials.``Log`(f)[source]
`msinvar.tm_polynomials.``Psi`(f)[source]
`msinvar.tm_polynomials.``IPsi`(f)[source]