Ë
    7^(hO  ã                   ó^   — d Z ddlmZ ddlmZ ddlmZmZ ddlm	Z	 e	 G d„ dee«      «       Z
y)	z1Implementation of :class:`PolynomialRing` class. é    )ÚRing)ÚCompositeDomain)ÚCoercionFailedÚGeneratorsError)Úpublicc                   ó  — e Zd ZdZdxZZdZdZd(d„Zd„ Z	d„ Z
ed„ «       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„ 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,y))ÚPolynomialRingz8A class for representing multivariate polynomial rings. TNc                 óª  — ddl m} t        ||«      r|€|€|}n
 ||||«      }|| _        |j                  | _        |j
                  | _        |j                  | _        |j                  | _        |j                  | _        |rA|j                  j                  r+|j                  j                  rt        |«      dk(  rd| _        | j                  | _        y )Nr   )ÚPolyRingé   T)Úsympy.polys.ringsr   Ú
isinstanceÚringÚdtypeÚgensÚngensÚsymbolsÚdomainÚis_FieldÚis_ExactÚlenÚis_PIDÚdom)ÚselfÚdomain_or_ringr   Úorderr   r   s         ú`/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/sympy/polys/domains/polynomialring.pyÚ__init__zPolynomialRing.__init__   s¤   € Ý.ä�n hÔ/°G°OÈÈØ!‰Dá˜G ^°UÓ;ˆDàˆŒ	Ø—Z‘ZˆŒ
à—I‘IˆŒ	Ø—Z‘ZˆŒ
Ø—|‘|ˆŒØ—k‘kˆŒñ Ø�{‰{×#Ò#¨¯©×(<Ò(<ÄÀWÃÈqÂØ"�”ð —;‘;ˆ�ó    c                 ó8   — | j                   j                  |«      S ©N)r   Úring_new©r   Úelements     r   ÚnewzPolynomialRing.new+   s   € Ø�y‰y×!Ñ! 'Ó*Ð*r   c                 ó8   — | j                   j                  |«      S )z%Check if ``a`` is of type ``dtype``. )r   Ú
is_elementr#   s     r   Úof_typezPolynomialRing.of_type.   s   € à�y‰y×#Ñ# GÓ,Ð,r   c                 ó.   — | j                   j                  S r!   )r   Úzero©r   s    r   r*   zPolynomialRing.zero2   s   € à�y‰y�~‰~Ðr   c                 ó.   — | j                   j                  S r!   )r   Úoner+   s    r   r-   zPolynomialRing.one6   s   € à�y‰y�}‰}Ðr   c                 ó.   — | j                   j                  S r!   )r   r   r+   s    r   r   zPolynomialRing.order:   s   € à�y‰y�‰Ðr   c                 óŒ   — t        | j                  «      dz   dj                  t        t         | j                  «      «      z   dz   S )Nú[ú,ú])Ústrr   ÚjoinÚmapr   r+   s    r   Ú__str__zPolynomialRing.__str__>   s4   € Ü�4—;‘;Ó #Ñ%¨¯©´´S¸$¿,¹,Ó1GÓ(HÑHÈ3ÑNÐNr   c                 ó„   — t        | j                  j                  | j                  | j                  | j
                  f«      S r!   )ÚhashÚ	__class__Ú__name__r   r   r   r+   s    r   Ú__hash__zPolynomialRing.__hash__A   s,   € Ü�T—^‘^×,Ñ,¨d¯i©i¸¿¹ÀdÇlÁlÐSÓTÐTr   c                 ó`   — t        |t        «      st        S | j                  |j                  k(  S )z.Returns `True` if two domains are equivalent. )r   r	   ÚNotImplementedr   )r   Úothers     r   Ú__eq__zPolynomialRing.__eq__D   s%   € ä˜%¤Ô0Ü!Ð!Ø�y‰y˜EŸJ™JÑ&Ð&r   c                 óv   — |j                   sy| j                  }|j                  |j                  || «      «      S )z/Returns ``True`` if ``a`` is a unit of ``self``F)Ú	is_groundr   Úis_unitÚconvert_from)r   ÚaÚKs      r   rB   zPolynomialRing.is_unitJ   s/   € à�{Š{ØØ�K‰KˆØ�y‰y˜Ÿ™¨¨4Ó0Ó1Ð1r   c                 ó‚   — | j                   j                  |j                  «      }| j                  j	                  |«      S r!   )r   Úcanonical_unitÚLCr   Ú
ground_new)r   rD   Úus      r   rG   zPolynomialRing.canonical_unitQ   s/   € Ø�K‰K×&Ñ& q§t¡tÓ,ˆØ�y‰y×#Ñ# AÓ&Ð&r   c                 ó"   — |j                  «       S )zConvert `a` to a SymPy object. )Úas_expr©r   rD   s     r   Úto_sympyzPolynomialRing.to_sympyU   s   € à�y‰y‹{Ðr   c                 ó8   — | j                   j                  |«      S )z'Convert SymPy's expression to `dtype`. )r   Ú	from_exprrM   s     r   Ú
from_sympyzPolynomialRing.from_sympyY   s   € à�y‰y×"Ñ" 1Ó%Ð%r   c                 óF   —  | | j                   j                  ||«      «      S ©z*Convert a Python `int` object to `dtype`. ©r   Úconvert©ÚK1rD   ÚK0s      r   Úfrom_ZZzPolynomialRing.from_ZZ]   ó   € á�"—)‘)×#Ñ# A rÓ*Ó+Ð+r   c                 óF   —  | | j                   j                  ||«      «      S rS   rT   rV   s      r   Úfrom_ZZ_pythonzPolynomialRing.from_ZZ_pythona   rZ   r   c                 óF   —  | | j                   j                  ||«      «      S ©z/Convert a Python `Fraction` object to `dtype`. rT   rV   s      r   Úfrom_QQzPolynomialRing.from_QQe   rZ   r   c                 óF   —  | | j                   j                  ||«      «      S r^   rT   rV   s      r   Úfrom_QQ_pythonzPolynomialRing.from_QQ_pythoni   rZ   r   c                 óF   —  | | j                   j                  ||«      «      S )z(Convert a GMPY `mpz` object to `dtype`. rT   rV   s      r   Úfrom_ZZ_gmpyzPolynomialRing.from_ZZ_gmpym   rZ   r   c                 óF   —  | | j                   j                  ||«      «      S )z(Convert a GMPY `mpq` object to `dtype`. rT   rV   s      r   Úfrom_QQ_gmpyzPolynomialRing.from_QQ_gmpyq   rZ   r   c                 óF   —  | | j                   j                  ||«      «      S )z/Convert a `GaussianInteger` object to `dtype`. rT   rV   s      r   Úfrom_GaussianIntegerRingz'PolynomialRing.from_GaussianIntegerRingu   rZ   r   c                 óF   —  | | j                   j                  ||«      «      S )z0Convert a `GaussianRational` object to `dtype`. rT   rV   s      r   Úfrom_GaussianRationalFieldz)PolynomialRing.from_GaussianRationalFieldy   rZ   r   c                 óF   —  | | j                   j                  ||«      «      S ©z*Convert a mpmath `mpf` object to `dtype`. rT   rV   s      r   Úfrom_RealFieldzPolynomialRing.from_RealField}   rZ   r   c                 óF   —  | | j                   j                  ||«      «      S rk   rT   rV   s      r   Úfrom_ComplexFieldz PolynomialRing.from_ComplexField�   rZ   r   c                 ó€   — | j                   |k7  r| j                   j                  ||«      }|�| j                  |«      S y)z*Convert an algebraic number to ``dtype``. N)r   rC   r%   rV   s      r   Úfrom_AlgebraicFieldz"PolynomialRing.from_AlgebraicField…   s;   € à�9‰9˜Š?Ø—	‘	×&Ñ& q¨"Ó-ˆAØˆ=Ø—6‘6˜!“9Ðð r   c                 ód   — 	 |j                  | j                  «      S # t        t        f$ r Y yw xY w)z#Convert a polynomial to ``dtype``. N)Úset_ringr   r   r   rV   s      r   Úfrom_PolynomialRingz"PolynomialRing.from_PolynomialRingŒ   s1   € ð	Ø—:‘:˜bŸg™gÓ&Ð&øÜ¤Ð0ò 	Ùð	ús   ‚ �/®/c                 ó>  — | j                   |k(  r| j                  j                  |g«      S |j                  |«      j	                  |j                  |«      «      \  }}|j                  r4| j                  ||j                  j                  j                  «       «      S y)z*Convert a rational function to ``dtype``. N)
r   r   Ú	from_listÚnumerÚdivÚdenomÚis_zerors   ÚfieldÚ	to_domain)rW   rD   rX   ÚqÚrs        r   Úfrom_FractionFieldz!PolynomialRing.from_FractionField“   st   € à�9‰9˜Š?Ø—7‘7×$Ñ$ a SÓ)Ð)à�x‰x˜‹{�‰˜rŸx™x¨›{Ó+‰ˆˆ1à�9Š9Ø×)Ñ)¨!¨R¯X©X¯]©]×-DÑ-DÓ-FÓGÐGàr   c                 ó®  — | j                   |j                  k(  rm|j                  «       }| j                  |j                  k7  r<|j	                  «       D ��ci c]!  \  }}|| j                  j                  |«      “Œ# }}} | |«      S |j                  r=|j                  | k(  r-| j                  |j                  «       d   |j                  «      S yyc c}}w )z)Convert from old poly ring to ``dtype``. r   N)	r   r   Úto_dictr   ÚitemsrU   rA   rC   Úto_list)rW   rD   rX   ÚadÚmÚcs         r   Úfrom_GlobalPolynomialRingz(PolynomialRing.from_GlobalPolynomialRingŸ   s¤   € à�:‰:˜Ÿ™Ò Ø—‘“ˆBØ�y‰y˜BŸI™IÒ%Ø:<¿(¹(»*×E±$°!°Q�a˜Ÿ™×*Ñ*¨1Ó-Ñ-ÐE�ÑEÙ�b“6ˆMØ�[Š[˜RŸY™Y¨"š_Ø—?‘? 1§9¡9£;¨q¡>°2·9±9Ó=Ð=ð -ˆ[ùó Fs   Á&Cc                 óR   — | j                   j                  «       j                  «       S )z(Returns a field associated with `self`. )r   Úto_fieldr{   r+   s    r   Ú	get_fieldzPolynomialRing.get_field©   s   € à�y‰y×!Ñ!Ó#×-Ñ-Ó/Ð/r   c                 óL   — | j                   j                  |j                  «      S )z%Returns True if `LC(a)` is positive. )r   Úis_positiverH   rM   s     r   r‹   zPolynomialRing.is_positive­   ó   € à�{‰{×&Ñ& q§t¡tÓ,Ð,r   c                 óL   — | j                   j                  |j                  «      S )z%Returns True if `LC(a)` is negative. )r   Úis_negativerH   rM   s     r   rŽ   zPolynomialRing.is_negative±   rŒ   r   c                 óL   — | j                   j                  |j                  «      S )z)Returns True if `LC(a)` is non-positive. )r   Úis_nonpositiverH   rM   s     r   r�   zPolynomialRing.is_nonpositiveµ   ó   € à�{‰{×)Ñ)¨!¯$©$Ó/Ð/r   c                 óL   — | j                   j                  |j                  «      S )z)Returns True if `LC(a)` is non-negative. )r   Úis_nonnegativerH   rM   s     r   r“   zPolynomialRing.is_nonnegative¹   r‘   r   c                 ó$   — |j                  |«      S )zExtended GCD of `a` and `b`. )Úgcdex©r   rD   Úbs      r   r•   zPolynomialRing.gcdex½   s   € à�w‰w�q‹zÐr   c                 ó$   — |j                  |«      S )zReturns GCD of `a` and `b`. )Úgcdr–   s      r   r™   zPolynomialRing.gcdÁ   ó   € à�u‰u�Q‹xˆr   c                 ó$   — |j                  |«      S )zReturns LCM of `a` and `b`. )Úlcmr–   s      r   rœ   zPolynomialRing.lcmÅ   rš   r   c                 óV   — | j                  | j                  j                  |«      «      S )zReturns factorial of `a`. )r   r   Ú	factorialrM   s     r   rž   zPolynomialRing.factorialÉ   s    € à�z‰z˜$Ÿ+™+×/Ñ/°Ó2Ó3Ð3r   )NN)-r:   Ú
__module__Ú__qualname__Ú__doc__Úis_PolynomialRingÚis_PolyÚhas_assoc_RingÚhas_assoc_Fieldr   r%   r(   Úpropertyr*   r-   r   r6   r;   r?   rB   rG   rN   rQ   rY   r\   r_   ra   rc   re   rg   ri   rl   rn   rp   rs   r~   r†   r‰   r‹   rŽ   r�   r“   r•   r™   rœ   rž   © r   r   r	   r	   
   sý   „ áBà"&Ð&Ð˜à€NØ€Oóò0+ò-ð ñó ðð ñó ðð ñó ðòOòUò'ò2ò'òò&ò,ò,ò,ò,ò,ò,ò,ò,ò,ò,òòò
ò>ò0ò-ò-ò0ò0òòòó4r   r	   N)r¡   Úsympy.polys.domains.ringr   Ú#sympy.polys.domains.compositedomainr   Úsympy.polys.polyerrorsr   r   Úsympy.utilitiesr   r	   r§   r   r   ú<module>r¬      s4   ðÙ 7õ *Ý ?ç BÝ "àô@4�T˜?ó @4ó ñ@4r   