+
    ‹°³j®-  ã                   óÆ   € R t ^ RIHt ^ RIHt ^ RIHt ^ RIHtH	t	H
t
 ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ R	IHt ^ R
IHt ^ RIHtHtHt R tR tRR ltR tR tR t R# )zAThis module implements tools for integrating rational functions. )ÚLambda)ÚI)ÚS)ÚDummyÚSymbolÚsymbols)Úlog)Úatan)ÚDomainError)Úroots)Úcancel)ÚRootSum)ÚPolyÚ	resultantÚZZc                ó  € \        V \        4      '       d   V w  r4MV P                  4       w  r4\        W1RRR7      \        WARRR7      rCVP	                  V4      w  rSpVP                  V4      w  rcVP                  V4      P                  4       pVP                  '       d	   WW,          # \        W4V4      w  r‰V	P                  4       w  r«\        W¡4      p
\        W±4      pV
P                  V4      w  rLWxVP                  V4      P                  4       ,           ,          pVP                  '       EgÐ   VP                  RR4      p\        V\        4      '       g   \        V4      pMVP                  4       p\        WËW4      pVP                  R4      pVfz   \        V \        4      '       d+   V w  r4VP                  4       VP                  4       ,          pMV P                  4       pVV0,
           F  pVP                   '       d   K  Rp M	  Rp\"        P$                  pV'       g\   V FT  w  r”V	P'                  4       w  pp	V\)        V\+        Wî\-        V	P                  4       4      ,          4      RR7      ,          pKV  	  MuV Fo  w  r”V	P'                  4       w  pp	\/        W”W4      pVe   VV,          pK3  V\)        V\+        Wî\-        V	P                  4       4      ,          4      RR7      ,          pKq  	  VV,          pWW,          # )a	  
Performs indefinite integration of rational functions.

Explanation
===========

Given a field :math:`K` and a rational function :math:`f = p/q`,
where :math:`p` and :math:`q` are polynomials in :math:`K[x]`,
returns a function :math:`g` such that :math:`f = g'`.

Examples
========

>>> from sympy.integrals.rationaltools import ratint
>>> from sympy.abc import x

>>> ratint(36/(x**5 - 2*x**4 - 2*x**3 + 4*x**2 + x - 2), x)
(12*x + 6)/(x**2 - 1) + 4*log(x - 2) - 4*log(x + 1)

References
==========

.. [1] M. Bronstein, Symbolic Integration I: Transcendental
   Functions, Second Edition, Springer-Verlag, 2005, pp. 35-70

See Also
========

sympy.integrals.integrals.Integral.doit
sympy.integrals.rationaltools.ratint_logpart
sympy.integrals.rationaltools.ratint_ratpart

FT)Ú	compositeÚfieldÚsymbolÚtÚreal)Ú	quadratic)Ú
isinstanceÚtupleÚas_numer_denomr   r   ÚdivÚ	integrateÚas_exprÚis_zeroÚratint_ratpartÚgetr   r   Úas_dummyÚratint_logpartÚatomsÚis_extended_realr   ÚZeroÚ	primitiver   r   r   Úlog_to_real)ÚfÚxÚflagsÚpÚqÚcoeffÚpolyÚresultÚgÚhÚPÚQÚrr   r   ÚLr   r#   ÚeltÚepsÚ_ÚRs   &&,                   Ú^/home/luca/screen-checking/.venv/lib/python3.14/site-packages/sympy/integrals/rationaltools.pyÚratintr;      su  € ôD �!”U×ÒØ‰ˆˆ1à×ÑÓ!‰ˆä� ¨TÔ2´D¸ÈÐVZÔ4[€qà—(‘(˜1“+�K€EˆaØ�e‰e�A‹h�G€Dà�^‰^˜AÓ×&Ñ&Ó(€Fà‡y‡y€yØ�|Ðä˜! Ó"�D€Aà×ÑÓ�D€AäˆQ‹
€AÜˆQ‹
€Aà�5‰5�‹8�D€Aà
�!—+‘+˜a“.×(Ñ(Ó*Õ*Õ*€Fà�9�9‰9Ø—‘˜8 SÓ)ˆä˜&¤&×)Ò)Ü�f“‰Aà—‘Ó!ˆAä˜1 Ó&ˆà�y‰y˜Ó ˆàŠ<Ü˜!œU×#Ò#Ø‘�ØŸ™›	 A§G¡G£IÕ-‘àŸ™›	�à ˜s—{�{�Ø×+×+Ò+Ø �DÙñ #ð
 �ä�f‰fˆçÛ‘�Ø—{‘{“}‘��1Ø”wØ”v˜a¤3 q§y¡y£{Ó#3Õ!3Ó4ÀôFõ F’ò ó
 ‘�Ø—{‘{“}‘��1Ü  aÓ+�à’=Ø˜1•H’Càœ7Øœ6 !¤s¨1¯9©9«;Ó'7Õ%7Ó8ÀDôJõ J’Cñ ð 	�#�ˆà�<Ðó    c           
     ó  € ^ RI Hp \        W4      p \        W4      pVP                  VP	                  4       4      w  rEpVP                  4       pVP                  4       p\        ^ V4       U	u. uF$  p	\        R\        Wy,
          4      ,           4      NK&  	  p
p	\        ^ V4       U	u. uF$  p	\        R\        W‰,
          4      ,           4      NK&  	  pp	W«,           p\        W¢\        V,          R7      p\        W²\        V,          R7      pWP	                  4       V,          ,
          WÔP	                  4       V,          P                  V4      ,          ,           Wä,          ,
          pV! VP                  4       V4      pVP                  4       P                  V4      pVP                  4       P                  V4      p\        WÔP                  4       ,          V4      p\        WåP                  4       ,          V4      pVV3# u up	i u up	i )aK  
Horowitz-Ostrogradsky algorithm.

Explanation
===========

Given a field K and polynomials f and g in K[x], such that f and g
are coprime and deg(f) < deg(g), returns fractions A and B in K(x),
such that f/g = A' + B and B has square-free denominator.

Examples
========

    >>> from sympy.integrals.rationaltools import ratint_ratpart
    >>> from sympy.abc import x, y
    >>> from sympy import Poly
    >>> ratint_ratpart(Poly(1, x, domain='ZZ'),
    ... Poly(x + 1, x, domain='ZZ'), x)
    (0, 1/(x + 1))
    >>> ratint_ratpart(Poly(1, x, domain='EX'),
    ... Poly(x**2 + y**2, x, domain='EX'), x)
    (0, 1/(x**2 + y**2))
    >>> ratint_ratpart(Poly(36, x, domain='ZZ'),
    ... Poly(x**5 - 2*x**4 - 2*x**3 + 4*x**2 + x - 2, x, domain='ZZ'), x)
    ((12*x + 6)/(x**2 - 1), 12/(x**2 - x - 2))

See Also
========

ratint, ratint_logpart
)ÚsolveÚaÚb)Údomain)Úsympy.solvers.solversr>   r   Ú	cofactorsÚdiffÚdegreeÚranger   Ústrr   ÚquoÚcoeffsr   Úsubsr   )r(   r0   r)   r>   ÚuÚvr8   ÚnÚmÚiÚA_coeffsÚB_coeffsÚC_coeffsÚAÚBÚHr/   Úrat_partÚlog_parts   &&&                r:   r   r   }   ss  € õ@ ,äˆQ‹
€AÜˆQ‹
€Aà�k‰k˜!Ÿ&™&›(Ó#�G€Aˆ!à	�‰‹
€AØ	�‰‹
€Aä27¸¸1´+Ó?±+¨Q”�sœS ¥›ZÕ'Ö(±+€HÐ?Ü27¸¸1´+Ó?±+¨Q”�sœS ¥›ZÕ'Ö(±+€HÐ?àÕ"€HäˆX¤ H¥Ô.€AÜˆX¤ H¥Ô.€Aà	�F‰F‹H�Q�J�˜ŸF™F›H Q�J×+Ñ+¨AÓ.Õ.Õ.°µÕ4€Aá�1—8‘8“:˜xÓ(€Fà	�	‰	‹×Ñ˜Ó €AØ	�	‰	‹×Ñ˜Ó €Aä�aŸ	™	›•m QÓ'€HÜ�aŸ	™	›•m QÓ'€Hà�XÐÐùò% @ùÚ?s   Á-*G?Â'*HNc                óÌ  € \        W4      \        W4      rT;'       g    \        R4      pYVP                  4       \        W24      ,          ,
          rT\        WERR7      w  rg\        WcRR7      pV'       g   Q RV: RV: R24       h/ . r˜V F  p
W¨V
P	                  4       &   K  	  R	 pVP                  4       w  rÍV! WÍ4       V EFœ  w  rïVP                  4       w  ppVP	                  4       V8X  d   V	P                  W34       KB  W�,          p\        VP                  4       VRR
7      pVP                  RR7      w  ppV! VV4       V F7  w  ppVP                  \        VP                  V4      V,          V4      4      pK9  	  VP                  V4      \        P                  .ppVP                  4       R,           FU  pVP                  VP                   4      pVV,          P#                  V4      pVP                  VP%                  4       4       KW  	  \        \'        \)        \+        VP-                  4       V4      4      4      V4      pV	P                  VV34       EKŸ  	  V	# )aú  
Lazard-Rioboo-Trager algorithm.

Explanation
===========

Given a field K and polynomials f and g in K[x], such that f and g
are coprime, deg(f) < deg(g) and g is square-free, returns a list
of tuples (s_i, q_i) of polynomials, for i = 1..n, such that s_i
in K[t, x] and q_i in K[t], and::

                       ___    ___
             d  f   d  \  `   \  `
             -- - = --  )      )   a log(s_i(a, x))
             dx g   dx /__,   /__,
                      i=1..n a | q_i(a) = 0

Examples
========

>>> from sympy.integrals.rationaltools import ratint_logpart
>>> from sympy.abc import x
>>> from sympy import Poly
>>> ratint_logpart(Poly(1, x, domain='ZZ'),
... Poly(x**2 + x + 1, x, domain='ZZ'), x)
[(Poly(x + 3*_t/2 + 1/2, x, domain='QQ[_t]'),
...Poly(3*_t**2 + 1, _t, domain='ZZ'))]
>>> ratint_logpart(Poly(12, x, domain='ZZ'),
... Poly(x**2 - x - 2, x, domain='ZZ'), x)
[(Poly(x - 3*_t/8 - 1/2, x, domain='QQ[_t]'),
...Poly(-_t**2 + 16, _t, domain='ZZ'))]

See Also
========

ratint, ratint_ratpart
r   T)Ú
includePRSF)r   zBUG: resultant(z, z) cannot be zeroc                 ó¬   € V P                   '       dB   V ^ 8  R8X  d6   V^ ,          w  r#V P                  VP                  4      pW$,          V3V^ &   R# R# R# )é    TN)r$   Úas_polyÚgens)ÚcÚsqfr1   ÚkÚc_polys   &&   r:   Ú_include_signÚ%ratint_logpart.<locals>._include_signñ   sL   € Ø××Ð 1 q¡5¨T¤/Ø�q•6‰DˆAØ—Y‘Y˜qŸv™vÓ&ˆFØ•X˜q�[ˆC�‹Fñ #2Ñr<   )r   )Úall:é   NN)r   r   rD   r   rE   Úsqf_listr&   ÚappendÚLCrH   ÚgcdÚinvertr   ÚOnerI   r\   r]   Úremr   ÚdictÚlistÚzipÚmonoms)r(   r0   r)   r   r?   r@   Úresr9   ÚR_maprU   r4   rb   ÚCÚres_sqfr,   rO   r8   r1   Úh_lcr^   Úh_lc_sqfÚjÚinvrI   r-   ÚTs   &&&&                      r:   r"   r"   ¼   sâ  € ôL �‹:”t˜A“z€qà	�ˆŒU�3‹Z€AØ�!—&‘&“(œ4 ›:Õ%Õ%€qä�q¨Ô-�F€CÜ
ˆs Ô
'€CçÑ@»1»aÐ@Ó@ˆ3à�2ˆ1ãˆØˆa�h‰h‹jÓñ ò!ð —‘“�J€AÙ�!Ôä‰ˆØ�{‰{‹}‰ˆˆ1à�8‰8‹:˜Œ?Ø�H‰H�a�VÖà•ˆAÜ˜Ÿ™› ¨Ô.ˆDàŸ-™-¨D˜-Ó1‰KˆAˆxÙ˜!˜XÔ&ã ‘��1Ø—E‘Eœ$˜qŸu™u Q›x¨�{¨AÓ.Ó/’ñ !ð Ÿ+™+ a›.¬1¯5©5¨'�ˆCàŸ™› BŸ˜�ØŸ™ c§h¡hÓ/�Ø˜•Y—O‘O AÓ&�Ø—‘˜aŸi™i›kÖ*ñ (ô
 ”Tœ$œs 1§8¡8£:¨vÓ6Ó7Ó8¸!Ó<ˆAà�H‰H�a˜�V×ñ1 ð4 €Hr<   c                óð  € V P                  4       VP                  4       8  d   V) T rV P                  4       p VP                  4       pV P                  V4      w  r#VP                  '       d!   ^\	        VP                  4       4      ,          # VP                  V ) 4      w  rEpW,          W,          ,           P                  V4      p^\	        VP                  4       4      ,          pV\        WE4      ,           # )aØ  
Convert complex logarithms to real arctangents.

Explanation
===========

Given a real field K and polynomials f and g in K[x], with g != 0,
returns a sum h of arctangents of polynomials in K[x], such that:

               dh   d         f + I g
               -- = -- I log( ------- )
               dx   dx        f - I g

Examples
========

    >>> from sympy.integrals.rationaltools import log_to_atan
    >>> from sympy.abc import x
    >>> from sympy import Poly, sqrt, S
    >>> log_to_atan(Poly(x, x, domain='ZZ'), Poly(1, x, domain='ZZ'))
    2*atan(x)
    >>> log_to_atan(Poly(x + S(1)/2, x, domain='QQ'),
    ... Poly(sqrt(3)/2, x, domain='EX'))
    2*atan(2*sqrt(3)*x/3 + sqrt(3)/3)

See Also
========

log_to_real
)	rE   Úto_fieldr   r   r	   r   ÚgcdexrH   Úlog_to_atan)	r(   r0   r+   r,   Úsr   r1   rK   rS   s	   &&       r:   r}   r}     s³   € ð> 	‡x�xƒz�A—H‘H“JÔØˆr�1ˆ1à	�
‰
‹€AØ	�
‰
‹€Aà�5‰5�‹8�D€Aà‡y‡y€yØ”�a—i‘i“kÓ"Õ"Ð"à—'‘'˜1˜"“+‰ˆˆaØ�S�1•3�Y�O‰O˜AÓˆØŒd�1—9‘9“;ÓÕˆà”;˜qÓ$Õ$Ð$r<   c                óŒ   € \        V RR7      p V P                  4       p\        V4      V8X  d   V# R#   \         d    Tu # i ; i)zget real roots of f if possibler9   )ÚfilterN)r   Úcount_rootsÚlenr
   )r(   r)   ÚrsÚ	num_rootss   &&  r:   Ú_get_real_rootsr…   H  sJ   € ä	ˆq˜Ô	€BðØ—M‘M“Oˆ	ô ˆr‹7�iÔØˆIáøô ô ØŠ	ðús   �3 ³AÁAc           
     ót  € ^ RI Hp \        R\        R7      w  rVV P	                  4       P                  W5\        V,          ,           /4      P                  4       pVP	                  4       P                  W5\        V,          ,           /4      P                  4       pV! V\        RR7      p	V! V\        RR7      p
V	P                  \        P                  \        P                  4      V	P                  \        \        P                  4      rËV
P                  \        P                  \        P                  4      V
P                  \        \        P                  4      rí\        \        WÞV4      V4      p\        Wõ4      pVf   R# \        P                  pVP                  4        EF³  p\        VP                  VV/4      V4      pV'       g.   \        VP                  VV/4      V4      p\        P                  p\        VV4      pVf    R# . pV Fw  pVV9  g   K  V) V9  g   K  VP                   '       g   VP#                  4       '       d   VP%                  V) 4       KR  VP&                  '       d   Kf  VP%                  V4       Ky  	  V FÅ  pVP                  VVVV/4      pVP)                  RR7      ^ 8w  d   K1  \        VP                  VVVV/4      V4      p\        VP                  VVVV/4      V4      pV^,          V^,          ,           P	                  4       pVV\+        V4      ,          V\-        VV4      ,          ,           ,          pKÇ  	  EK¶  	  \        W4      pVf   R# VP                  4        F:  pVV\+        V P	                  4       P/                  VV4      4      ,          ,          pK<  	  V# )	a  
Convert complex logarithms to real functions.

Explanation
===========

Given real field K and polynomials h in K[t,x] and q in K[t],
returns real function f such that:
                      ___
              df   d  \  `
              -- = --  )  a log(h(a, x))
              dx   dx /__,
                     a | q(a) = 0

Examples
========

    >>> from sympy.integrals.rationaltools import log_to_real
    >>> from sympy.abc import x, y
    >>> from sympy import Poly, S
    >>> log_to_real(Poly(x + 3*y/2 + S(1)/2, x, domain='QQ[y]'),
    ... Poly(3*y**2 + 1, y, domain='ZZ'), x, y)
    2*sqrt(3)*atan(2*sqrt(3)*x/3 + sqrt(3)/3)/3
    >>> log_to_real(Poly(x**2 - 1, x, domain='ZZ'),
    ... Poly(-2*y + 1, y, domain='ZZ'), x, y)
    log(x**2 - 1)/2

See Also
========

log_to_atan
)Úcollectzu,v)ÚclsF)ÚevaluateNT)Úchop)Úsympy.simplify.radsimpr‡   r   r   r   Úxreplacer   Úexpandr    r   rk   r%   r   r   r…   ÚkeysÚis_negativeÚcould_extract_minus_signrg   r   Úevalfr   r}   rJ   )r1   r,   r)   r   r‡   rK   rL   rU   r3   ÚH_mapÚQ_mapr?   r@   r^   Údr9   ÚR_ur/   Úr_urs   ÚR_vÚ
R_v_pairedÚr_vÚDrS   rT   ÚABÚR_qr4   s   &&&&                         r:   r'   r'   W  sÍ  € õB /Ü�5œeÔ$�D€Aà	�	‰	‹×Ñ˜a¤Q q¥S¥˜\Ó*×1Ñ1Ó3€AØ	�	‰	‹×Ñ˜a¤Q q¥S¥˜\Ó*×1Ñ1Ó3€Aá�A”q 5Ô)€EÙ�A”q 5Ô)€Eà�9‰9”Q—U‘UœAŸF™FÓ# U§Y¡Y¬q´!·&±&Ó%9€qØ�9‰9”Q—U‘UœAŸF™FÓ# U§Y¡Y¬q´!·&±&Ó%9€qäŒY�q˜QÓ Ó#€Aä
˜!Ó
€Cà
‚{Ùä�V‰V€Fà�x‰x�zˆÜ�—‘˜Q ˜HÓ% qÓ)ˆßô �Q—Z‘Z  C Ó)¨1Ó-ˆAô
 —‘ˆAä˜a Ó#ˆàŠ;Úàˆ
ÛˆCØ˜*Ö$¨#¨°ZÖ)?Ø—?—?�? c×&BÑ&B×&DÒ&DØ×%Ñ% s dÖ+ØŸŸšØ×%Ñ% cÖ*ñ ó ˆCà—
‘
˜A˜s A sÐ+Ó,ˆAà�w‰w˜DˆwÓ! QÔ&Ùä�Q—Z‘Z  C¨¨CÐ 0Ó1°1Ó5ˆAÜ�Q—Z‘Z  C¨¨CÐ 0Ó1°1Ó5ˆAà�Q•$˜˜A�•+×&Ñ&Ó(ˆBà�cœ#˜b›'•k C¬°A°qÓ(9Õ$9Õ9Õ9ŠFô ñ5 ôP ˜!Ó
€Cà
‚{Ùà�X‰XŽZˆØ�!”C˜Ÿ	™	›×(Ñ(¨¨AÓ.Ó/Õ/Õ/Šñ ð €Mr<   )N)!Ú__doc__Úsympy.core.functionr   Úsympy.core.numbersr   Úsympy.core.singletonr   Úsympy.core.symbolr   r   r   Ú&sympy.functions.elementary.exponentialr   Ú(sympy.functions.elementary.trigonometricr	   Úsympy.polys.polyerrorsr
   Úsympy.polys.polyrootsr   Úsympy.polys.polytoolsr   Úsympy.polys.rootoftoolsr   Úsympy.polysr   r   r   r;   r   r"   r}   r…   r'   © r<   r:   Ú<module>rª      sT   ðÙ Gå &Ý  Ý "ß 6Ñ 6Ý 6Ý 9Ý .Ý 'Ý (Ý +ß +Ñ +òjòZ<ô~Xòv.%òbôfr<   