Polynomials ring¶
Multivariate Polynomials ring¶
Operations over polynomial rings.
- 
class 
simula.polyring.polyring.PolynomialRing(domain, symbols=None, order=DegreeLexicographicOrder(), **kwargs)¶ Multivariate polynomial ring.
INPUT:
- Paramètres
 domain – a domain (eg. QQ, RR, CC, ZZ, GF(p))
symbols – a sequence of symbols
order – (default “deglex”) a monomial ordering e.g. “lex”, “deglex”, “degrevlex”
kwargs –
EXAMPLES:
simula : R = PolynomialRing(QQ, "x, y, z", order="lex") simula : x, y ,z = R.gens These two lines are equivalent to the following code: simula : R.<x, y ,z> = PolynomialRing(QQ, "x, y, z", order="lex") By default the monomial ordering is "deglex", if don't need to change it, we can simplify again the notation. simula : R.<x, y ,z> = QQ[] simula : p1 = x^3*y-x*y^2-x-z; p1 x^3*y - x*y^2 - x - z simula : p1.lcm(x-y-y*z) x^4*y - x^3*y^2*z - x^3*y^2 - x^2*y^2 - x^2 + x*y^3*z + x*y^3 + x*y*z + x*y - x*z + y*z^2 + y*z simula : R.make_monic(6x^4-3x-1) x^4 - 1/2x - 1/6 simula : I = R.ideal([x*y^2-y-z, x^2*z-y*x]); I ideal generated by [x*y^2 - y - z, x^2*z - x*y] of Polynomial ring in x, y, z over QQ with deglex order
- 
add(pol1, pol2)¶ Returns
pol1 + pol2inself.
- 
change_ring(domain=None, symbols=None, order=None)¶ Returns a new polynomial ring with the new given domain
domain.
- 
characteristic()¶ Returns the characteristic
self.
- 
cyclotomic_polynomial(n)¶ Returns the n-th cyclotomic polynomial.
EXAMPLES:
simula : R.<x> = GF(5)[] simula : R.cyclotomic_polynomial(3) x^2 + x + 1 simula : R.cyclotomic_polynomial(6) x^2 + 4x + 1
- 
div(pol1, pol2)¶ Returns the quotient and the remainder of the division of
pol1bypol2inself.
- 
factor(pol)¶ Returns the factorisation of the polynomial
pol.
- 
gcd(pol1, pol2)¶ Returns the gcd of
pol1andpol2.
- 
gcdex(pol1, pol2)¶ Returns the extended gcd of
pol1andpol2.
- 
ideal(F)¶ Returns the ideal in
selfgenerated byF.
- 
is_exact()¶ Tests if
selfis an exact domain.
- 
is_field()¶ Tests if
selfis a field.
- 
is_irreducible(pol)¶ Tests if
polis an irreducible polynomial.
- 
lcm(pol1, pol2)¶ Returns the lcm of
pol1andpol2.
- 
make_monic(pol)¶ Makes monic the polynomial
pol.
- 
monic(pol)¶ Makes monic the polynomial
pol.
- 
mul(pol1, pol2)¶ Returns
pol1 * pol2inself.
- 
objgen()¶ Returns
selfand its generators.EXAMPLES:
simula : ring = PolynomialRing(QQ, "x, y, z", order="lex"); ring simula : R, gens = ring.objgen() simula : R Multivariate Polynomial Ring in x, y, z over QQ with lex order simula : gens (x, y, z)
- 
pow(pol, n)¶ Returns
pol1^ninself.
- 
primitive_polynomials(deg)¶ Returns the primitive polynomials of degree
degifselfis a finite polynomial ring.EXAMPLES:
simula : R.<x> = GF(5)[] simula : R.primitive_polynomials(3) {x^2 + x + 2, x^2 + 4x + 2, x^2 + 3x + 3, x^2 + 2x + 3}
- 
quo(pol1, pol2)¶ Returns the quotient of the division of
pol1bypol2inself.
- 
random_irreducible(n)¶ Returns a random irreducible polynomial of degree
n.
- 
rem(pol1, pol2)¶ Returns the remainder of the division of
pol1bypol2inself.
- 
roots(f)¶ Returns the roots of the polynomial
n.
- 
sub(pol1, pol2)¶ Returns
pol1 - pol2inself.
- 
univariate_ring(x)¶ Returns a univariate ring in
xwhich has the same domain asself.
Groeber Bases¶
Operations over Groebner Bases.
- 
class 
simula.polyring.groebner.Ideal(F, symbols=None, domain=None, order=None, *, ring=None)¶ Ideal generated by a set of polynomials
F.- Paramètres
 F – a list of polynomials
symbols – (optional) list of variables
domain – (optional) a domain e.g. QQ, RR, ZZ
order – (optional) a monomial ordering e.g. “lex”, “deglex”, “degrevlex”
ring – (optional) a polynomial ring.
EXEMPLES:
simula : R.<x, y, z> = QQ[] simula : R Multivariate Polynomial Ring in x, y, z over QQ with deglex order simula : I = ideal([x^2*y-z, x*y-1]); I ideal generated by [x^2*y - z, x*y - 1] of Polynomial ring in x, y, z over QQ with deglex order simula : J = (x^2*y-z, x*y-1) * R; J ideal generated by [x^2*y simula : I == J True simula : J.groebner_basis() [y*z - 1, x - z] simula : J.buchberger() [x^2*y - z, x*y - 1, x - z, y*z - 1] simula : J.homogenize('h') ideal generated by [x^2*y - z*h^2, x*y - h^2] of Polynomial ring in x, y, z, h over QQ with deglex order simula : J.reduce(x-y) -y + z simula : J.reduce(x^2*y-z + 2x*y-2) 0
- 
basis()¶ Returns the basis of
self.
- 
basis_as_expr()¶ Returns the basis of
selfas an expression.
- 
basis_is_groebner()¶ Tests if the given basis is a groebner basis of
self.
- 
buchberger()¶ Returns a groebner basis of
selfusing a toy Buchberger algorithm.
- 
change_ring(new_ring)¶ Returns a new ideal with the new polynomial ring.
- 
groebner_basis()¶ Returns a reduced groebner basis of
self.
- 
groebner_basis_f5()¶ Returns a reduced groebner basis of
selfusing the F5 algorithm.
- 
homogenize(var=None)¶ Returns the ideal generated by the homogeneous polynomials of the basis of
self.
- 
is_homogeneous()¶ Tests if the polynomials in the basis of
selfare homogeneous.
- 
is_in_radical_ideal(f)¶ Tests if
fis in radical ofself.
- 
leading_ideal()¶ Returns the leading ideal of
self.
- 
normal_form(f, greobner=False)¶ Returns the normal form of
fwith respect to the basis ofself.
- 
reduce(f)¶ Reduces
fwith respect to the basis ofself.
- 
weak_normal_form(f, greobner=False)¶ Returns the weak normal form of
fwith respect to the basis ofself.
- 
simula.polyring.groebner.LC(f, symbols=None, **kwargs)¶ Returns the leading coefficient of
f.
- 
simula.polyring.groebner.LM(f, symbols=None, **kwargs)¶ Returns the leading monomial of
f.
- 
simula.polyring.groebner.LT(f, symbols=None, **kwargs)¶ Returns the leading term of
f.
- 
simula.polyring.groebner.groebner_basis(G, symbols=None, domain=None, order=None)¶ Returns a reduced groebner basis of the ideal generated by ``G`.
- 
simula.polyring.groebner.groebner_f5(G, symbols=None, domain=None, order=None)¶ Returns a reduce groebner basis using the F5 algorithm.
- 
simula.polyring.groebner.ideal¶ alias of
simula.polyring.groebner.Ideal
- 
simula.polyring.groebner.leading_coefficient(f, symbols=None, **kwargs)¶ Returns the leading coefficient of
f.
- 
simula.polyring.groebner.leading_ideal(I)¶ Returns the leading ideal of
I.- Paramètres
 
- 
simula.polyring.groebner.leading_monom(f, symbols=None, **kwargs)¶ Returns the leading monomial of
f.
- 
simula.polyring.groebner.leading_term(f, symbols=None, **kwargs)¶ Returns the leading term of
f.
- 
simula.polyring.groebner.normal_form(f, G, symbols=None, domain=Rational Numbers, order=DegreeLexicographicOrder())¶ Returns the normal form of
finG.
- 
simula.polyring.groebner.spoly(f, g, symbols=None, domain=Rational Numbers, order=DegreeLexicographicOrder())¶ Returns the S-polynomial of
fandg.
- 
simula.polyring.groebner.weak_normal_form(f, G, symbols=None, domain=Rational Numbers, order=DegreeLexicographicOrder())¶ Returns the weak normal form of
finG