Module: sage.structure.element
Module-level Functions
x) |
Class: AdditiveGroupElement
Functions: order
self) |
Return additive order of element
Special Functions: __invert__,
_mul_
Class: AlgebraElement
Class: CommutativeAlgebra
Class: CommutativeAlgebraElement
Class: CommutativeRingElement
Functions: inverse_mod,
mod
self, I) |
Return an inverse of self modulo the ideal
, if defined,
i.e., if
and self together generate the unit ideal.
self, I) |
Return a representative for self modulo the ideal I (or the ideal generated by the elements of I if I is not an ideal.)
Integers Reduction of 5 modulo an ideal:
sage: n = 5 sage: n.mod(3*ZZ) 2
Reduction of 5 modulo the ideal generated by 3.
sage: n.mod(3) 2
Reduction of 5 modulo the ideal generated by 15 and 6, which is
.
sage: n.mod([15,6]) 2
Univiate polynomials
sage: x = PolynomialRing(Q).gen() sage: f = x^3 + x + 1 sage: f.mod(x + 1) -1
When little is implemented about a given ring, then mod may
return simply return
. For example, reduction is not
implemented for
yet. (TODO!)
sage: x = PolynomialRing(Z).gen() sage: f = x^3 + x + 1 sage: f.mod(x + 1) x^3 + x + 1
Multivariate polynomials We reduce a polynomial in two variables modulo a polynomial and an ideal:
sage: x,y,z = PolynomialRing(Q, 3, 'xyz').gens() sage: (x^2 + y^2 + z^2).mod(x+y+z) 2*z^2 + 2*y*z + 2*y^2
Notice above that
is eliminated. In the next example,
both
and
are eliminated.
sage: (x^2 + y^2 + z^2).mod( (x - y, y - z) ) 3*z^2 sage: f = (x^2 + y^2 + z^2)^2; f z^4 + 2*y^2*z^2 + y^4 + 2*x^2*z^2 + 2*x^2*y^2 + x^4 sage: f.mod( (x - y, y - z) ) 9*z^4
In this example
is eliminated.
sage: (x^2 + y^2 + z^2).mod( (x^3, y - z) ) 2*z^2 + x^2
Special Functions: _im_gens_
Class: DedekindDomainElement
Class: Element
Functions: base_ring,
category,
parent
Special Functions: __cmp__,
_coeff_repr,
_im_gens_,
_is_atomic,
_latex_coeff_repr,
_repr_,
_rich_to_bool,
_set_parent
self, codomain, im_gens) |
Return the image of self in codomain under the map that sends the images of the generators of the parent of self to the tuple of elements of im_gens.
Class: Element_cmp_
Special Functions: __cmp__,
_cmp_
Class: EuclideanDomainElement
Functions: degree,
leading_coefficient,
quo_rem
Special Functions: __floordiv__,
__mod__,
__rfloordiv__,
__rmod__,
_gcd
self, other) |
Return the greatest common divisor of self and other.
Algorithm 3.2.1 in Cohen, GTM 138.
Class: FieldElement
Functions: is_unit,
quo_rem
Special Functions: _gcd,
_lcm,
_xgcd
self, FieldElement other) |
Return the greatest common divisor of self and other.
self, FieldElement other) |
Return the least common multiple of self and other.
Class: InfinityElement
Class: IntegralDomainElement
Class: ModuleElement
Functions: additive_order,
is_nonzero,
is_zero,
order
self) |
Return the additive order of self.
self) |
Return the additive order of self.
Special Functions: __add__,
__neg__,
__pos__,
__radd__,
__rmul__,
__rsub__,
__sub__,
_add_,
_sub_
Class: MonoidElement
Functions: multiplicative_order,
order
self) |
Return the multiplicative order of self.
self) |
Return the multiplicative order of self.
Special Functions: __mul__,
__pow__,
__rmul__,
__rpow__,
_mul_
Class: MultiplicativeGroupElement
Functions: order
self) |
Return the multiplicative order of self.
Special Functions: __div__,
__invert__,
__rdiv__,
__rtruediv__,
__truediv__,
_add_,
_div_
Class: PrincipalIdealDomainElement
Functions: gcd,
lcm,
xgcd
self, right) |
Returns the gcd of self and right, or 0 if both are 0.
self, right) |
Returns the least common multiple of self and right.
self, right) |
Return the extended gcd of self and other, i.e., elements
such that
Class: RingElement
Functions: additive_order,
is_nonzero,
is_unit,
is_zero,
multiplicative_order,
order
self) |
Return the additive order of self.
self) |
Return the multiplicative order of self, if self is a unit, or raise
ArithmeticError
otherwise.
self) |
Return the additive order of self.
Special Functions: __add__,
__div__,
__invert__,
__mul__,
__neg__,
__pos__,
__pow__,
__radd__,
__rdiv__,
__rmul__,
__rpow__,
__rsub__,
__rtruediv__,
__sub__,
__truediv__,
_add_,
_div_,
_mul_,
_sub_
See About this document... for information on suggesting changes.