Source code for

"""Implementation of :class:`RationalField` class. """

from __future__ import print_function, division

from import Field
from import SimpleDomain
from import CharacteristicZero

from sympy.utilities import public

[docs]@public class RationalField(Field, CharacteristicZero, SimpleDomain): """General class for rational fields. """ rep = 'QQ' is_RationalField = is_QQ = True is_Numerical = True has_assoc_Ring = True has_assoc_Field = True
[docs] def algebraic_field(self, *extension): r"""Returns an algebraic field, i.e. `\mathbb{Q}(\alpha, \ldots)`. """ from import AlgebraicField return AlgebraicField(self, *extension)
[docs] def from_AlgebraicField(K1, a, K0): """Convert a ``ANP`` object to ``dtype``. """ if a.is_ground: return K1.convert(a.LC(), K0.dom)