+
    åûjé1  ã                   ó¦   € ^ RI Ht ^ RIHtHt ^ RIHtHt ^ RIH	t	H
t
 ^ RIHt ^ RIHt RR lt ! R R	]4      t ! R
 R]4      t ! R R]4      tR# )é    )ÚS)ÚDefinedFunctionÚArgumentIndexError)ÚDummyÚuniquely_named_symbol)ÚgammaÚdigamma)Úcatalan)Ú	conjugatec                 óB   € ^ RI HpHp W#8X  d	   V! ^ 4      # V! WW#V4      # )r   )ÚbetaincÚmpf)Úmpmathr   r   )ÚaÚbÚx1Úx2Úregr   r   s   &&&&&  ÚbC:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\sympy\functions\special\beta_functions.pyÚbetainc_mpmath_fixr   	   s"   € ß#Ø	„xÙ�1‹vˆá�q˜R SÓ)Ð)ó    c                   ój   a € ] tR t^t o RtRtR t]RR l4       tR t	R t
R tR	 tRR
 ltR tRtV tR# )Úbetaaå  
The beta integral is called the Eulerian integral of the first kind by
Legendre:

.. math::
    \mathrm{B}(x,y)  \int^{1}_{0} t^{x-1} (1-t)^{y-1} \mathrm{d}t.

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

The Beta function or Euler's first integral is closely associated
with the gamma function. The Beta function is often used in probability
theory and mathematical statistics. It satisfies properties like:

.. math::
    \mathrm{B}(a,1) = \frac{1}{a} \\
    \mathrm{B}(a,b) = \mathrm{B}(b,a)  \\
    \mathrm{B}(a,b) = \frac{\Gamma(a) \Gamma(b)}{\Gamma(a+b)}

Therefore for integral values of $a$ and $b$:

.. math::
    \mathrm{B} = \frac{(a-1)! (b-1)!}{(a+b-1)!}

A special case of the Beta function when `x = y` is the
Central Beta function. It satisfies properties like:

.. math::
    \mathrm{B}(x) = 2^{1 - 2x}\mathrm{B}(x, \frac{1}{2})
    \mathrm{B}(x) = 2^{1 - 2x} cos(\pi x) \mathrm{B}(\frac{1}{2} - x, x)
    \mathrm{B}(x) = \int_{0}^{1} \frac{t^x}{(1 + t)^{2x}} dt
    \mathrm{B}(x) = \frac{2}{x} \prod_{n = 1}^{\infty} \frac{n(n + 2x)}{(n + x)^2}

Examples
========

>>> from sympy import I, pi
>>> from sympy.abc import x, y

The Beta function obeys the mirror symmetry:

>>> from sympy import beta, conjugate
>>> conjugate(beta(x, y))
beta(conjugate(x), conjugate(y))

Differentiation with respect to both $x$ and $y$ is supported:

>>> from sympy import beta, diff
>>> diff(beta(x, y), x)
(polygamma(0, x) - polygamma(0, x + y))*beta(x, y)

>>> diff(beta(x, y), y)
(polygamma(0, y) - polygamma(0, x + y))*beta(x, y)

>>> diff(beta(x), x)
2*(polygamma(0, x) - polygamma(0, 2*x))*beta(x, x)

We can numerically evaluate the Beta function to
arbitrary precision for any complex numbers x and y:

>>> from sympy import beta
>>> beta(pi).evalf(40)
0.02671848900111377452242355235388489324562

>>> beta(1 + I).evalf(20)
-0.2112723729365330143 - 0.7655283165378005676*I

See Also
========

gamma: Gamma function.
uppergamma: Upper incomplete gamma function.
lowergamma: Lower incomplete gamma function.
polygamma: Polygamma function.
loggamma: Log Gamma function.
digamma: Digamma function.
trigamma: Trigamma function.

References
==========

.. [1] https://en.wikipedia.org/wiki/Beta_function
.. [2] https://mathworld.wolfram.com/BetaFunction.html
.. [3] https://dlmf.nist.gov/5.12

Tc                ó  € V P                   w  r#V^8X  d2   \        W#4      \        V4      \        W#,           4      ,
          ,          # V^8X  d2   \        W#4      \        V4      \        W#,           4      ,
          ,          # \        W4      h©é   )Úargsr   r	   r   )ÚselfÚargindexÚxÚys   &&  r   ÚfdiffÚ
beta.fdiffm   sb   € Ø�y‰y‰ˆØ�qŒ=ä˜“:œw q›z¬G°AµE«NÕ:Õ;Ð;Ø˜Œ]ä˜“:œw q›z¬G°AµE«NÕ:Õ;Ð;ä$ TÓ4Ð4r   Nc                ó¦   € Vf   \        W4      # VP                  '       d0   VP                  '       d   \        WRR7      P                  4       # R # R # )NF)Úevaluate)r   Ú	is_NumberÚdoit)Úclsr    r!   s   &&&r   ÚevalÚ	beta.evalx   s?   € àŠ9Ü˜“:ÐØ�;�;ˆ;˜1Ÿ;Ÿ;˜;Ü˜ uÔ-×2Ñ2Ó4Ð4ñ '‰;r   c                ó^  € V P                   ^ ,          ;r#\        V P                   4      ^8H  pV'       d   V P                   ^ ,          MV P                   ^,          ;rVVP                  RR4      '       d%   VP                  ! R/ VB pVP                  ! R/ VB pVP                  '       g   VP                  '       d   \
        P                  # V\
        P                  J d
   ^V,          # V\
        P                  J d
   ^V,          # WR^,           8X  d    ^W%,          \        V4      ,          ,          # W%,           pVP                  '       dC   VP                  '       d1   VP                  RJ d!   VP                  RJ d   \
        P                  # W#8X  d   WV8X  d   V'       g   V # \        W%4      # )r   ÚdeepTF© )r   ÚlenÚgetr'   Úis_zeror   ÚComplexInfinityÚOner
   Ú
is_integerÚis_negativeÚZeror   )r   Úhintsr    ÚxoldÚsingle_argumentr!   ÚyoldÚss   &,      r   r'   Ú	beta.doit   s$  € Ø—9‘9˜Q•<Ðˆä˜dŸi™i›.¨AÑ-ˆß#2�4—9‘9˜Q–<¸¿	¹	À!½ÐDˆØ�9‰9�V˜T×"Ò"Ø—’‘˜‘ˆAØ—’‘˜‘ˆAØ�9�9ˆ9˜Ÿ	Ÿ	˜	Ü×$Ñ$Ð$Ø”—‘‹:Ø�Q•3ˆJØ”—‘‹:Ø�Q•3ˆJØ�A•Œ:Ø�a•cœ' !›*•nÕ%Ð%Ø�EˆØ�L�LˆL˜QŸ]Ÿ]˜]¨q¯|©|¸uÓ/DØ�L‰L˜EÓ!Ü—6‘6ˆMØŒ9˜œ¯?ØˆKÜ�A‹zÐr   c                ó€   € V P                   w  r#\        V4      \        V4      ,          \        W#,           4      ,          # ©N)r   r   )r   r6   r    r!   s   &,  r   Ú_eval_expand_funcÚbeta._eval_expand_func—   s+   € Ø�y‰y‰ˆÜ�Q‹xœ˜a›Õ ¤5¨­£<Õ/Ð/r   c                ó†   € V P                   ^ ,          P                  ;'       d    V P                   ^,          P                  # ©r   )r   Úis_real©r   s   &r   Ú_eval_is_realÚbeta._eval_is_real›   s,   € Ø�y‰y˜�|×#Ñ#×<Ð<¨¯	©	°!­×(<Ñ(<Ð<r   c                ó¢   € V P                  V P                  ^ ,          P                  4       V P                  ^,          P                  4       4      # rA   )Úfuncr   r   rC   s   &r   Ú_eval_conjugateÚbeta._eval_conjugatež   s5   € Ø�y‰y˜Ÿ™ 1�×/Ñ/Ó1°4·9±9¸Qµ<×3IÑ3IÓ3KÓLÐLr   c                ó&   € V P                   ! R/ VB # )Nr-   )r>   )r   r    r!   Ú	piecewiseÚkwargss   &&&&,r   Ú_eval_rewrite_as_gammaÚbeta._eval_rewrite_as_gamma¡   s   € Ø×%Ò%Ñ/¨Ñ/Ð/r   c                ó¸   € ^ RI Hp \        \        RW.4      P                  4      pV! WQ^,
          ,          ^V,
          V^,
          ,          ,          V^ ^34      # ©r   )ÚIntegralÚt©Úsympy.integrals.integralsrQ   r   r   Úname)r   r    r!   rL   rQ   rR   s   &&&,  r   Ú_eval_rewrite_as_IntegralÚbeta._eval_rewrite_as_Integral¤   sJ   € Ý6ÜÔ'¨¨a¨VÓ4×9Ñ9Ó:ˆÙ˜ �E�
 A¨¥E¨Q°­UÕ#3Õ3°a¸¸A°YÓ?Ð?r   r-   r=   )T)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú
unbranchedr"   Úclassmethodr)   r'   r>   rD   rH   rM   rV   Ú__static_attributes__Ú__classdictcell__©Ú__classdict__s   @r   r   r      sR   ø‡ € ñUðl €Jò	5ð ó5ó ð5òò00ò=òMô0÷@ð @r   r   c                   óP   a € ] tR t^­t o Rt^tRtR tR tR t	R t
R tR tR	tV tR
# )r   a£  
The Generalized Incomplete Beta function is defined as

.. math::
    \mathrm{B}_{(x_1, x_2)}(a, b) = \int_{x_1}^{x_2} t^{a - 1} (1 - t)^{b - 1} dt

The Incomplete Beta function is a special case
of the Generalized Incomplete Beta function :

.. math:: \mathrm{B}_z (a, b) = \mathrm{B}_{(0, z)}(a, b)

The Incomplete Beta function satisfies :

.. math:: \mathrm{B}_z (a, b) = (-1)^a \mathrm{B}_{\frac{z}{z - 1}} (a, 1 - a - b)

The Beta function is a special case of the Incomplete Beta function :

.. math:: \mathrm{B}(a, b) = \mathrm{B}_{1}(a, b)

Examples
========

>>> from sympy import betainc, symbols, conjugate
>>> a, b, x, x1, x2 = symbols('a b x x1 x2')

The Generalized Incomplete Beta function is given by:

>>> betainc(a, b, x1, x2)
betainc(a, b, x1, x2)

The Incomplete Beta function can be obtained as follows:

>>> betainc(a, b, 0, x)
betainc(a, b, 0, x)

The Incomplete Beta function obeys the mirror symmetry:

>>> conjugate(betainc(a, b, x1, x2))
betainc(conjugate(a), conjugate(b), conjugate(x1), conjugate(x2))

We can numerically evaluate the Incomplete Beta function to
arbitrary precision for any complex numbers a, b, x1 and x2:

>>> from sympy import betainc, I
>>> betainc(2, 3, 4, 5).evalf(10)
56.08333333
>>> betainc(0.75, 1 - 4*I, 0, 2 + 3*I).evalf(25)
0.2241657956955709603655887 + 0.3619619242700451992411724*I

The Generalized Incomplete Beta function can be expressed
in terms of the Generalized Hypergeometric function.

>>> from sympy import hyper
>>> betainc(a, b, x1, x2).rewrite(hyper)
(-x1**a*hyper((a, 1 - b), (a + 1,), x1) + x2**a*hyper((a, 1 - b), (a + 1,), x2))/a

See Also
========

beta: Beta function
hyper: Generalized Hypergeometric function

References
==========

.. [1] https://en.wikipedia.org/wiki/Beta_function#Incomplete_beta_function
.. [2] https://dlmf.nist.gov/8.17
.. [3] https://functions.wolfram.com/GammaBetaErf/Beta4/
.. [4] https://functions.wolfram.com/GammaBetaErf/BetaRegularized4/02/

Tc                ó   € V P                   w  r#rEV^8X  d-   ^V,
          V^,
          ,          ) WB^,
          ,          ,          # V^8X  d,   ^V,
          V^,
          ,          WR^,
          ,          ,          # \        W4      h©é   )r   r   ©r   r   r   r   r   r   s   &&    r   r"   Úbetainc.fdiffø   sg   € Ø—y‘y‰ˆˆbØ�qŒ=à˜•V˜q 1�uÕ%Ð% b¨q­5¥kÕ1Ð1Ø˜Œ]à˜•F˜a !�eÕ$ R¨a­%¥[Õ0Ð0ä$ TÓ4Ð4r   c                ó&   € \         V P                  3# r=   )r   r   rC   s   &r   Ú_eval_mpmathÚbetainc._eval_mpmath  s   € Ü! 4§9¡9Ð,Ð,r   c                ó¦   € \         ;QJ d&    R  V P                   4       F  '       d   K   RM	  RM! R  V P                   4       4      '       d   R# R# )c              3   ó8   "  € T F  qP                   x € K  	  R # 5ir=   ©rB   ©Ú.0Úargs   & r   Ú	<genexpr>Ú(betainc._eval_is_real.<locals>.<genexpr>  ó   é € Ð0¡i˜s�{Ž{£iùó   ‚FTN©Úallr   rC   s   &r   rD   Úbetainc._eval_is_real  ó3   € ß‹3Ñ0 d§i¢iÓ0�3�3Š3Ñ0 d§i¢iÓ0×0Ò0Ùñ 1r   c                óR   € V P                   ! \        \        V P                  4      !  # r=   ©rG   Úmapr   r   rC   s   &r   rH   Úbetainc._eval_conjugate
  ó   € Ø�yŠyœ#œi¨¯©Ó3Ñ4Ð4r   c           	     ó¸   € ^ RI Hp \        \        RWW4.4      P                  4      pV! Wq^,
          ,          ^V,
          V^,
          ,          ,          WsV34      # rP   rS   )r   r   r   r   r   rL   rQ   rR   s   &&&&&,  r   rV   Ú!betainc._eval_rewrite_as_Integral  sJ   € Ý6ÜÔ'¨¨a°B¨^Ó<×AÑAÓBˆÙ˜ �E�
 A¨¥E¨Q°­UÕ#3Õ3°a¸R°[ÓAÐAr   c                óÆ   € ^ RI Hp WA,          V! V^V,
          3V^,           3V4      ,          W1,          V! V^V,
          3V^,           3V4      ,          ,
          V,          # ©r   )Úhyper)Úsympy.functions.special.hyperrƒ   )r   r   r   r   r   rL   rƒ   s   &&&&&, r   Ú_eval_rewrite_as_hyperÚbetainc._eval_rewrite_as_hyper  sX   € Ý7Ø•™˜q ! a¥%˜j¨1¨q­5¨(°BÓ7Õ7¸"½%Á%ÈÈAÐPQÍEÈ
ÐUVÐYZÕUZÐT\Ð^`ÓBaÕ:aÕaÐefÕfÐfr   r-   N)rX   rY   rZ   r[   r\   Únargsr]   r"   rj   rD   rH   rV   r…   r_   r`   ra   s   @r   r   r   ­   s>   ø‡ € ñFðN €EØ€Jò	5ò-òò5òB÷
gð gr   r   c                   ób   a a€ ] tR tRt oRt^tRtV 3R ltR tR t	R t
R tR	 tR
 tRtVtV ;t# )Úbetainc_regularizedi  aÔ  
The Generalized Regularized Incomplete Beta function is given by

.. math::
    \mathrm{I}_{(x_1, x_2)}(a, b) = \frac{\mathrm{B}_{(x_1, x_2)}(a, b)}{\mathrm{B}(a, b)}

The Regularized Incomplete Beta function is a special case
of the Generalized Regularized Incomplete Beta function :

.. math:: \mathrm{I}_z (a, b) = \mathrm{I}_{(0, z)}(a, b)

The Regularized Incomplete Beta function is the cumulative distribution
function of the beta distribution.

Examples
========

>>> from sympy import betainc_regularized, symbols, conjugate
>>> a, b, x, x1, x2 = symbols('a b x x1 x2')

The Generalized Regularized Incomplete Beta
function is given by:

>>> betainc_regularized(a, b, x1, x2)
betainc_regularized(a, b, x1, x2)

The Regularized Incomplete Beta function
can be obtained as follows:

>>> betainc_regularized(a, b, 0, x)
betainc_regularized(a, b, 0, x)

The Regularized Incomplete Beta function
obeys the mirror symmetry:

>>> conjugate(betainc_regularized(a, b, x1, x2))
betainc_regularized(conjugate(a), conjugate(b), conjugate(x1), conjugate(x2))

We can numerically evaluate the Regularized Incomplete Beta function
to arbitrary precision for any complex numbers a, b, x1 and x2:

>>> from sympy import betainc_regularized, pi, E
>>> betainc_regularized(1, 2, 0, 0.25).evalf(10)
0.4375000000
>>> betainc_regularized(pi, E, 0, 1).evalf(5)
1.00000

The Generalized Regularized Incomplete Beta function can be
expressed in terms of the Generalized Hypergeometric function.

>>> from sympy import hyper
>>> betainc_regularized(a, b, x1, x2).rewrite(hyper)
(-x1**a*hyper((a, 1 - b), (a + 1,), x1) + x2**a*hyper((a, 1 - b), (a + 1,), x2))/(a*beta(a, b))

See Also
========

beta: Beta function
hyper: Generalized Hypergeometric function

References
==========

.. [1] https://en.wikipedia.org/wiki/Beta_function#Incomplete_beta_function
.. [2] https://dlmf.nist.gov/8.17
.. [3] https://functions.wolfram.com/GammaBetaErf/Beta4/
.. [4] https://functions.wolfram.com/GammaBetaErf/BetaRegularized4/02/

Tc                ó&   <€ \         SV `  WW#V4      # r=   )ÚsuperÚ__new__)r(   r   r   r   r   Ú	__class__s   &&&&&€r   rŒ   Úbetainc_regularized.__new__c  s   ø€ Ü‰w‰˜s q¨bÓ1Ð1r   c                óB   € \         . V P                  O\        ^4      N53# r   )r   r   r   rC   s   &r   rj   Ú betainc_regularized._eval_mpmathf  s    € Ü!Ð#5 T§Y¡YÐ#5´°!³Ñ#5Ð5Ð5r   c                ó@  € V P                   w  r#rEV^8X  d=   ^V,
          V^,
          ,          ) WB^,
          ,          ,          \        W#4      ,          # V^8X  d<   ^V,
          V^,
          ,          WR^,
          ,          ,          \        W#4      ,          # \        W4      hre   )r   r   r   rg   s   &&    r   r"   Úbetainc_regularized.fdiffi  sy   € Ø—y‘y‰ˆˆbØ�qŒ=à˜•V˜q 1�uÕ%Ð% b¨q­5¥kÕ1´D¸³JÕ>Ð>Ø˜Œ]à˜•F˜a !�eÕ$ R¨a­%¥[Õ0´4¸³:Õ=Ð=ä$ TÓ4Ð4r   c                ó¦   € \         ;QJ d&    R  V P                   4       F  '       d   K   RM	  RM! R  V P                   4       4      '       d   R# R# )c              3   ó8   "  € T F  qP                   x € K  	  R # 5ir=   rn   ro   s   & r   rr   Ú4betainc_regularized._eval_is_real.<locals>.<genexpr>u  rt   ru   FTNrv   rC   s   &r   rD   Ú!betainc_regularized._eval_is_realt  ry   r   c                óR   € V P                   ! \        \        V P                  4      !  # r=   r{   rC   s   &r   rH   Ú#betainc_regularized._eval_conjugatex  r~   r   c           	     óÜ   € ^ RI Hp \        \        RWW4.4      P                  4      pWq^,
          ,          ^V,
          V^,
          ,          ,          pV! W‡W434      p	W–! W‡^ ^34      ,          # rP   rS   )
r   r   r   r   r   rL   rQ   rR   Ú	integrandÚexprs
   &&&&&,    r   rV   Ú-betainc_regularized._eval_rewrite_as_Integral{  sb   € Ý6ÜÔ'¨¨a°B¨^Ó<×AÑAÓBˆØ˜A�•J  A¥¨¨Q­Õ/Õ/ˆ	Ù˜	 r ;Ó/ˆØ�h˜y¨a°¨)Ó4Õ4Ð4r   c                óê   € ^ RI Hp WA,          V! V^V,
          3V^,           3V4      ,          W1,          V! V^V,
          3V^,           3V4      ,          ,
          V,          pV\        W4      ,          # r‚   )r„   rƒ   r   )r   r   r   r   r   rL   rƒ   r›   s   &&&&&,  r   r…   Ú*betainc_regularized._eval_rewrite_as_hyper‚  sf   € Ý7Ø•™˜q ! a¥%˜j¨1¨q­5¨(°BÓ7Õ7¸"½%Á%ÈÈAÐPQÍEÈ
ÐUVÐYZÕUZÐT\Ð^`ÓBaÕ:aÕaÐefÕfˆØ”d˜1“jÕ Ð r   r-   )rX   rY   rZ   r[   r\   r‡   r]   rŒ   rj   r"   rD   rH   rV   r…   r_   r`   Ú__classcell__)r�   rb   s   @@r   r‰   r‰     s@   ù‡ € ñDðJ €EØ€Jõ2ò6ò	5òò5ò5÷!ò !r   r‰   NrA   )Ú
sympy.corer   Úsympy.core.functionr   r   Úsympy.core.symbolr   r   Ú'sympy.functions.special.gamma_functionsr   r	   Ú%sympy.functions.combinatorial.numbersr
   Ú$sympy.functions.elementary.complexesr   r   r   r   r‰   r-   r   r   Ú<module>r¦      sL   ðÝ ß Cß :ß BÝ 9Ý :ô*ôS@ˆ?ô S@ôrggˆoô ggôZk!˜/ö k!r   