Ë
    7^(h�  ã                   óP   — 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y)z(Implementation of :class:`Field` class. é    )ÚRing)ÚNotReversibleÚDomainError)Úpublicc                   óZ   — 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y)Ú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/skyplay_api_hub/venv/lib/python3.12/site-packages/sympy/polys/domains/field.pyÚget_ringzField.get_ring   s   € äÐ?À$ÑFÓ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‰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‘iÐÐr   c                 óD  — 	 | j                  «       }|j                  | j	                  |«      | j	                  |«      «      }|j                  | j                  |«      | j                  |«      «      }| j                  ||«      |z  S # t        $ r | j                  cY S w xY w)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ð �H‰H�T—Z‘Z “] D§J¡J¨q£MÓ2ˆØ�H‰H�T—Z‘Z “] D§J¡J¨q£MÓ2ˆà�|‰|˜A˜tÓ$ QÑ&Ð&øô ò 	Ø—8‘8ŠOð	ús   ‚B ÂBÂBc                 óð   — | j                  ||«      }|| j                  k(  rD|| 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   sl   € ð �H‰H�Q˜‹Nˆà�—	‘	Š>Ø�D—I‘IŠ~Ø—y‘y $§(¡(¨D¯I©IÐ5Ð5à—y‘y ! A¡# qÐ(Ð(à�Q‘3˜Ÿ	™	 1Ð$Ð$r   c                 ó6  — 	 | j                  «       }|j                  | j                  |«      | j                  |«      «      }|j	                  | j                  |«      | j                  |«      «      }| j                  ||«      |z  S # t        $ r ||z  cY S w xY w)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ð �H‰H�T—Z‘Z “] D§J¡J¨q£MÓ2ˆØ�H‰H�T—Z‘Z “] D§J¡J¨q£MÓ2ˆà�|‰|˜A˜tÓ$ QÑ&Ð&øô ò 	Ø�Q‘3ŠJð	ús   ‚B ÂBÂB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Ð9r   c                 ó   — t        |«      S )z$Return true if ``a`` is a invertible)Úboolr1   s     r   Úis_unitzField.is_unitt   s   € ä�A‹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      sH   „ á%à€HØ€FòHòòòòò ò'ò@%ò'ò0:ór   r   N)	r9   Úsympy.polys.domains.ringr   Úsympy.polys.polyerrorsr   r   Úsympy.utilitiesr   r   r   r   r   ú<module>r?      s/   ðÙ .õ *ß =Ý "àômˆDó mó ñmr   