§
    OŠtj�  ã                   ó^   — d Z ddlmZ ddlmZmZ ddlmZ e G d„ de¦  «        ¦   «         ZdS )z(Implementation of :class:`Field` class. é    )ÚRing)ÚNotReversibleÚDomainError)Úpublicc                   ó\   — 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S )ÚFieldzRepresents a field domain. Tc                 ó&   — t          d| z  ¦  «        ‚)z)Returns a ring associated with ``self``. z#there is no ring associated with %s)r   ©Úselfs    úW/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/sympy/polys/domains/field.pyÚget_ringzField.get_ring   s   € åÐ?À$ÑFÑGÔGÐGó    c                 ó   — | S )z*Returns a field associated with ``self``. © r
   s    r   Ú	get_fieldzField.get_field   s   € àˆr   c                 ó   — ||z  S )z=Exact quotient of ``a`` and ``b``, implies ``__truediv__``.  r   ©r   ÚaÚbs      r   ÚexquozField.exquo   ó   € à�1‰uˆr   c                 ó   — ||z  S )z6Quotient of ``a`` and ``b``, implies ``__truediv__``. r   r   s      r   Úquoz	Field.quo   r   r   c                 ó   — | j         S )z0Remainder of ``a`` and ``b``, implies nothing.  ©Úzeror   s      r   Úremz	Field.rem   s
   € àŒyÐr   c                 ó   — ||z  | j         fS )z6Division of ``a`` and ``b``, implies ``__truediv__``. r   r   s      r   Údivz	Field.div#   s   € à�1‰u�d”iÐÐr   c                 ó~  — 	 |                       ¦   «         }n# t          $ r
 | j        cY S w xY w|                     |                      |¦  «        |                      |¦  «        ¦  «        }|                     |                      |¦  «        |                      |¦  «        ¦  «        }|                      ||¦  «        |z  S )aÙ  
        Returns GCD of ``a`` and ``b``.

        This definition of GCD over fields allows to clear denominators
        in `primitive()`.

        Examples
        ========

        >>> from sympy.polys.domains import QQ
        >>> from sympy import S, gcd, primitive
        >>> from sympy.abc import x

        >>> QQ.gcd(QQ(2, 3), QQ(4, 9))
        2/9
        >>> gcd(S(2)/3, S(4)/9)
        2/9
        >>> primitive(2*x/3 + S(4)/9)
        (2/9, 3*x + 2)

        )r   r   ÚoneÚgcdÚnumerÚlcmÚdenomÚconvert©r   r   r   ÚringÚpÚqs         r   r"   z	Field.gcd'   s¥   € ð,	Ø—=’=‘?”?ˆDˆDøÝð 	ð 	ð 	Ø”8ˆOˆOˆOð	øøøð �HŠH�T—Z’Z ‘]”] D§J¢J¨q¡M¤MÑ2Ô2ˆØ�HŠH�T—Z’Z ‘]”] D§J¢J¨q¡M¤MÑ2Ô2ˆà�|Š|˜A˜tÑ$Ô$ QÑ&Ð&s   ‚ —+ª+c                 ó¶   — |                       ||¦  «        }|| j        k    r,|| j        k    r| j        | j        | j        fS | j        ||z  |fS ||z  | j        |fS )zK
        Returns x, y, g such that a * x + b * y == g == gcd(a, b)
        )r"   r   r!   )r   r   r   Úds       r   ÚgcdexzField.gcdexG   sd   € ð �HŠH�Q˜‰NŒNˆà�”	Š>ˆ>Ø�D”IŠ~ˆ~Ø”y $¤(¨D¬IÐ5Ð5à”y ! A¡# qÐ(Ð(à�Q‘3˜œ	 1Ð$Ð$r   c                 óz  — 	 |                       ¦   «         }n# t          $ r ||z  cY S w xY w|                     |                      |¦  «        |                      |¦  «        ¦  «        }|                     |                      |¦  «        |                      |¦  «        ¦  «        }|                      ||¦  «        |z  S )zç
        Returns LCM of ``a`` and ``b``.

        >>> from sympy.polys.domains import QQ
        >>> from sympy import S, lcm

        >>> QQ.lcm(QQ(2, 3), QQ(4, 9))
        4/3
        >>> lcm(S(2)/3, S(4)/9)
        4/3

        )r   r   r$   r#   r"   r%   r&   r'   s         r   r$   z	Field.lcmU   s§   € ð	Ø—=’=‘?”?ˆDˆDøÝð 	ð 	ð 	Ø�Q‘3ˆJˆJˆJð	øøøð �HŠH�T—Z’Z ‘]”] D§J¢J¨q¡M¤MÑ2Ô2ˆØ�HŠH�T—Z’Z ‘]”] D§J¢J¨q¡M¤MÑ2Ô2ˆà�|Š|˜A˜tÑ$Ô$ QÑ&Ð&s   ‚ —)¨)c                 ó.   — |rd|z  S t          d¦  «        ‚)z!Returns ``a**(-1)`` if possible. é   zzero is not reversible)r   ©r   r   s     r   ÚrevertzField.revertm   s"   € àð 	:Ø�Q‘3ˆJåÐ 8Ñ9Ô9Ð9r   c                 ó    — t          |¦  «        S )z$Return true if ``a`` is a invertible)Úboolr1   s     r   Úis_unitzField.is_unitt   s   € å�A‰wŒwˆr   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úis_FieldÚis_PIDr   r   r   r   r   r   r"   r-   r$   r2   r5   r   r   r   r   r      sÍ   € € € € € à%Ð%à€HØ€FðHð Hð Hðð ð ðð ð ðð ð ðð ð ð ð  ð  ð'ð 'ð 'ð@%ð %ð %ð'ð 'ð 'ð0:ð :ð :ðð ð ð ð r   r   N)	r9   Úsympy.polys.domains.ringr   Úsympy.polys.polyerrorsr   r   Úsympy.utilitiesr   r   r   r   r   ú<module>r?      s‘   ðØ .Ð .ð *Ð )Ð )Ð )Ð )Ð )Ø =Ð =Ð =Ð =Ð =Ð =Ð =Ð =Ø "Ð "Ð "Ð "Ð "Ð "àðmð mð mð mð mˆDñ mô mñ „ðmð mð mr   