§
    OŠtj¤  ã                   ób   — d Z ddlmZ ddlmZmZmZ ddlmZ e G d„ de¦  «        ¦   «         Z	dS )z'Implementation of :class:`Ring` class. é    )ÚDomain)ÚExactQuotientFailedÚNotInvertibleÚNotReversible)Úpublicc                   ój   — 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„ Zd„ ZdS )ÚRingzRepresents a ring domain. Tc                 ó   — | S )z)Returns a ring associated with ``self``. © )Úselfs    úV/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/sympy/polys/domains/ring.pyÚget_ringzRing.get_ring   s   € àˆó    c                 ó8   — ||z  rt          ||| ¦  «        ‚||z  S )z>Exact quotient of ``a`` and ``b``, implies ``__floordiv__``.  )r   ©r   ÚaÚbs      r   Úexquoz
Ring.exquo   s)   € àˆq‰5ð 	Ý% a¨¨DÑ1Ô1Ð1à˜‘6ˆMr   c                 ó   — ||z  S )z7Quotient of ``a`` and ``b``, implies ``__floordiv__``. r   r   s      r   ÚquozRing.quo   s   € à�A‰vˆr   c                 ó   — ||z  S )z4Remainder of ``a`` and ``b``, implies ``__mod__``.  r   r   s      r   ÚremzRing.rem   s   € à�1‰uˆr   c                 ó"   — t          ||¦  «        S )z5Division of ``a`` and ``b``, implies ``__divmod__``. )Údivmodr   s      r   ÚdivzRing.div"   s   € å�a˜‰|Œ|Ðr   c                 óˆ   — |                       ||¦  «        \  }}}|                      |¦  «        r||z  S t          d¦  «        ‚)z"Returns inversion of ``a mod b``. zzero divisor)ÚgcdexÚis_oner   )r   r   r   ÚsÚtÚhs         r   ÚinvertzRing.invert&   sD   € à—*’*˜Q Ñ"Ô"‰ˆˆ1ˆaà�;Š;�q‰>Œ>ð 	0Ø�q‘5ˆLå Ñ/Ô/Ð/r   c                 óz   — |                       |¦  «        s|                       | ¦  «        r|S t          d¦  «        ‚)z!Returns ``a**(-1)`` if possible. z#only units are reversible in a ring)r   r   ©r   r   s     r   ÚrevertzRing.revert/   s=   € à�;Š;�q‰>Œ>ð 	G˜TŸ[š[¨!¨™_œ_ð 	GØˆHåÐ EÑFÔFÐFr   c                 óT   — 	 |                       |¦  «         dS # t          $ r Y dS w xY w)NTF)r%   r   r$   s     r   Úis_unitzRing.is_unit6   s=   € ð	Ø�KŠK˜‰NŒNˆNØ�4øÝð 	ð 	ð 	Ø�5�5ð	øøøs   ‚ ™
'¦'c                 ó   — |S )zReturns numerator of ``a``. r   r$   s     r   Únumerz
Ring.numer=   s   € àˆr   c                 ó   — | j         S )zReturns denominator of `a`. )Úoner$   s     r   Údenomz
Ring.denomA   s	   € àŒxˆr   c                 ó   — t           ‚)zÊ
        Generate a free module of rank ``rank`` over self.

        >>> from sympy.abc import x
        >>> from sympy import QQ
        >>> QQ.old_poly_ring(x).free_module(2)
        QQ[x]**2
        )ÚNotImplementedError)r   Úranks     r   Úfree_modulezRing.free_moduleE   s
   € õ "Ð!r   c                 óp   — ddl m}  ||  |                      d¦  «        j        d„ |D ¦   «         Ž ¦  «        S )z±
        Generate an ideal of ``self``.

        >>> from sympy.abc import x
        >>> from sympy import QQ
        >>> QQ.old_poly_ring(x).ideal(x**2)
        <x**2>
        r   )ÚModuleImplementedIdealé   c                 ó   — g | ]}|g‘ŒS r   r   )Ú.0Úxs     r   ú
<listcomp>zRing.ideal.<locals>.<listcomp>[   s   € Ð Ð Ð �aˆqˆcÐ Ð Ð r   )Úsympy.polys.agca.idealsr2   r0   Ú	submodule)r   Úgensr2   s      r   Úidealz
Ring.idealP   sZ   € ð 	CÐBÐBÐBÐBÐBØ%Ð% dÐ,I¨D×,<Ò,<¸QÑ,?Ô,?Ô,IØ Ð ˜4Ð Ñ Ô ð-"ñ #ô #ð 	#r   c                 óf   — ddl m} ddlm} t	          ||¦  «        s
 | j        |Ž } || |¦  «        S )aÖ  
        Form a quotient ring of ``self``.

        Here ``e`` can be an ideal or an iterable.

        >>> from sympy.abc import x
        >>> from sympy import QQ
        >>> QQ.old_poly_ring(x).quotient_ring(QQ.old_poly_ring(x).ideal(x**2))
        QQ[x]/<x**2>
        >>> QQ.old_poly_ring(x).quotient_ring([x**2])
        QQ[x]/<x**2>

        The division operator has been overloaded for this:

        >>> QQ.old_poly_ring(x)/[x**2]
        QQ[x]/<x**2>
        r   )ÚIdeal)ÚQuotientRing)r8   r=   Ú sympy.polys.domains.quotientringr>   Ú
isinstancer;   )r   Úer=   r>   s       r   Úquotient_ringzRing.quotient_ring]   sY   € ð$ 	2Ð1Ð1Ð1Ð1Ð1ØAÐAÐAÐAÐAÐAÝ˜!˜UÑ#Ô#ð 	Ø�”
˜A�ˆAØˆ|˜D !Ñ$Ô$Ð$r   c                 ó,   — |                       |¦  «        S )N)rB   )r   rA   s     r   Ú__truediv__zRing.__truediv__u   s   € Ø×!Ò! !Ñ$Ô$Ð$r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úis_Ringr   r   r   r   r   r"   r%   r'   r)   r,   r0   r;   rB   rD   r   r   r   r	   r	   	   sô   € € € € € à$Ð$à€Gðð ð ðð ð ðð ð ðð ð ðð ð ð0ð 0ð 0ðGð Gð Gðð ð ðð ð ðð ð ð	"ð 	"ð 	"ð#ð #ð #ð%ð %ð %ð0%ð %ð %ð %ð %r   r	   N)
rH   Úsympy.polys.domains.domainr   Úsympy.polys.polyerrorsr   r   r   Úsympy.utilitiesr   r	   r   r   r   ú<module>rM      s—   ðØ -Ð -ð .Ð -Ð -Ð -Ð -Ð -Ø TÐ TÐ TÐ TÐ TÐ TÐ TÐ TÐ TÐ Tà "Ð "Ð "Ð "Ð "Ð "àðl%ð l%ð l%ð l%ð l%ˆ6ñ l%ô l%ñ „ðl%ð l%ð l%r   