+
    .åûj^  ã                   ó˜   € 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   &Ú]C:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\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   € ä�D‹zÐ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 §¡Ó-¬s°1·=±=Ó/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   € à�=�=ˆ=Ü�q—s‘s˜AŸC™C“=Ð Ø�Z�ZˆZÝ.Üœœ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-   € ð
 �;�;ˆ;Ø—:‘:˜aŸd™d›f b§f¡fÓ-Ð-ñ r   c                ó   € \        V4      # ©z.Convert a Python ``int`` object to ``dtype``. r   rC   s   &&&r   Úfrom_ZZÚRationalField.from_ZZt   ó   € ä�1‹vˆ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   € à�3‰3�!Œ8Ü�q—s‘s“8ˆOñ 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•   ó   € ä�1‹vœ˜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   € à�y‰yÐ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   € ä�1‹vœ˜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      # )z«Return ``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¬)°A·M±MÓ*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Ù�‹8€DÙ
�‹(€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   