§
    OŠtjj  ã                   óv   — d Z ddlmZmZmZmZmZ ddlm	Z	 ddl
mZ ddlmZ e G d„ de	¦  «        ¦   «         ZdS )	z4Implementation of :class:`GMPYRationalField` class. é    )ÚGMPYRationalÚSymPyRationalÚ
gmpy_numerÚ
gmpy_denomÚ	factorial)ÚRationalField)ÚCoercionFailed)Úpublicc                   óÂ   — e Zd ZdZeZ ed¦  «        Z ed¦  «        Z ee¦  «        Z	dZ
d„ Zd„ Zd„ Zd„ Zd	„ Zd
„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ ZdS )ÚGMPYRationalFieldzµRational field based on GMPY's ``mpq`` type.

    This will be the implementation of :ref:`QQ` if ``gmpy`` or ``gmpy2`` is
    installed. Elements will be of type ``gmpy.mpq``.
    r   é   ÚQQ_gmpyc                 ó   — d S )N© )Úselfs    úc/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/sympy/polys/domains/gmpyrationalfield.pyÚ__init__zGMPYRationalField.__init__   s   € Øˆó    c                 ó"   — ddl m}  |¦   «         S )z'Returns ring associated with ``self``. r   )ÚGMPYIntegerRing)Úsympy.polys.domainsr   )r   r   s     r   Úget_ringzGMPYRationalField.get_ring   s"   € à7Ð7Ð7Ð7Ð7Ð7ØˆÑ Ô Ð r   c                 óŠ   — t          t          t          |¦  «        ¦  «        t          t          |¦  «        ¦  «        ¦  «        S )z!Convert ``a`` to a SymPy object. )r   Úintr   r   ©r   Úas     r   Úto_sympyzGMPYRationalField.to_sympy"   s5   € å�S¥¨A¡¤Ñ/Ô/Ý ¥¨A¡¤Ñ/Ô/ñ1ô 1ð 	1r   c                 óà   — |j         rt          |j        |j        ¦  «        S |j        r5ddlm} t          t          t          | 	                    |¦  «        ¦  «        Ž S t          d|z  ¦  «        ‚)z&Convert SymPy's Integer to ``dtype``. r   )ÚRRz$expected ``Rational`` object, got %s)Úis_Rationalr   ÚpÚqÚis_Floatr   r   Úmapr   Úto_rationalr	   )r   r   r   s      r   Ú
from_sympyzGMPYRationalField.from_sympy'   ss   € àŒ=ð 	MÝ ¤ Q¤SÑ)Ô)Ð)ØŒZð 	MØ.Ð.Ð.Ð.Ð.Ð.Ý¥¥S¨"¯.ª.¸Ñ*;Ô*;Ñ!<Ô!<Ð=Ð=å Ð!GÈ!Ñ!KÑLÔLÐLr   c                 ó    — t          |¦  «        S )z.Convert a Python ``int`` object to ``dtype``. ©r   ©ÚK1r   ÚK0s      r   Úfrom_ZZ_pythonz GMPYRationalField.from_ZZ_python1   ó   € å˜A‰ŒÐr   c                 ó6   — t          |j        |j        ¦  «        S )z3Convert a Python ``Fraction`` object to ``dtype``. )r   Ú	numeratorÚdenominatorr)   s      r   Úfrom_QQ_pythonz GMPYRationalField.from_QQ_python5   s   € å˜AœK¨¬Ñ7Ô7Ð7r   c                 ó    — t          |¦  «        S )z,Convert a GMPY ``mpz`` object to ``dtype``. r(   r)   s      r   Úfrom_ZZ_gmpyzGMPYRationalField.from_ZZ_gmpy9   r-   r   c                 ó   — |S )z,Convert a GMPY ``mpq`` object to ``dtype``. r   r)   s      r   Úfrom_QQ_gmpyzGMPYRationalField.from_QQ_gmpy=   s   € àˆr   c                 óD   — |j         dk    rt          |j        ¦  «        S dS )z3Convert a ``GaussianElement`` object to ``dtype``. r   N)Úyr   Úxr)   s      r   Úfrom_GaussianRationalFieldz,GMPYRationalField.from_GaussianRationalFieldA   s$   € àŒ3�!Š8ˆ8Ý ¤Ñ$Ô$Ð$ð ˆ8r   c                 ó`   — t          t          t          |                     |¦  «        ¦  «        Ž S )z.Convert a mpmath ``mpf`` object to ``dtype``. )r   r$   r   r%   r)   s      r   Úfrom_RealFieldz GMPYRationalField.from_RealFieldF   s#   € å�S¥ b§n¢n°QÑ&7Ô&7Ñ8Ô8Ð9Ð9r   c                 ó@   — t          |¦  «        t          |¦  «        z  S )z=Exact quotient of ``a`` and ``b``, implies ``__truediv__``.  r(   ©r   r   Úbs      r   ÚexquozGMPYRationalField.exquoJ   ó   € å˜A‰Œ¥¨a¡¤Ñ0Ð0r   c                 ó@   — t          |¦  «        t          |¦  «        z  S )z6Quotient of ``a`` and ``b``, implies ``__truediv__``. r(   r=   s      r   ÚquozGMPYRationalField.quoN   r@   r   c                 ó   — | j         S )z0Remainder of ``a`` and ``b``, implies nothing.  )Úzeror=   s      r   ÚremzGMPYRationalField.remR   s
   € àŒyÐr   c                 óN   — t          |¦  «        t          |¦  «        z  | j        fS )z6Division of ``a`` and ``b``, implies ``__truediv__``. )r   rD   r=   s      r   ÚdivzGMPYRationalField.divV   s    € å˜A‰Œ¥¨a¡¤Ñ0°$´)Ð;Ð;r   c                 ó   — |j         S )zReturns numerator of ``a``. )r/   r   s     r   ÚnumerzGMPYRationalField.numerZ   s
   € àŒ{Ðr   c                 ó   — |j         S )zReturns denominator of ``a``. )r0   r   s     r   ÚdenomzGMPYRationalField.denom^   s
   € àŒ}Ðr   c                 óT   — t          t          t          |¦  «        ¦  «        ¦  «        S )zReturns factorial of ``a``. )r   Úgmpy_factorialr   r   s     r   r   zGMPYRationalField.factorialb   s   € å�N­3¨q©6¬6Ñ2Ô2Ñ3Ô3Ð3r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   ÚdtyperD   ÚoneÚtypeÚtpÚaliasr   r   r   r&   r,   r1   r3   r5   r9   r;   r?   rB   rE   rG   rI   rK   r   r   r   r   r   r      sS  € € € € € ðð ð €EØˆ5�‰8Œ8€DØ
ˆ%�‰(Œ(€CØ	ˆˆc‰Œ€BØ€Eðð ð ð!ð !ð !ð
1ð 1ð 1ð
Mð Mð Mðð ð ð8ð 8ð 8ðð ð ðð ð ð%ð %ð %ð
:ð :ð :ð1ð 1ð 1ð1ð 1ð 1ðð ð ð<ð <ð <ðð ð ðð ð ð4ð 4ð 4ð 4ð 4r   r   N)rQ   Úsympy.polys.domains.groundtypesr   r   r   r   r   rM   Ú!sympy.polys.domains.rationalfieldr   Úsympy.polys.polyerrorsr	   Úsympy.utilitiesr
   r   r   r   r   ú<module>r[      sÑ   ðØ :Ð :ðð ð ð ð ð ð ð ð ð ð ð ð ð ð <Ð ;Ð ;Ð ;Ð ;Ð ;Ø 1Ð 1Ð 1Ð 1Ð 1Ð 1Ø "Ð "Ð "Ð "Ð "Ð "àðW4ð W4ð W4ð W4ð W4˜ñ W4ô W4ñ „ðW4ð W4ð W4r   