§
    OŠtj÷  ã                   ón   — d Z ddl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 )	z6Implementation of :class:`PythonRationalField` class. é    )ÚPythonIntegerÚPythonRationalÚSymPyRational)ÚRationalField)ÚCoercionFailed)Úpublicc                   óˆ   — e Zd ZdZeZ ed¦  «        Z e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 )ÚPythonRationalFieldz£Rational field based on :ref:`MPQ`.

    This will be used as :ref:`QQ` if ``gmpy`` and ``gmpy2`` are not
    installed. Elements are instances of :ref:`MPQ`.
    r   é   Ú	QQ_pythonc                 ó   — d S )N© )Úselfs    úe/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/sympy/polys/domains/pythonrationalfield.pyÚ__init__zPythonRationalField.__init__   s   € Øˆó    c                 ó"   — ddl m}  |¦   «         S )z'Returns ring associated with ``self``. r   )ÚPythonIntegerRing)Úsympy.polys.domainsr   )r   r   s     r   Úget_ringzPythonRationalField.get_ring   s#   € à9Ð9Ð9Ð9Ð9Ð9Ø Ð Ñ"Ô"Ð"r   c                 ó6   — t          |j        |j        ¦  «        S )zConvert `a` to a SymPy object. )r   Ú	numeratorÚdenominator©r   Úas     r   Úto_sympyzPythonRationalField.to_sympy   s   € å˜Qœ[¨!¬-Ñ8Ô8Ð8r   c                 ó  — |j         rt          |j        |j        ¦  «        S |j        rHddlm} |                     |¦  «        \  }}t          t          |¦  «        t          |¦  «        ¦  «        S t          d|z  ¦  «        ‚)z%Convert SymPy's Rational to `dtype`. r   )ÚRRz"expected `Rational` object, got %s)
Úis_Rationalr   ÚpÚqÚis_Floatr   r   Úto_rationalÚintr   )r   r   r   r    r!   s        r   Ú
from_sympyzPythonRationalField.from_sympy"   sƒ   € àŒ=ð 	KÝ! !¤# q¤sÑ+Ô+Ð+ØŒZð 	KØ.Ð.Ð.Ð.Ð.Ð.Ø—>’> !Ñ$Ô$‰DˆAˆqÝ!¥# a¡&¤&­#¨a©&¬&Ñ1Ô1Ð1å Ð!EÈÑ!IÑJÔJÐJr   c                 ó    — t          |¦  «        S )z*Convert a Python `int` object to `dtype`. )r   ©ÚK1r   ÚK0s      r   Úfrom_ZZ_pythonz"PythonRationalField.from_ZZ_python-   s   € å˜aÑ Ô Ð r   c                 ó   — |S )z/Convert a Python `Fraction` object to `dtype`. r   r'   s      r   Úfrom_QQ_pythonz"PythonRationalField.from_QQ_python1   s   € àˆr   c                 ó:   — t          t          |¦  «        ¦  «        S )z(Convert a GMPY `mpz` object to `dtype`. )r   r   r'   s      r   Úfrom_ZZ_gmpyz PythonRationalField.from_ZZ_gmpy5   s   € å�m¨AÑ.Ô.Ñ/Ô/Ð/r   c                 óž   — t          t          |                     ¦   «         ¦  «        t          |                     ¦   «         ¦  «        ¦  «        S )z(Convert a GMPY `mpq` object to `dtype`. )r   r   ÚnumerÚdenomr'   s      r   Úfrom_QQ_gmpyz PythonRationalField.from_QQ_gmpy9   s9   € å�m¨A¯GªG©I¬IÑ6Ô6Ý+¨A¯GªG©I¬IÑ6Ô6ñ8ô 8ð 	8r   c                 ó†   — |                      |¦  «        \  }}t          t          |¦  «        t          |¦  «        ¦  «        S )z*Convert a mpmath `mpf` object to `dtype`. )r#   r   r$   )r(   r   r)   r    r!   s        r   Úfrom_RealFieldz"PythonRationalField.from_RealField>   s3   € à�~Š~˜aÑ Ô ‰ˆˆ1Ý�c !™fœf¥c¨!¡f¤fÑ-Ô-Ð-r   c                 ó   — |j         S )zReturns numerator of `a`. )r   r   s     r   r0   zPythonRationalField.numerC   s
   € àŒ{Ðr   c                 ó   — |j         S )zReturns denominator of `a`. )r   r   s     r   r1   zPythonRationalField.denomG   s
   € àŒ}Ðr   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   ÚdtypeÚzeroÚoneÚaliasr   r   r   r%   r*   r,   r.   r2   r4   r0   r1   r   r   r   r
   r
   	   sì   € € € € € ðð ð €EØˆ5�‰8Œ8€DØ
ˆ%�‰(Œ(€CØ€Eðð ð ð#ð #ð #ð
9ð 9ð 9ð	Kð 	Kð 	Kð!ð !ð !ðð ð ð0ð 0ð 0ð8ð 8ð 8ð
.ð .ð .ð
ð ð ðð ð ð ð r   r
   N)r:   Úsympy.polys.domains.groundtypesr   r   r   Ú!sympy.polys.domains.rationalfieldr   Úsympy.polys.polyerrorsr   Úsympy.utilitiesr   r
   r   r   r   ú<module>rC      s    ðØ <Ð <ð YÐ XÐ XÐ XÐ XÐ XÐ XÐ XÐ XÐ XØ ;Ð ;Ð ;Ð ;Ð ;Ð ;Ø 1Ð 1Ð 1Ð 1Ð 1Ð 1Ø "Ð "Ð "Ð "Ð "Ð "àð?ð ?ð ?ð ?ð ?˜-ñ ?ô ?ñ „ð?ð ?ð ?r   