3.5 Elements

Module: sage.structure.element

Module-level Functions

is_ModuleElement( x)

Class: AdditiveGroupElement

class AdditiveGroupElement
Generic element of an additive group.

Functions: order

order( self)

Return additive order of element

Special Functions: __invert__,$  $ _mul_

Class: AlgebraElement

class AlgebraElement

Class: CommutativeAlgebra

class CommutativeAlgebra

Class: CommutativeAlgebraElement

class CommutativeAlgebraElement

Class: CommutativeRingElement

class CommutativeRingElement

Functions: inverse_mod,$  $ mod

inverse_mod( self, I)

Return an inverse of self modulo the ideal $ I$ , if defined, i.e., if $ I$ and self together generate the unit ideal.

mod( 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 $ (3)$ .

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 $ f$ . For example, reduction is not implemented for $ \mathbf{Z}[x]$ 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 $ x$ is eliminated. In the next example, both $ y$ and $ z$ 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 $ y$ 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 DedekindDomainElement

Class: Element

class Element
Generic element base class, so all this functionality must be defined by any ring element.

Functions: base_ring,$  $ category,$  $ parent

Special Functions: __cmp__,$  $ _coeff_repr,$  $ _im_gens_,$  $ _is_atomic,$  $ _latex_coeff_repr,$  $ _repr_,$  $ _rich_to_bool,$  $ _set_parent

_im_gens_( 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_

class Element_cmp_
Class for defining comparisons between elements.

Special Functions: __cmp__,$  $ _cmp_

Class: EuclideanDomainElement

class EuclideanDomainElement

Functions: degree,$  $ leading_coefficient,$  $ quo_rem

Special Functions: __floordiv__,$  $ __mod__,$  $ __rfloordiv__,$  $ __rmod__,$  $ _gcd

_gcd( self, other)

Return the greatest common divisor of self and other.

Algorithm 3.2.1 in Cohen, GTM 138.

Class: FieldElement

class FieldElement

Functions: is_unit,$  $ quo_rem

Special Functions: _gcd,$  $ _lcm,$  $ _xgcd

_gcd( self, FieldElement other)

Return the greatest common divisor of self and other.

_lcm( self, FieldElement other)

Return the least common multiple of self and other.

Class: InfinityElement

class InfinityElement

Class: IntegralDomainElement

class IntegralDomainElement

Class: ModuleElement

class ModuleElement
Generic element of a module.

Functions: additive_order,$  $ is_nonzero,$  $ is_zero,$  $ order

additive_order( self)

Return the additive order of self.

order( self)

Return the additive order of self.

Special Functions: __add__,$  $ __neg__,$  $ __pos__,$  $ __radd__,$  $ __rmul__,$  $ __rsub__,$  $ __sub__,$  $ _add_,$  $ _sub_

Class: MonoidElement

class MonoidElement
Generic element of a monoid.

Functions: multiplicative_order,$  $ order

multiplicative_order( self)

Return the multiplicative order of self.

order( self)

Return the multiplicative order of self.

Special Functions: __mul__,$  $ __pow__,$  $ __rmul__,$  $ __rpow__,$  $ _mul_

Class: MultiplicativeGroupElement

class MultiplicativeGroupElement
Generic element of a multiplicative group.

Functions: order

order( self)

Return the multiplicative order of self.

Special Functions: __div__,$  $ __invert__,$  $ __rdiv__,$  $ __rtruediv__,$  $ __truediv__,$  $ _add_,$  $ _div_

Class: PrincipalIdealDomainElement

class PrincipalIdealDomainElement

Functions: gcd,$  $ lcm,$  $ xgcd

gcd( self, right)

Returns the gcd of self and right, or 0 if both are 0.

lcm( self, right)

Returns the least common multiple of self and right.

xgcd( self, right)

Return the extended gcd of self and other, i.e., elements $ r, s, t$ such that

$\displaystyle r = s \cdot self + t \cdot other.
$

Class: RingElement

class RingElement

Functions: additive_order,$  $ is_nonzero,$  $ is_unit,$  $ is_zero,$  $ multiplicative_order,$  $ order

additive_order( self)

Return the additive order of self.

multiplicative_order( self)

Return the multiplicative order of self, if self is a unit, or raise ArithmeticError otherwise.

order( 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.