### Navigation

- index
- modules |
- next |
- previous |
- Category Theory »

# Fields

class `sage.categories.fields.``Fields`(base_category)

  Bases: `sage.categories.category_with_axiom.CategoryWithAxiom_singleton`

  The category of (commutative) fields, i.e. commutative rings where all non-zero elements have multiplicative inverses

  EXAMPLES:

      sage: K = Fields()
      sage: K
      Category of fields
      sage: Fields().super_categories()
      [Category of euclidean domains, Category of division rings]

      sage: K(IntegerRing())
      Rational Field
      sage: K(PolynomialRing(GF(3), 'x'))
      Fraction Field of Univariate Polynomial Ring in x over
      Finite Field of size 3
      sage: K(RealField())
      Real Field with 53 bits of precision

  TESTS:

      sage: TestSuite(Fields()).run()

  class `ElementMethods`
    `euclidean_degree`()

      Return the degree of this element as an element of a euclidean domain.

      In a field, this returns 0 for all but the zero element (for which it is undefined).

      EXAMPLES:

          sage: QQ.one().euclidean_degree()
          0

    `gcd`(other)

      Greatest common divisor.

      NOTE:

      Since we are in a field and the greatest common divisor is only determined up to a unit, it is correct to either return zero or one. Note that fraction fields of unique factorization domains provide a more sophisticated gcd.

      EXAMPLES:

          sage: GF(5)(1).gcd(GF(5)(1))
          1
          sage: GF(5)(1).gcd(GF(5)(0))
          1
          sage: GF(5)(0).gcd(GF(5)(0))
          0

      For fields of characteristic zero (i.e., containing the integers as a sub-ring), evaluation in the integer ring is attempted. This is for backwards compatibility:

          sage: gcd(6.0,8); gcd(6.0,8).parent()
          2
          Integer Ring

      If this fails, we resort to the default we see above:

          sage: gcd(6.0*CC.0,8*CC.0); gcd(6.0*CC.0,8*CC.0).parent()
          1.00000000000000
          Complex Field with 53 bits of precision

      AUTHOR:

      - Simon King (2011-02): Trac ticket #10771
    `is_unit`()

      Returns True if `self` has a multiplicative inverse.

      EXAMPLES:

          sage: QQ(2).is_unit()
          True
          sage: QQ(0).is_unit()
          False

    `lcm`(other)

      Least common multiple.

      NOTE:

      Since we are in a field and the least common multiple is only determined up to a unit, it is correct to either return zero or one. Note that fraction fields of unique factorization domains provide a more sophisticated lcm.

      EXAMPLES:

          sage: GF(2)(1).lcm(GF(2)(0))
          0
          sage: GF(2)(1).lcm(GF(2)(1))
          1

      If the field contains the integer ring, it is first attempted to compute the gcd there:

          sage: lcm(15.0,12.0); lcm(15.0,12.0).parent()
          60
          Integer Ring

      If this fails, we resort to the default we see above:

          sage: lcm(6.0*CC.0,8*CC.0); lcm(6.0*CC.0,8*CC.0).parent()
          1.00000000000000
          Complex Field with 53 bits of precision
          sage: lcm(15.2,12.0)
          1.00000000000000

      AUTHOR:

      - Simon King (2011-02): Trac ticket #10771
    `quo_rem`(other)

      Return the quotient with remainder of the division of this element by `other`.

      INPUT:

      - `other` – an element of the field

      EXAMPLES:

          sage: f,g = QQ(1), QQ(2)
          sage: f.quo_rem(g)
          (1/2, 0)

    `xgcd`(other)

      Compute the extended gcd of `self` and `other`.

      INPUT:

      - `other` – an element with the same parent as `self`

      OUTPUT:

      A tuple `(r, s, t)` of elements in the parent of `self` such that `r = s * self + t * other`. Since the computations are done over a field, `r` is zero if `self` and `other` are zero, and one otherwise.

      AUTHORS:

      - Julian Rueth (2012-10-19): moved here from `sage.structure.element.FieldElement`

      EXAMPLES:

          sage: (1/2).xgcd(2)
          (1, 2, 0)
          sage: (0/2).xgcd(2)
          (1, 0, 1/2)
          sage: (0/2).xgcd(0)
          (0, 0, 0)

  `Fields.``Finite`

    alias of `FiniteFields`

  class `Fields.``ParentMethods`
    `fraction_field`()

      Returns the fraction field of `self`, which is `self`.

      EXAMPLES:

          sage: QQ.fraction_field() is QQ
          True

    `is_field`(proof=True)

      Returns True as `self` is a field.

      EXAMPLES:

          sage: QQ.is_field()
          True
          sage: Parent(QQ,category=Fields()).is_field()
          True

    `is_integrally_closed`()

      Return `True`, as per `IntegralDomain.is_integrally_closed()`: for every field \(F\), \(F\) is its own field of fractions, hence every element of \(F\) is integral over \(F\).

      EXAMPLES:

          sage: QQ.is_integrally_closed()
          True
          sage: QQbar.is_integrally_closed()
          True
          sage: Z5 = GF(5); Z5
          Finite Field of size 5
          sage: Z5.is_integrally_closed()
          True

    `is_perfect`()

      Return whether this field is perfect, i.e., its characteristic is \(p=0\) or every element has a \(p\)-th root.

      EXAMPLES:

          sage: QQ.is_perfect()
          True
          sage: GF(2).is_perfect()
          True
          sage: FunctionField(GF(2), 'x').is_perfect()
          False

  `Fields.``extra_super_categories`()

    EXAMPLES:

        sage: Fields().extra_super_categories()
        [Category of euclidean domains]

### Navigation

- index
- modules |
- next |
- previous |
- Category Theory »