ó
    Š*£hO  ã                   ó^   • S r SSKJr  SSKJr  SSKJrJr  SSKJ	r	  \	 " S S\\5      5       r
g)	z1Implementation of :class:`PolynomialRing` class. é    )ÚRing)ÚCompositeDomain)ÚCoercionFailedÚGeneratorsError)Úpublicc                   ó"  • \ rS rSrSrS=rrSrSrS*S jr	S r
S r\S 5       r\S	 5       r\S
 5       rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS r S r!S r"S r#S r$S  r%S! r&S" r'S# r(S$ r)S% r*S& r+S' r,S( r-S)r.g)+ÚPolynomialRingé
   z8A class for representing multivariate polynomial rings. TNc                 óÒ  • SSK Jn  [        X5      (       a	  Uc  Uc  UnO	U" X!U5      nXPl        UR                  U l        UR
                  U l        UR                  U l        UR                  U l        UR                  U l        U(       aL  UR                  R                  (       a1  UR                  R                  (       a  [        U5      S:X  a  SU l        U R                  U l        g )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         Ú_/home/mande/repo/quber/.venv/lib/python3.13/site-packages/sympy/polys/domains/polynomialring.pyÚ__init__ÚPolynomialRing.__init__   s¡   € Ý.ä�n×/Ñ/°G±OÈÉØ!‰Dá˜G°UÓ;ˆDàŒ	Ø—Z‘ZˆŒ
à—I‘IˆŒ	Ø—Z‘ZˆŒ
Ø—|‘|ˆŒØ—k‘kˆŒö Ø�{‰{×#×#¨¯©×(<×(<ÄÀWÃÈqÃØ"�”ð —;‘;ˆ�ó    c                 ó8   • U R                   R                  U5      $ ©N)r   Úring_new©r   Úelements     r   ÚnewÚPolynomialRing.new+   s   € Ø�y‰y×!Ñ! 'Ó*Ð*r!   c                 ó8   • U R                   R                  U5      $ )z%Check if ``a`` is of type ``dtype``. )r   Ú
is_elementr%   s     r   Úof_typeÚPolynomialRing.of_type.   s   € à�y‰y×#Ñ# GÓ,Ð,r!   c                 ó.   • U R                   R                  $ r#   )r   Úzero©r   s    r   r.   ÚPolynomialRing.zero2   s   € à�y‰y�~‰~Ðr!   c                 ó.   • U R                   R                  $ r#   )r   Úoner/   s    r   r2   ÚPolynomialRing.one6   s   € à�y‰y�}‰}Ðr!   c                 ó.   • U R                   R                  $ r#   )r   r   r/   s    r   r   ÚPolynomialRing.order:   s   € à�y‰y�‰Ðr!   c                 óŒ   • [        U R                  5      S-   SR                  [        [         U R                  5      5      -   S-   $ )NÚ[Ú,Ú])Ústrr   ÚjoinÚmapr   r/   s    r   Ú__str__ÚPolynomialRing.__str__>   s4   € Ü�4—;‘;Ó #Ñ%¨¯©´´S¸$¿,¹,Ó1GÓ(HÑHÈ3ÑNÐNr!   c                 ó„   • [        U R                  R                  U R                  U R                  U R
                  45      $ r#   )ÚhashÚ	__class__Ú__name__r   r   r   r/   s    r   Ú__hash__ÚPolynomialRing.__hash__A   s,   € Ü�T—^‘^×,Ñ,¨d¯i©i¸¿¹ÀdÇlÁlÐSÓTÐTr!   c                 ój   • [        U[        5      (       d  [        $ U R                  UR                  :H  $ )z.Returns `True` if two domains are equivalent. )r   r	   ÚNotImplementedr   )r   Úothers     r   Ú__eq__ÚPolynomialRing.__eq__D   s(   € ä˜%¤×0Ñ0Ü!Ð!Ø�y‰y˜EŸJ™JÑ&Ð&r!   c                 ó~   • UR                   (       d  gU R                  nUR                  UR                  X5      5      $ )z/Returns ``True`` if ``a`` is a unit of ``self``F)Ú	is_groundr   Úis_unitÚconvert_from)r   ÚaÚKs      r   rL   ÚPolynomialRing.is_unitJ   s-   € à�{�{ØØ�K‰KˆØ�y‰y˜Ÿ™¨Ó0Ó1Ð1r!   c                 ó‚   • U R                   R                  UR                  5      nU R                  R	                  U5      $ r#   )r   Úcanonical_unitÚLCr   Ú
ground_new)r   rN   Úus      r   rR   ÚPolynomialRing.canonical_unitQ   s/   € Ø�K‰K×&Ñ& q§t¡tÓ,ˆØ�y‰y×#Ñ# AÓ&Ð&r!   c                 ó"   • UR                  5       $ )zConvert `a` to a SymPy object. )Úas_expr©r   rN   s     r   Úto_sympyÚPolynomialRing.to_sympyU   s   € à�y‰y‹{Ðr!   c                 ó8   • U R                   R                  U5      $ )z'Convert SymPy's expression to `dtype`. )r   Ú	from_exprrY   s     r   Ú
from_sympyÚPolynomialRing.from_sympyY   s   € à�y‰y×"Ñ" 1Ó%Ð%r!   c                 óD   • U " U R                   R                  X5      5      $ ©z*Convert a Python `int` object to `dtype`. ©r   Úconvert©ÚK1rN   ÚK0s      r   Úfrom_ZZÚPolynomialRing.from_ZZ]   ó   € á�"—)‘)×#Ñ# AÓ*Ó+Ð+r!   c                 óD   • U " U R                   R                  X5      5      $ ra   rb   rd   s      r   Úfrom_ZZ_pythonÚPolynomialRing.from_ZZ_pythona   ri   r!   c                 óD   • U " U R                   R                  X5      5      $ ©z/Convert a Python `Fraction` object to `dtype`. rb   rd   s      r   Úfrom_QQÚPolynomialRing.from_QQe   ri   r!   c                 óD   • U " U R                   R                  X5      5      $ rn   rb   rd   s      r   Úfrom_QQ_pythonÚPolynomialRing.from_QQ_pythoni   ri   r!   c                 óD   • U " U R                   R                  X5      5      $ )z(Convert a GMPY `mpz` object to `dtype`. rb   rd   s      r   Úfrom_ZZ_gmpyÚPolynomialRing.from_ZZ_gmpym   ri   r!   c                 óD   • U " U R                   R                  X5      5      $ )z(Convert a GMPY `mpq` object to `dtype`. rb   rd   s      r   Úfrom_QQ_gmpyÚPolynomialRing.from_QQ_gmpyq   ri   r!   c                 óD   • U " U R                   R                  X5      5      $ )z/Convert a `GaussianInteger` object to `dtype`. rb   rd   s      r   Úfrom_GaussianIntegerRingÚ'PolynomialRing.from_GaussianIntegerRingu   ri   r!   c                 óD   • U " U R                   R                  X5      5      $ )z0Convert a `GaussianRational` object to `dtype`. rb   rd   s      r   Úfrom_GaussianRationalFieldÚ)PolynomialRing.from_GaussianRationalFieldy   ri   r!   c                 óD   • U " U R                   R                  X5      5      $ ©z*Convert a mpmath `mpf` object to `dtype`. rb   rd   s      r   Úfrom_RealFieldÚPolynomialRing.from_RealField}   ri   r!   c                 óD   • U " U R                   R                  X5      5      $ r�   rb   rd   s      r   Úfrom_ComplexFieldÚ PolynomialRing.from_ComplexField�   ri   r!   c                 ó‚   • U R                   U:w  a  U R                   R                  X5      nUb  U R                  U5      $ g)z*Convert an algebraic number to ``dtype``. N)r   rM   r'   rd   s      r   Úfrom_AlgebraicFieldÚ"PolynomialRing.from_AlgebraicField…   s9   € à�9‰9˜‹?Ø—	‘	×&Ñ& qÓ-ˆAØ‰=Ø—6‘6˜!“9Ðð r!   c                 óf   •  UR                  U R                  5      $ ! [        [        4 a     gf = f)z#Convert a polynomial to ``dtype``. N)Úset_ringr   r   r   rd   s      r   Úfrom_PolynomialRingÚ"PolynomialRing.from_PolynomialRingŒ   s1   € ð	Ø—:‘:˜bŸg™gÓ&Ð&øÜ¤Ð0ó 	Ùð	ús   ‚ �0¯0c                 óF  • U R                   U:X  a  U R                  R                  U/5      $ UR                  U5      R	                  UR                  U5      5      u  p4UR                  (       a3  U R                  X2R                  R                  R                  5       5      $ g)z*Convert a rational function to ``dtype``. N)
r   r   Ú	from_listÚnumerÚdivÚdenomÚis_zerorŒ   ÚfieldÚ	to_domain)re   rN   rf   ÚqÚrs        r   Úfrom_FractionFieldÚ!PolynomialRing.from_FractionField“   sp   € à�9‰9˜‹?Ø—7‘7×$Ñ$ a SÓ)Ð)à�x‰x˜‹{�‰˜rŸx™x¨›{Ó+‰ˆà�9�9Ø×)Ñ)¨!¯X©X¯]©]×-DÑ-DÓ-FÓGÐGàr!   c                 óÀ  • U R                   UR                  :X  ao  UR                  5       nU R                  UR                  :w  a=  UR	                  5        VVs0 s H   u  pEX@R                  R                  U5      _M"     nnnU " U5      $ UR                  (       a>  UR                  U :X  a-  U R                  UR                  5       S   UR                  5      $ ggs  snnf )z)Convert from old poly ring to ``dtype``. r   N)	r   r   Úto_dictr   Úitemsrc   rK   rM   Úto_list)re   rN   rf   ÚadÚmÚcs         r   Úfrom_GlobalPolynomialRingÚ(PolynomialRing.from_GlobalPolynomialRingŸ   s¡   € à�:‰:˜Ÿ™Ó Ø—‘“ˆBØ�y‰y˜BŸI™IÓ%Ø:<¿(¹(¼*ÔEº*±$°!�aŸ™×*Ñ*¨1Ó-Ò-¹*�ÑEÙ�b“6ˆMØ�[�[˜RŸY™Y¨"›_Ø—?‘? 1§9¡9£;¨q¡>°2·9±9Ó=Ð=ð -ˆ[ùó Fs   Á'Cc                 óR   • U R                   R                  5       R                  5       $ )z(Returns a field associated with `self`. )r   Úto_fieldr•   r/   s    r   Ú	get_fieldÚPolynomialRing.get_field©   s   € à�y‰y×!Ñ!Ó#×-Ñ-Ó/Ð/r!   c                 óL   • U R                   R                  UR                  5      $ )z%Returns True if `LC(a)` is positive. )r   Úis_positiverS   rY   s     r   r¨   ÚPolynomialRing.is_positive­   ó   € à�{‰{×&Ñ& q§t¡tÓ,Ð,r!   c                 óL   • U R                   R                  UR                  5      $ )z%Returns True if `LC(a)` is negative. )r   Úis_negativerS   rY   s     r   r¬   ÚPolynomialRing.is_negative±   rª   r!   c                 óL   • U R                   R                  UR                  5      $ )z)Returns True if `LC(a)` is non-positive. )r   Úis_nonpositiverS   rY   s     r   r¯   ÚPolynomialRing.is_nonpositiveµ   ó   € à�{‰{×)Ñ)¨!¯$©$Ó/Ð/r!   c                 óL   • U R                   R                  UR                  5      $ )z)Returns True if `LC(a)` is non-negative. )r   Úis_nonnegativerS   rY   s     r   r³   ÚPolynomialRing.is_nonnegative¹   r±   r!   c                 ó$   • UR                  U5      $ )zExtended GCD of `a` and `b`. )Úgcdex©r   rN   Úbs      r   r¶   ÚPolynomialRing.gcdex½   s   € à�w‰w�q‹zÐr!   c                 ó$   • UR                  U5      $ )zReturns GCD of `a` and `b`. )Úgcdr·   s      r   r»   ÚPolynomialRing.gcdÁ   ó   € à�u‰u�Q‹xˆr!   c                 ó$   • UR                  U5      $ )zReturns LCM of `a` and `b`. )Úlcmr·   s      r   r¿   ÚPolynomialRing.lcmÅ   r½   r!   c                 óV   • U R                  U R                  R                  U5      5      $ )zReturns factorial of `a`. )r   r   Ú	factorialrY   s     r   rÂ   ÚPolynomialRing.factorialÉ   s    € à�z‰z˜$Ÿ+™+×/Ñ/°Ó2Ó3Ð3r!   )r   r   r   r   r   r   r   r   )NN)/rB   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Úis_PolynomialRingÚis_PolyÚhas_assoc_RingÚhas_assoc_Fieldr   r'   r+   Úpropertyr.   r2   r   r=   rC   rH   rL   rR   rZ   r^   rg   rk   ro   rr   ru   rx   r{   r~   r‚   r…   rˆ   rŒ   r˜   r¡   r¥   r¨   r¬   r¯   r³   r¶   r»   r¿   rÂ   Ú__static_attributes__© 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!   