Domains
Here we document the various implemented ground domains. There are
three types: abstract domains, concrete domains, and “implementation
domains”. Abstract domains cannot be (usefully) instantiated at all,
and just collect together functionality shared by many other domains.
Concrete domains are those meant to be instantiated and used. In some
cases, there are various possible ways to implement the data type the
domain provides. For example, depending on what libraries are
available on the system, the integers are implemented either using the
python built-in integers, or using gmpy. Note that various aliases
are created automatically depending on the libraries available. As
such e.g. ZZ
always refers to the most efficient implementation of
the integer ring available.
Abstract Domains
- class diofant.domains.field.Field[source]
Represents a field domain.
- property field
Return a field associated with
self
.
- class diofant.domains.ring.CommutativeRing[source]
Represents a ring domain.
- abstract property characteristic
Return the characteristic of this ring.
- property ring
Return a ring associated with
self
.
- class diofant.domains.simpledomain.SimpleDomain[source]
Base class for simple domains, e.g. ZZ, QQ.
Concrete Domains
- class diofant.domains.IntegerModRing(order, dom)[source]
General class for quotient rings over integers.
- class diofant.domains.FiniteField(order, dom, modulus=None)[source]
General class for finite fields.
- class diofant.domains.IntegerRing[source]
General class for integer rings.
- property field
Return a field associated with
self
.
- class diofant.domains.AlgebraicField(dom, *ext)[source]
A class for representing algebraic number fields.
- class diofant.domains.RealAlgebraicField(dom, *ext)[source]
A class for representing real algebraic number fields.
- class diofant.domains.ComplexAlgebraicField(dom, *ext)[source]
A class for representing complex algebraic number fields.
- class diofant.polys.rings.PolynomialRing(domain, symbols, order=<diofant.polys.orderings.LexOrder object>)[source]
Return a multivariate polynomial ring.
- property field
Returns a field associated with
self
.
- class diofant.polys.univar.UnivarPolynomialRing(domain, symbols, order=<diofant.polys.orderings.LexOrder object>)[source]
A class for representing univariate polynomial rings.
- dispersionset(p, q=None)[source]
Compute the dispersion set of two polynomials.
For two polynomials \(f(x)\) and \(g(x)\) with \(\deg f > 0\) and \(\deg g > 0\) the dispersion set \(\operatorname{J}(f, g)\) is defined as:
\[\begin{split}\operatorname{J}(f, g) & := \{a \in \mathbb{N}_0 | \gcd(f(x), g(x+a)) \neq 1\} \\ & = \{a \in \mathbb{N}_0 | \deg \gcd(f(x), g(x+a)) \geq 1\}\end{split}\]For a single polynomial one defines \(\operatorname{J}(f) := \operatorname{J}(f, f)\).
Examples
Note that the definition of the dispersion is not symmetric:
>>> R, x = ring('x', QQ)
>>> fp = x**4 - 3*x**2 + 1 >>> gp = fp.shift(-3)
>>> R.dispersionset(fp, gp) {2, 3, 4} >>> R.dispersionset(gp, fp) set()
Computing the dispersion also works over field extensions:
>>> R, x = ring('x', QQ.algebraic_field(sqrt(5)))
>>> fp = x**2 + sqrt(5)*x - 1 >>> gp = x**2 + (2 + sqrt(5))*x + sqrt(5)
>>> R.dispersionset(fp, gp) {2} >>> R.dispersionset(gp, fp) {1, 4}
We can even perform the computations for polynomials having symbolic coefficients:
>>> D, a = ring('a', QQ) >>> R, x = ring('x', D)
>>> fp = 4*x**4 + (4*a + 8)*x**3 + (a**2 + 6*a + 4)*x**2 + (a**2 + 2*a)*x >>> R.dispersionset(fp) {0, 1}
References
- class diofant.polys.fields.FractionField(domain, symbols, order=<diofant.polys.orderings.LexOrder object>)[source]
A class for representing multivariate rational function fields.
- class diofant.domains.RealField(prec=53, dps=None, tol=None)[source]
Real numbers up to the given precision.
- class diofant.domains.ComplexField(prec=53, dps=None, tol=None)[source]
Complex numbers up to the given precision.
- class diofant.domains.ExpressionDomain[source]
A class for arbitrary expressions.
- class Expression(ex)[source]
A class for elements of
ExpressionDomain
.
- dtype[source]
alias of
Expression
Implementation Domains
- class diofant.domains.finitefield.PythonFiniteField(order, modulus=None)[source]
Finite field based on Python’s integers.
- class diofant.domains.finitefield.GMPYFiniteField(order, modulus=None)[source]
Finite field based on GMPY’s integers.
- class diofant.domains.integerring.PythonIntegerRing[source]
Integer ring based on Python’s integers.