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 + pol2
inself
.
-
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
pol1
bypol2
inself
.
-
factor
(pol)¶ Returns the factorisation of the polynomial
pol
.
-
gcd
(pol1, pol2)¶ Returns the gcd of
pol1
andpol2
.
-
gcdex
(pol1, pol2)¶ Returns the extended gcd of
pol1
andpol2
.
-
ideal
(F)¶ Returns the ideal in
self
generated byF
.
-
is_exact
()¶ Tests if
self
is an exact domain.
-
is_field
()¶ Tests if
self
is a field.
-
is_irreducible
(pol)¶ Tests if
pol
is an irreducible polynomial.
-
lcm
(pol1, pol2)¶ Returns the lcm of
pol1
andpol2
.
-
make_monic
(pol)¶ Makes monic the polynomial
pol
.
-
monic
(pol)¶ Makes monic the polynomial
pol
.
-
mul
(pol1, pol2)¶ Returns
pol1 * pol2
inself
.
-
objgen
()¶ Returns
self
and 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^n
inself
.
-
primitive_polynomials
(deg)¶ Returns the primitive polynomials of degree
deg
ifself
is 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
pol1
bypol2
inself
.
-
random_irreducible
(n)¶ Returns a random irreducible polynomial of degree
n
.
-
rem
(pol1, pol2)¶ Returns the remainder of the division of
pol1
bypol2
inself
.
-
roots
(f)¶ Returns the roots of the polynomial
n
.
-
sub
(pol1, pol2)¶ Returns
pol1 - pol2
inself
.
-
univariate_ring
(x)¶ Returns a univariate ring in
x
which 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
self
as an expression.
-
basis_is_groebner
()¶ Tests if the given basis is a groebner basis of
self
.
-
buchberger
()¶ Returns a groebner basis of
self
using 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
self
using 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
self
are homogeneous.
-
is_in_radical_ideal
(f)¶ Tests if
f
is in radical ofself
.
-
leading_ideal
()¶ Returns the leading ideal of
self
.
-
normal_form
(f, greobner=False)¶ Returns the normal form of
f
with respect to the basis ofself
.
-
reduce
(f)¶ Reduces
f
with respect to the basis ofself
.
-
weak_normal_form
(f, greobner=False)¶ Returns the weak normal form of
f
with 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
f
inG
.
-
simula.polyring.groebner.
spoly
(f, g, symbols=None, domain=Rational Numbers, order=DegreeLexicographicOrder())¶ Returns the S-polynomial of
f
andg
.
-
simula.polyring.groebner.
weak_normal_form
(f, G, symbols=None, domain=Rational Numbers, order=DegreeLexicographicOrder())¶ Returns the weak normal form of
f
inG