donuts module¶
Python binding to the Donuts wrapper for the Rings library.
- class donuts.Polynomial(value=None)[source]¶
Polynomial.
- property as_integer: int¶
Cast the polynomial to an integer.
- coeff(variables, exponents)[source]¶
Return the coefficient specified by variables and exponents.
- Return type:
- coeff_dict(*variables)[source]¶
Cast this polynomial to a map from exponents to coefficients.
- Return type:
Dict
[Sequence
[int
],Polynomial
]
- degree(*variables)[source]¶
Return the degree with respect to the specified variables.
- Return type:
int
- evaluate(variables, values)[source]¶
Return the result of setting the given variables to the specified values.
- Return type:
- evaluate_at_one(*variables)[source]¶
Return the result of setting all the given variables to unity.
- Return type:
- evaluate_at_zero(*variables)[source]¶
Return the result of setting all the given variables to zero.
- Return type:
- property factors: Sequence[Polynomial]¶
Return the factorization of this polynomial.
- property is_integer: bool¶
Return True if the polynomial is an integer.
- property is_minus_one: bool¶
Return True if the polynomial is minus one.
- property is_monic: bool¶
Return True if the polynomial is monic.
- property is_monomial: bool¶
Return True if the polynomial is monomial.
- property is_one: bool¶
Return True if the polynomial is one.
- property is_variable: bool¶
Return True if the polynomial is a variable.
- property is_zero: bool¶
Return True if the polynomial is zero.
- property min_variables: FrozenSet[Variable]¶
Return the set of actually used variables in this polynomial.
- property signum: int¶
Return the signum of the leading coefficient.
- class donuts.RationalFunction(numerator=None, denominator=None)[source]¶
Rational function.
- property as_fraction: Fraction¶
Cast the rational function to a rational number.
- property as_integer: int¶
Cast the rational function to an integer.
- property as_polynomial: Polynomial¶
Cast the rational function to a polynomial.
- property denominator: Polynomial¶
Return the denominator.
- evaluate(variables, values)[source]¶
Return the result of setting the given variables to the specified values.
- Return type:
- evaluate_at_one(*variables)[source]¶
Return the result of setting all the given variables to unity.
- Return type:
- evaluate_at_zero(*variables)[source]¶
Return the result of setting all the given variables to zero.
- Return type:
- property is_fraction: bool¶
Return True if the rational function is a rational number.
- property is_integer: bool¶
Return True if the rational function is an integer.
- property is_minus_one: bool¶
Return True if the rational function is minus one.
- property is_one: bool¶
Return True if the rational function is one.
- property is_polynomial: bool¶
Return True if the rational function is a polynomial.
- property is_variable: bool¶
Return True if the rational function is a variable.
- property is_zero: bool¶
Return True if the rational function is zero.
- property min_variables: FrozenSet[Variable]¶
Return the set of actually used variables in this polynomial.
- property numerator: Polynomial¶
Return the numerator.