+
    i^                         R t ^ RIHt ^ RIHtHtHt ^ RIHt ^ RI	H
t
 ^ RIHt ^ RIHt ^ RIHt ] ! R R	]
]]4      4       t]! 4       tR
# )z0Implementation of :class:`RationalField` class. MPQ)SymPyRational	is_squaresqrtrem)CharacteristicZero)Field)SimpleDomain)CoercionFailed)publicc                     a  ] tR t^t o RtRtRtR;ttRt	Rt
Rt]t]! ^ 4      t]! ^4      t]! ]4      tR tR tR tR tR tR	 tR
R/R ltR tR tR tR tR tR tR tR t R t!R t"R t#R t$R t%R t&R t'R t(R t)Rt*V t+R# )RationalFielda  Abstract base class for the domain :ref:`QQ`.

The :py:class:`RationalField` class represents the field of rational
numbers $\mathbb{Q}$ as a :py:class:`~.Domain` in the domain system.
:py:class:`RationalField` is a superclass of
:py:class:`PythonRationalField` and :py:class:`GMPYRationalField` one of
which will be the implementation for :ref:`QQ` depending on whether either
of ``gmpy`` or ``gmpy2`` is installed or not.

See also
========

Domain
QQTc                    R # )N selfs   &ځ/Users/tonyclaw/.openclaw/workspace/skills/math-calculator/venv/lib/python3.14/site-packages/sympy/polys/domains/rationalfield.py__init__RationalField.__init__-   s        c                >    \        V\        4      '       d   R# \        # )z0Returns ``True`` if two domains are equivalent. T)
isinstancer   NotImplemented)r   others   &&r   __eq__RationalField.__eq__0   s    e]++!!r   c                    \        R4      # )zReturns hash code of ``self``. r   )hashr   s   &r   __hash__RationalField.__hash__7   s    Dzr   c                    ^ RI Hp V# )z'Returns ring associated with ``self``. )ZZ)sympy.polys.domainsr"   )r   r"   s   & r   get_ringRationalField.get_ring;   s
    *	r   c                f    \        \        VP                  4      \        VP                  4      4      # )z!Convert ``a`` to a SymPy object. )r   int	numeratordenominatorr   as   &&r   to_sympyRationalField.to_sympy@   s!    S-s1==/ABBr   c                   VP                   '       d!   \        VP                  VP                  4      # VP                  '       d-   ^ RIHp \        \        \        VP                  V4      4      !  # \        RV,          4      h)z&Convert SymPy's Integer to ``dtype``. )RRz"expected `Rational` object, got %s)is_Rationalr   pqis_Floatr#   r/   mapr'   to_rationalr
   )r   r+   r/   s   && r   
from_sympyRationalField.from_sympyD   sW    ===qssACC= ZZZ.C!2344 !E!IJJr   aliasNc               &    ^ RI Hp V! V .VO5RV/ # )a  Returns an algebraic field, i.e. `\mathbb{Q}(\alpha, \ldots)`.

Parameters
==========

*extension : One or more :py:class:`~.Expr`
    Generators of the extension. These should be expressions that are
    algebraic over `\mathbb{Q}`.

alias : str, :py:class:`~.Symbol`, None, optional (default=None)
    If provided, this will be used as the alias symbol for the
    primitive element of the returned :py:class:`~.AlgebraicField`.

Returns
=======

:py:class:`~.AlgebraicField`
    A :py:class:`~.Domain` representing the algebraic field extension.

Examples
========

>>> from sympy import QQ, sqrt
>>> QQ.algebraic_field(sqrt(2))
QQ<sqrt(2)>
)AlgebraicFieldr8   )r#   r:   )r   r8   	extensionr:   s   &$* r   algebraic_fieldRationalField.algebraic_fieldN   s    6 	7d<Y<e<<r   c                ~    VP                   '       d+   V P                  VP                  4       VP                  4      # R# )zRConvert a :py:class:`~.ANP` object to :ref:`QQ`.

See :py:meth:`~.Domain.convert`
N)	is_groundconvertLCdomK1r+   K0s   &&&r   from_AlgebraicField!RationalField.from_AlgebraicFieldl   s-    
 ;;;::addfbff-- r   c                    \        V4      # z.Convert a Python ``int`` object to ``dtype``. r   rC   s   &&&r   from_ZZRationalField.from_ZZt       1vr   c                    \        V4      # rI   r   rC   s   &&&r   from_ZZ_pythonRationalField.from_ZZ_pythonx   rL   r   c                B    \        VP                  VP                  4      # z3Convert a Python ``Fraction`` object to ``dtype``. r   r(   r)   rC   s   &&&r   from_QQRationalField.from_QQ|       1;;..r   c                B    \        VP                  VP                  4      # rQ   rR   rC   s   &&&r   from_QQ_pythonRationalField.from_QQ_python   rU   r   c                    \        V4      # )z,Convert a GMPY ``mpz`` object to ``dtype``. r   rC   s   &&&r   from_ZZ_gmpyRationalField.from_ZZ_gmpy   rL   r   c                    V# )z,Convert a GMPY ``mpq`` object to ``dtype``. r   rC   s   &&&r   from_QQ_gmpyRationalField.from_QQ_gmpy   s    r   c                R    VP                   ^ 8X  d   \        VP                  4      # R# )z3Convert a ``GaussianElement`` object to ``dtype``. N)yr   xrC   s   &&&r   from_GaussianRationalField(RationalField.from_GaussianRationalField   s    33!8qss8O r   c                N    \        \        \        VP                  V4      4      !  # )z.Convert a mpmath ``mpf`` object to ``dtype``. )r   r4   r'   r5   rC   s   &&&r   from_RealFieldRationalField.from_RealField   s    CR^^A./00r   c                8    \        V4      \        V4      ,          # )z=Exact quotient of ``a`` and ``b``, implies ``__truediv__``.  r   r   r+   bs   &&&r   exquoRationalField.exquo       1vAr   c                8    \        V4      \        V4      ,          # )z6Quotient of ``a`` and ``b``, implies ``__truediv__``. r   rh   s   &&&r   quoRationalField.quo   rl   r   c                    V P                   # )z0Remainder of ``a`` and ``b``, implies nothing.  )zerorh   s   &&&r   remRationalField.rem   s    yyr   c                P    \        V4      \        V4      ,          V P                  3# )z6Division of ``a`` and ``b``, implies ``__truediv__``. )r   rq   rh   s   &&&r   divRationalField.div   s    1vA		))r   c                    VP                   # )zReturns numerator of ``a``. )r(   r*   s   &&r   numerRationalField.numer   s    {{r   c                    VP                   # )zReturns denominator of ``a``. )r)   r*   s   &&r   denomRationalField.denom   s    }}r   c                f    \        VP                  4      ;'       d    \        VP                  4      # )zReturn ``True`` if ``a`` is a square.

Explanation
===========
A rational number is a square if and only if there exists
a rational number ``b`` such that ``b * b == a``.
)r   r(   r)   r*   s   &&r   r   RationalField.is_square   s$     %BB)AMM*BBr   c                    VP                   ^ 8  d   R# \        VP                   4      w  r#V^ 8w  d   R# \        VP                  4      w  rEV^ 8w  d   R# \        W$4      # )zUNon-negative square root of ``a`` if ``a`` is a square.

See also
========
is_square
N)r(   r   r)   r   )r   r+   p_sqrtp_remq_sqrtq_rems   &&    r   exsqrtRationalField.exsqrt   sQ     ;;?,A:.A:6""r   r   ),__name__
__module____qualname____firstlineno____doc__repr8   is_RationalFieldis_QQis_Numericalhas_assoc_Ringhas_assoc_Fieldr   dtyperq   onetypetpr   r   r   r$   r,   r6   r<   rF   rJ   rN   rS   rW   rZ   r]   rb   re   rj   rn   rr   ru   rx   r{   r   r   __static_attributes____classdictcell__)__classdict__s   @r   r   r      s      CE##uLNOE8D
(C	cB"
CK= =<.//
1*C# #r   r   N)r   sympy.external.gmpyr   sympy.polys.domains.groundtypesr   r   r   &sympy.polys.domains.characteristiczeror   sympy.polys.domains.fieldr    sympy.polys.domains.simpledomainr	   sympy.polys.polyerrorsr
   sympy.utilitiesr   r   r   r   r   r   <module>r      sM    6 $ M M E + 9 1 "w#E-| w# w#r _r   