Ë
    7^(h+0  ã                   ó´  — d Z ddlmZmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZmZ ddlmZ ddlmZmZmZ d	„ Z G d
„ de«      Zd„ Z G d„ de«      Z e	d«      Zd„ Z G d„ de«      Zd„ Z G d„ de«      Zd„ Z G d„ de«      Z e	d«      Zd„ Z G d„ de«      Z d„ Z! G d„ de«      Z"d „ Z# G d!„ d"e«      Z$d#„ Z% G d$„ d%e«      Z& G d&„ d'e«      Z' G d(„ d)e«      Z(y*)+a#  
This module contains SymPy functions mathcin corresponding to special math functions in the
C standard library (since C99, also available in C++11).

The functions defined in this module allows the user to express functions such as ``expm1``
as a SymPy function for symbolic manipulation.

é    )ÚArgumentIndexErrorÚFunction)ÚRational)ÚPow)ÚS)ÚexpÚlog)Úsqrt)ÚBooleanFunctionÚtrueÚfalsec                 ó:   — t        | «      t        j                  z
  S ©N©r   r   ÚOne©Úxs    úV/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/sympy/codegen/cfunctions.pyÚ_expm1r      s   € Üˆq‹6”A—E‘E‰>Ðó    c                   óH   — e Zd ZdZdZd
d„Zd„ Zd„ ZeZe	d„ «       Z
d„ Zd„ Zy	)Úexpm1a*  
    Represents the exponential function minus one.

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

    The benefit of using ``expm1(x)`` over ``exp(x) - 1``
    is that the latter is prone to cancellation under finite precision
    arithmetic when x is close to zero.

    Examples
    ========

    >>> from sympy.abc import x
    >>> from sympy.codegen.cfunctions import expm1
    >>> '%.0e' % expm1(1e-99).evalf()
    '1e-99'
    >>> from math import exp
    >>> exp(1e-99) - 1
    0.0
    >>> expm1(x).diff(x)
    exp(x)

    See Also
    ========

    log1p
    é   c                 óH   — |dk(  rt        | j                  Ž S t        | |«      ‚©ú@
        Returns the first derivative of this function.
        r   )r   Úargsr   ©ÚselfÚargindexs     r   Úfdiffzexpm1.fdiff4   s&   € ð �qŠ=Ü˜Ÿ	™	�?Ð"ä$ T¨8Ó4Ð4r   c                 ó&   — t        | j                  Ž S r   )r   r   ©r   Úhintss     r   Ú_eval_expand_funczexpm1._eval_expand_func=   ó   € Ü�t—y‘yÐ!Ð!r   c                 ó:   — t        |«      t        j                  z
  S r   r   ©r   ÚargÚkwargss      r   Ú_eval_rewrite_as_expzexpm1._eval_rewrite_as_exp@   s   € Ü�3‹xœ!Ÿ%™%ÑÐr   c                 óX   — t        j                  |«      }|�|t        j                  z
  S y r   )r   Úevalr   r   )Úclsr)   Úexp_args      r   r-   z
expm1.evalE   s(   € ä—(‘(˜3“-ˆØÐØœQŸU™U‘?Ð"ð r   c                 ó4   — | j                   d   j                  S ©Nr   )r   Úis_real©r   s    r   Ú_eval_is_realzexpm1._eval_is_realK   ó   € Ø�y‰y˜‰|×#Ñ#Ð#r   c                 ó4   — | j                   d   j                  S r1   )r   Ú	is_finiter3   s    r   Ú_eval_is_finitezexpm1._eval_is_finiteN   s   € Ø�y‰y˜‰|×%Ñ%Ð%r   N©r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Únargsr!   r%   r+   Ú_eval_rewrite_as_tractableÚclassmethodr-   r4   r8   © r   r   r   r      sA   „ ñð8 €Eó5ò"ò ð "6Ðàñ#ó ð#ò
$ó&r   r   c                 ó:   — t        | t        j                  z   «      S r   )r	   r   r   r   s    r   Ú_log1prC   R   s   € Üˆq”1—5‘5‰y‹>Ðr   c                   óZ   — e Zd ZdZdZdd„Zd„ Zd„ ZeZe	d„ «       Z
d„ Zd„ Zd	„ Zd
„ Zd„ Zy)Úlog1paf  
    Represents the natural logarithm of a number plus one.

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

    The benefit of using ``log1p(x)`` over ``log(x + 1)``
    is that the latter is prone to cancellation under finite precision
    arithmetic when x is close to zero.

    Examples
    ========

    >>> from sympy.abc import x
    >>> from sympy.codegen.cfunctions import log1p
    >>> from sympy import expand_log
    >>> '%.0e' % expand_log(log1p(1e-99)).evalf()
    '1e-99'
    >>> from math import log
    >>> log(1 + 1e-99)
    0.0
    >>> log1p(x).diff(x)
    1/(x + 1)

    See Also
    ========

    expm1
    r   c                 ó†   — |dk(  r1t         j                  | j                  d   t         j                  z   z  S t        | |«      ‚©r   r   r   )r   r   r   r   r   s     r   r!   zlog1p.fdiffw   s8   € ð �qŠ=Ü—5‘5˜$Ÿ)™) A™,¬¯©Ñ.Ñ/Ð/ä$ T¨8Ó4Ð4r   c                 ó&   — t        | j                  Ž S r   )rC   r   r#   s     r   r%   zlog1p._eval_expand_func�   r&   r   c                 ó   — t        |«      S r   )rC   r(   s      r   Ú_eval_rewrite_as_logzlog1p._eval_rewrite_as_log„   ó   € Ü�c‹{Ðr   c                 ó  — |j                   rt        |t        j                  z   «      S |j                  s&t        j
                  |t        j                  z   «      S |j                  r%t        t        |«      t        j                  z   «      S y r   )Úis_Rationalr	   r   r   Úis_Floatr-   Ú	is_numberr   ©r.   r)   s     r   r-   z
log1p.eval‰   s^   € à�?Š?Ü�sœQŸU™U‘{Ó#Ð#Ø—’Ü—8‘8˜C¤!§%¡%™KÓ(Ð(Ø�]Š]Ü”x “}¤q§u¡uÑ,Ó-Ð-ð r   c                 óV   — | j                   d   t        j                  z   j                  S r1   )r   r   r   Úis_nonnegativer3   s    r   r4   zlog1p._eval_is_real’   s   € Ø—	‘	˜!‘œqŸu™uÑ$×4Ñ4Ð4r   c                 óŠ   — | j                   d   t        j                  z   j                  ry| j                   d   j                  S )Nr   F)r   r   r   Úis_zeror7   r3   s    r   r8   zlog1p._eval_is_finite•   s3   € Ø�I‰I�a‰Lœ1Ÿ5™5Ñ ×)Ò)ØØ�y‰y˜‰|×%Ñ%Ð%r   c                 ó4   — | j                   d   j                  S r1   )r   Úis_positiver3   s    r   Ú_eval_is_positivezlog1p._eval_is_positiveš   s   € Ø�y‰y˜‰|×'Ñ'Ð'r   c                 ó4   — | j                   d   j                  S r1   )r   rT   r3   s    r   Ú_eval_is_zerozlog1p._eval_is_zero�   r5   r   c                 ó4   — | j                   d   j                  S r1   )r   rR   r3   s    r   Ú_eval_is_nonnegativezlog1p._eval_is_nonnegative    s   € Ø�y‰y˜‰|×*Ñ*Ð*r   Nr9   )r:   r;   r<   r=   r>   r!   r%   rJ   r?   r@   r-   r4   r8   rW   rY   r[   rA   r   r   rE   rE   V   sP   „ ñð: €Eó5ò"òð "6Ðàñ.ó ð.ò5ò&ò
(ò$ó+r   rE   é   c                 ó"   — t        t        | «      S r   )r   Ú_Twor   s    r   Ú_exp2r_   ¥   s   € ÜŒt�Q‹<Ðr   c                   ó<   — e Zd ZdZdZdd„Zd„ ZeZd„ Ze	d„ «       Z
y)	Úexp2aÉ  
    Represents the exponential function with base two.

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

    The benefit of using ``exp2(x)`` over ``2**x``
    is that the latter is not as efficient under finite precision
    arithmetic.

    Examples
    ========

    >>> from sympy.abc import x
    >>> from sympy.codegen.cfunctions import exp2
    >>> exp2(2).evalf() == 4.0
    True
    >>> exp2(x).diff(x)
    log(2)*exp2(x)

    See Also
    ========

    log2
    r   c                 óH   — |dk(  r| t        t        «      z  S t        | |«      ‚r   )r	   r^   r   r   s     r   r!   z
exp2.fdiffÅ   s&   € ð �qŠ=ØœœD›	‘>Ð!ä$ T¨8Ó4Ð4r   c                 ó   — t        |«      S r   )r_   r(   s      r   Ú_eval_rewrite_as_Powzexp2._eval_rewrite_as_PowÎ   ó   € Ü�S‹zÐr   c                 ó&   — t        | j                  Ž S r   )r_   r   r#   s     r   r%   zexp2._eval_expand_funcÓ   ó   € Ü�d—i‘iÐ Ð r   c                 ó2   — |j                   rt        |«      S y r   )rO   r_   rP   s     r   r-   z	exp2.evalÖ   s   € à�=Š=Ü˜“:Ðð r   Nr9   )r:   r;   r<   r=   r>   r!   rd   r?   r%   r@   r-   rA   r   r   ra   ra   ¨   s9   „ ñð2 €Eó5òð "6Ðò!ð ñó ñr   ra   c                 ó8   — t        | «      t        t        «      z  S r   )r	   r^   r   s    r   Ú_log2rj   Ü   ó   € Üˆq‹6”#”d“)ÑÐr   c                   óB   — e Zd ZdZdZd	d„Zed„ «       Zd„ Zd„ Z	d„ Z
e
Zy)
Úlog2aØ  
    Represents the logarithm function with base two.

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

    The benefit of using ``log2(x)`` over ``log(x)/log(2)``
    is that the latter is not as efficient under finite precision
    arithmetic.

    Examples
    ========

    >>> from sympy.abc import x
    >>> from sympy.codegen.cfunctions import log2
    >>> log2(4).evalf() == 2.0
    True
    >>> log2(x).diff(x)
    1/(x*log(2))

    See Also
    ========

    exp2
    log10
    r   c                 ó„   — |dk(  r0t         j                  t        t        «      | j                  d   z  z  S t        | |«      ‚rG   )r   r   r	   r^   r   r   r   s     r   r!   z
log2.fdiffý   ó8   € ð �qŠ=Ü—5‘5œ#œd›) D§I¡I¨a¡LÑ0Ñ1Ð1ä$ T¨8Ó4Ð4r   c                 óÈ   — |j                   r*t        j                  |t        ¬«      }|j                  r|S y |j
                  r |j                  t        k(  r|j                  S y y ©N)Úbase)rO   r	   r-   r^   Úis_AtomÚis_Powrr   r   ©r.   r)   Úresults      r   r-   z	log2.eval  óL   € à�=Š=Ü—X‘X˜c¬Ô-ˆFØ�~Š~Ø�ð à�ZŠZ˜CŸH™H¬Ò,Ø—7‘7ˆNð -ˆZr   c                 óL   —  | j                  t        «      j                  |i |¤ŽS r   )Úrewriter	   Úevalf)r   r   r*   s      r   Ú_eval_evalfzlog2._eval_evalf  s#   € Ø&ˆt�|‰|œCÓ ×&Ñ&¨Ð7°Ñ7Ð7r   c                 ó&   — t        | j                  Ž S r   )rj   r   r#   s     r   r%   zlog2._eval_expand_func  rg   r   c                 ó   — t        |«      S r   )rj   r(   s      r   rJ   zlog2._eval_rewrite_as_log  re   r   Nr9   )r:   r;   r<   r=   r>   r!   r@   r-   r{   r%   rJ   r?   rA   r   r   rm   rm   à   s>   „ ñð4 €Eó5ð ñó ðò8ò!òð "6Ñr   rm   c                 ó   — | |z  |z   S r   rA   )r   ÚyÚzs      r   Ú_fmar�     s   € ØˆQ‰3�‰7€Nr   c                   ó*   — e Zd ZdZdZdd„Zd„ Zdd„Zy)	Úfmaa�  
    Represents "fused multiply add".

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

    The benefit of using ``fma(x, y, z)`` over ``x*y + z``
    is that, under finite precision arithmetic, the former is
    supported by special instructions on some CPUs.

    Examples
    ========

    >>> from sympy.abc import x, y, z
    >>> from sympy.codegen.cfunctions import fma
    >>> fma(x, y, z).diff(x)
    y

    é   c                 óp   — |dv r| j                   d|z
     S |dk(  rt        j                  S t        | |«      ‚)r   ©r   r\   r\   r„   )r   r   r   r   r   s     r   r!   z	fma.fdiff6  s<   € ð �vÑØ—9‘9˜Q ™\Ñ*Ð*Ø˜Š]Ü—5‘5ˆLä$ T¨8Ó4Ð4r   c                 ó&   — t        | j                  Ž S r   )r�   r   r#   s     r   r%   zfma._eval_expand_funcB  s   € Ü�T—Y‘YÐÐr   Nc                 ó   — t        |«      S r   )r�   )r   r)   Úlimitvarr*   s       r   r?   zfma._eval_rewrite_as_tractableE  s   € Ü�C‹yÐr   r9   r   )r:   r;   r<   r=   r>   r!   r%   r?   rA   r   r   rƒ   rƒ      s   „ ñð& €Eó	5ò ôr   rƒ   é
   c                 ó8   — t        | «      t        t        «      z  S r   )r	   Ú_Tenr   s    r   Ú_log10r�   L  rk   r   c                   ó<   — e Zd ZdZdZdd„Zed„ «       Zd„ Zd„ Z	e	Z
y)	Úlog10a$  
    Represents the logarithm function with base ten.

    Examples
    ========

    >>> from sympy.abc import x
    >>> from sympy.codegen.cfunctions import log10
    >>> log10(100).evalf() == 2.0
    True
    >>> log10(x).diff(x)
    1/(x*log(10))

    See Also
    ========

    log2
    r   c                 ó„   — |dk(  r0t         j                  t        t        «      | j                  d   z  z  S t        | |«      ‚rG   )r   r   r	   rŒ   r   r   r   s     r   r!   zlog10.fdiffe  ro   r   c                 óÈ   — |j                   r*t        j                  |t        ¬«      }|j                  r|S y |j
                  r |j                  t        k(  r|j                  S y y rq   )rO   r	   r-   rŒ   rs   rt   rr   r   ru   s      r   r-   z
log10.evalo  rw   r   c                 ó&   — t        | j                  Ž S r   )r�   r   r#   s     r   r%   zlog10._eval_expand_funcx  r&   r   c                 ó   — t        |«      S r   )r�   r(   s      r   rJ   zlog10._eval_rewrite_as_log{  rK   r   Nr9   )r:   r;   r<   r=   r>   r!   r@   r-   r%   rJ   r?   rA   r   r   r�   r�   P  s9   „ ñð$ €Eó5ð ñó ðò"òð "6Ñr   r�   c                 ó6   — t        | t        j                  «      S r   )r   r   ÚHalfr   s    r   Ú_Sqrtr–   �  s   € Üˆq”!—&‘&‹>Ðr   c                   ó,   — e Zd ZdZdZdd„Zd„ Zd„ ZeZy)ÚSqrtaî  
    Represents the square root function.

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

    The reason why one would use ``Sqrt(x)`` over ``sqrt(x)``
    is that the latter is internally represented as ``Pow(x, S.Half)`` which
    may not be what one wants when doing code-generation.

    Examples
    ========

    >>> from sympy.abc import x
    >>> from sympy.codegen.cfunctions import Sqrt
    >>> Sqrt(x)
    Sqrt(x)
    >>> Sqrt(x).diff(x)
    1/(2*sqrt(x))

    See Also
    ========

    Cbrt
    r   c                 óx   — |dk(  r*t        | j                  d   t        dd«      «      t        z  S t	        | |«      ‚)r   r   r   éÿÿÿÿr\   ©r   r   r   r^   r   r   s     r   r!   z
Sqrt.fdiff¡  s8   € ð �qŠ=Ü�t—y‘y ‘|¤X¨b°!£_Ó5´dÑ:Ð:ä$ T¨8Ó4Ð4r   c                 ó&   — t        | j                  Ž S r   )r–   r   r#   s     r   r%   zSqrt._eval_expand_funcª  rg   r   c                 ó   — t        |«      S r   )r–   r(   s      r   rd   zSqrt._eval_rewrite_as_Pow­  re   r   Nr9   ©	r:   r;   r<   r=   r>   r!   r%   rd   r?   rA   r   r   r˜   r˜   …  s%   „ ñð2 €Eó5ò!òð "6Ñr   r˜   c                 ó.   — t        | t        dd«      «      S )Nr   r„   )r   r   r   s    r   Ú_Cbrtr    ³  s   € Üˆq”(˜1˜a“.Ó!Ð!r   c                   ó,   — e Zd ZdZdZdd„Zd„ Zd„ ZeZy)ÚCbrtaõ  
    Represents the cube root function.

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

    The reason why one would use ``Cbrt(x)`` over ``cbrt(x)``
    is that the latter is internally represented as ``Pow(x, Rational(1, 3))`` which
    may not be what one wants when doing code-generation.

    Examples
    ========

    >>> from sympy.abc import x
    >>> from sympy.codegen.cfunctions import Cbrt
    >>> Cbrt(x)
    Cbrt(x)
    >>> Cbrt(x).diff(x)
    1/(3*x**(2/3))

    See Also
    ========

    Sqrt
    r   c                 ó~   — |dk(  r-t        | j                  d   t        t         dz  «      «      dz  S t	        | |«      ‚)r   r   r   r„   r›   r   s     r   r!   z
Cbrt.fdiffÓ  s=   € ð �qŠ=Ü�t—y‘y ‘|¤X¬t¨e°A©gÓ%6Ó7¸Ñ9Ð9ä$ T¨8Ó4Ð4r   c                 ó&   — t        | j                  Ž S r   )r    r   r#   s     r   r%   zCbrt._eval_expand_funcÝ  rg   r   c                 ó   — t        |«      S r   )r    r(   s      r   rd   zCbrt._eval_rewrite_as_Powà  re   r   Nr9   rž   rA   r   r   r¢   r¢   ·  s%   „ ñð2 €Eó5ò!òð "6Ñr   r¢   c                 óF   — t        t        | d«      t        |d«      z   «      S )Nr\   )r
   r   )r   r   s     r   Ú_hypotr§   æ  s   € Ü”�A�q“	œC  1›IÑ%Ó&Ð&r   c                   ó,   — e Zd ZdZdZdd„Zd„ Zd„ ZeZy)Úhypotaô  
    Represents the hypotenuse function.

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

    The hypotenuse function is provided by e.g. the math library
    in the C99 standard, hence one may want to represent the function
    symbolically when doing code-generation.

    Examples
    ========

    >>> from sympy.abc import x, y
    >>> from sympy.codegen.cfunctions import hypot
    >>> hypot(3, 4).evalf() == 5.0
    True
    >>> hypot(x, y)
    hypot(x, y)
    >>> hypot(x, y).diff(x)
    x/hypot(x, y)

    r\   c                 óŽ   — |dv r6d| j                   |dz
     z  t         | j                  | j                   Ž z  z  S t        | |«      ‚)r   r†   r\   r   )r   r^   Úfuncr   r   s     r   r!   zhypot.fdiff  sJ   € ð �vÑØ�T—Y‘Y˜x¨™zÑ*Ñ*¬D°°·±¸D¿I¹IÐ1FÑ,FÑGÐGä$ T¨8Ó4Ð4r   c                 ó&   — t        | j                  Ž S r   )r§   r   r#   s     r   r%   zhypot._eval_expand_func  r&   r   c                 ó   — t        |«      S r   )r§   r(   s      r   rd   zhypot._eval_rewrite_as_Pow  rK   r   Nr9   rž   rA   r   r   r©   r©   ê  s%   „ ñð. €Eó5ò"òð "6Ñr   r©   c                   ó    — e Zd ZdZed„ «       Zy)Úisnanr   c                 óX   — |t         j                  u rt        S |j                  rt        S y r   )r   ÚNaNr   rO   r   rP   s     r   r-   z
isnan.eval  s!   € à”!—%‘%‰<ÜˆKØ�]Š]ÜˆLàr   N©r:   r;   r<   r>   r@   r-   rA   r   r   r¯   r¯     ó   „ Ø€Eàñó ñr   r¯   c                   ó    — e Zd ZdZed„ «       Zy)Úisinfr   c                 óL   — |j                   rt        S |j                  rt        S y r   )Úis_infiniter   r7   r   rP   s     r   r-   z
isinf.eval'  s   € à�?Š?ÜˆKØ�]Š]ÜˆLàr   Nr²   rA   r   r   rµ   rµ   $  r³   r   rµ   N))r=   Úsympy.core.functionr   r   Úsympy.core.numbersr   Úsympy.core.powerr   Úsympy.core.singletonr   Ú&sympy.functions.elementary.exponentialr   r	   Ú(sympy.functions.elementary.miscellaneousr
   Úsympy.logic.boolalgr   r   r   r   r   rC   rE   r^   r_   ra   rj   rm   r�   rƒ   rŒ   r�   r�   r–   r˜   r    r¢   r§   r©   r¯   rµ   rA   r   r   ú<module>r¿      sö   ðñ÷ =Ý 'Ý  Ý "ß ;Ý 9ß <Ñ <òô:&ˆHô :&òzôK+ˆHô K+ñZ 	ˆƒt€òô1ˆ8ô 1òhô96ˆ8ô 96òxô&ˆ(ô &ñR 	ˆƒu€òô.6ˆHô .6òbô+6ˆ8ô +6ò\"ô,6ˆ8ô ,6ò^'ô*6ˆHô *6ôZ
ˆOô 
ô
ˆOõ 
r   