K i PdZddlmZddlmZmZddlmZeGddeZy)z(Implementation of :class:`Field` class. )Ring) NotReversible DomainError)publiccZeZdZdZdZdZdZdZdZdZ dZ dZ d Z d Z d Zd Zd Zy)FieldzRepresents a field domain. Tctd|z)z)Returns a ring associated with ``self``. z#there is no ring associated with %s)rselfs _/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/sympy/polys/domains/field.pyget_ringzField.get_rings?$FGGc|S)z*Returns a field associated with ``self``. r s r get_fieldzField.get_fields rc ||z S)z=Exact quotient of ``a`` and ``b``, implies ``__truediv__``. rr abs r exquoz Field.exquo 1u rc ||z S)z6Quotient of ``a`` and ``b``, implies ``__truediv__``. rrs r quoz Field.quorrc|jS)z0Remainder of ``a`` and ``b``, implies nothing. zerors r remz Field.rems yyrc$||z |jfS)z6Division of ``a`` and ``b``, implies ``__truediv__``. rrs r divz Field.div#s1udiircD |j}|j|j ||j |}|j |j ||j |}|j|||z S#t$r|jcYSwxYw)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 ronegcdnumerlcmdenomconvertr rrringpqs r r"z Field.gcd's, ==?D HHTZZ]DJJqM 2 HHTZZ]DJJqM 2||At$Q&&  88O sBBBc|j||}||jk(rD||jk(r#|j|j|jfS|j||z |fS||z |j|fS)zK Returns x, y, g such that a * x + b * y == g == gcd(a, b) )r"rr!)r rrds r gcdexz Field.gcdexGsl HHQN  >DII~yy$((DII55yy!A#q((Q3 1$ $rc6 |j}|j|j||j|}|j |j ||j |}|j |||z S#t$r||zcYSwxYw)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 rr$r#r"r%r&r's r r$z Field.lcmUs ==?D HHTZZ]DJJqM 2 HHTZZ]DJJqM 2||At$Q&&  Q3J sBBBc&|rd|z Std)z!Returns ``a**(-1)`` if possible. zzero is not reversible)rr rs r revertz Field.revertms Q3J 89 9rct|S)z$Return true if ``a`` is a invertible)boolr1s r is_unitz Field.is_unitts AwrN)__name__ __module__ __qualname____doc__is_Fieldis_PIDr rrrrrr"r-r$r2r5rrr rrsH%H FH '@ %'0:rrN) r9sympy.polys.domains.ringrsympy.polys.polyerrorsrrsympy.utilitiesrrrrr r?s/.*="mDmmr