+
    i6                       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HtHtHt ^ RIHt ^ RIHt ^ R	IHt ^ R
IHtHt ^ RIHt ^ RIHtHtH t  ^ RI!H"t"H#t#H$t$ ^ RI%H&t&H't' ^ RI(H)t)H*t* ^ RI+H,t,H-t-H.t. ^ RI/H0t0H1t1 ^ RI2H3t3H4t4H5t5 ^ RI6H7t7H8t8 RAR lt9 ! R R]4      t: ! R R]4      t; ! R R]4      t< ! R R]4      t= ! R R]4      t> ! R R ]4      t? ! R! R"]4      t@ ! R# R$]4      tA ! R% R&]4      tBR' tC ! R( R)]4      tD ! R* R+]4      tE ! R, R-]4      tF ! R. R/]F4      tG ! R0 R1]F4      tH ! R2 R3]F4      tI ! R4 R5]F4      tJ ! R6 R7]4      tK ! R8 R9]K4      tL ! R: R;]K4      tM ! R< R=]4      tN ! R> R?]4      tOR@# )Bz|This module contains various functions that are special cases
of incomplete gamma functions. It should probably be renamed. )
EulerGamma)Add)cacheit)DefinedFunctionArgumentIndexError
expand_mul)fuzzy_or)IpiRationalInteger)is_eq)Pow)S)Dummyuniquely_named_symbol)sympify)	factorial
factorial2RisingFactorial)
polar_liftre
unpolarify)ceilingfloor)sqrtroot)explog	exp_polar)coshsinh)cossinsinc)hypermeijergc                    V P                   ^ ,          P                  '       dC   V'       d)   RVR&   V P                  ! V3/ VB \        P                  3# V \        P                  3# V'       d6   V P                   ^ ,          P                  ! V3/ VB P                  4       w  r4M#V P                   ^ ,          P                  4       w  r4V P                  V\        V,          ,           4      V P                  V\        V,          ,
          4      ,           ^,          pV P                  V\        V,          ,           4      V P                  V\        V,          ,
          4      ,
          ^\        ,          ,          pWV3# )    Fcomplex)argsis_extended_realexpandr   Zeroas_real_imagfuncr	   )selfdeephintsxyr   ims   &&,    e/var/www/html/photoedit/myenv/lib/python3.14/site-packages/sympy/functions/special/error_functions.pyreal_to_real_as_real_imagr7      s    yy|$$$$E)KK..77!&&>!yy|""4151>>@1yy|((*
))A!G
tyyQqS1
11	4B
))A!G
tyyQqS1
1AaC	8B8O    c                      a a ] tR t^1t oRtRtRR ltRR lt]R 4       t	]
]R 4       4       tR tR tR	 tR
 tR tR tR tR tR tR tR tR tR tRR ltR tR tR tV 3R lt]t Rt!Vt"V ;t## )erfaZ  
The Gauss error function.

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

This function is defined as:

.. math ::
    \mathrm{erf}(x) = \frac{2}{\sqrt{\pi}} \int_0^x e^{-t^2} \mathrm{d}t.

Examples
========

>>> from sympy import I, oo, erf
>>> from sympy.abc import z

Several special values are known:

>>> erf(0)
0
>>> erf(oo)
1
>>> erf(-oo)
-1
>>> erf(I*oo)
oo*I
>>> erf(-I*oo)
-oo*I

In general one can pull out factors of -1 and $I$ from the argument:

>>> erf(-z)
-erf(z)

The error function obeys the mirror symmetry:

>>> from sympy import conjugate
>>> conjugate(erf(z))
erf(conjugate(z))

Differentiation with respect to $z$ is supported:

>>> from sympy import diff
>>> diff(erf(z), z)
2*exp(-z**2)/sqrt(pi)

We can numerically evaluate the error function to arbitrary precision
on the whole complex plane:

>>> erf(4).evalf(30)
0.999999984582742099719981147840

>>> erf(-4*I).evalf(30)
-1296959.73071763923152794095062*I

See Also
========

erfc: Complementary error function.
erfi: Imaginary error function.
erf2: Two-argument error function.
erfinv: Inverse error function.
erfcinv: Inverse Complementary error function.
erf2inv: Inverse two-argument error function.

References
==========

.. [1] https://en.wikipedia.org/wiki/Error_function
.. [2] https://dlmf.nist.gov/7
.. [3] https://mathworld.wolfram.com/Erf.html
.. [4] https://functions.wolfram.com/GammaBetaErf/Erf

Tc                    V^8X  d@   ^\        V P                  ^ ,          ^,          ) 4      ,          \        \        4      ,          # \	        W4      h   r   r*   r   r
   r   r0   argindexs   &&r6   fdiff	erf.fdiff   s<    q=S$))A,/)**4833$T44r8   c                    \         # z(
Returns the inverse of this function.

erfinvr?   s   &&r6   inverseerf.inverse   s	    
 r8   c                   VP                   '       d   V\        P                  J d   \        P                  # V\        P                  J d   \        P                  # V\        P
                  J d   \        P                  # VP                  '       d   \        P                  # \        V\        4      '       d   VP                  ^ ,          # \        V\        4      '       d)   \        P                  VP                  ^ ,          ,
          # VP                  '       d   \        P                  # \        V\        4      '       d7   VP                  ^ ,          P                  '       d   VP                  ^,          # VP                  \        4      pV\        P                  \        P
                  39   d   V# VP!                  4       '       d   V ! V) 4      ) # R# r(   N)	is_Numberr   NaNInfinityOneNegativeInfinityNegativeOneis_zeror-   
isinstancerF   r*   erfcinverf2invextract_multiplicativelyr	   could_extract_minus_signclsargts   && r6   evalerf.eval   s1   ===aee|uu

"uu***}}$vvc6""88A;c7##55388A;&&;;;66M c7##(;(;(;88A; ((+Q//00J ''))I: *r8   c                   V ^ 8  g   V ^,          ^ 8X  d   \         P                  # \        V4      p\        V ^,
          \        ^4      ,          4      p\	        V4      ^8  d4   VR,          ) V^,          ,          V ^,
          ,          W,          ,          # ^\         P
                  V,          ,          W,          ,          V \        V4      ,          \        \        4      ,          ,          # r(   )	r   r-   r   r   lenrP   r   r   r
   nr3   previous_termsks   &&* r6   taylor_termerf.taylor_term   s     q5AEQJ66M
Aq1uadl#A>"Q&&r**QT1QU;QSAA))AD0!IaL.b2IJJr8   c                b    V P                  V P                  ^ ,          P                  4       4      # r(   r/   r*   	conjugater0   s   &r6   _eval_conjugateerf._eval_conjugate   "    yy1//122r8   c                L    V P                   ^ ,          P                  RJ d   R# R# r(   TNr*   r+   rk   s   &r6   _eval_is_realerf._eval_is_real   s     99Q<((D0 1r8   c                L    V P                   ^ ,          P                  RJ d   R# R# rp   )r*   is_imaginaryrk   s   &r6   _eval_is_imaginaryerf._eval_is_imaginary   s     99Q<$$, -r8   c                j    V P                   ^ ,          p\        VP                  VP                  .4      # rh   )r*   r   	is_finiter+   r0   zs   & r6   _eval_is_finiteerf._eval_is_finite   s)    IIaLa&8&89::r8   c                    V P                   ^ ,          P                  RJ d   V P                   ^ ,          P                  # R# rp   )r*   r+   rQ   rk   s   &r6   _eval_is_zeroerf._eval_is_zero   s1    99Q<((D099Q<''' 1r8   c                    V P                   ^ ,          P                  RJ d   V P                   ^ ,          P                  # R# rp   )r*   r+   is_extended_positiverk   s   &r6   _eval_is_positiveerf._eval_is_positive   1    99Q<((D099Q<444 1r8   c                    V P                   ^ ,          P                  RJ d   V P                   ^ ,          P                  # R# rp   )r*   r+   is_extended_negativerk   s   &r6   _eval_is_negativeerf._eval_is_negative   r   r8   c                    ^ RI Hp \        V^,          4      V,          \        P                  V! \        P
                  V^,          4      \        \        4      ,          ,
          ,          # r(   
uppergamma'sympy.functions.special.gamma_functionsr   r   r   rN   Halfr
   r0   r{   kwargsr   s   &&, r6   _eval_rewrite_as_uppergammaerf._eval_rewrite_as_uppergamma   s=    FAqDz!|QUUZ1%=d2h%FFGGr8   c                    \         P                  \        ,
          V,          \        \        4      ,          p\         P                  \        ,           \        V4      \        \        V4      ,          ,
          ,          # Nr   rN   r	   r   r
   fresnelcfresnelsr0   r{   r   rY   s   &&, r6   _eval_rewrite_as_fresnelserf._eval_rewrite_as_fresnels   @    uuqy!mDH$	HSMAhsmO;<<r8   c                    \         P                  \        ,
          V,          \        \        4      ,          p\         P                  \        ,           \        V4      \        \        V4      ,          ,
          ,          # r   r   r   s   &&, r6   _eval_rewrite_as_fresnelcerf._eval_rewrite_as_fresnelc   r   r8   c           
         V\        \        4      ,          \        \        P                  .. ^ .\        R^4      .V^,          4      ,          # r(   r   r
   r&   r   r   r   r0   r{   r   s   &&,r6   _eval_rewrite_as_meijergerf._eval_rewrite_as_meijerg   s7    bz'166(Bhr1o5F1MMMr8   c                    ^V,          \        \        4      ,          \        \        P                  .^\        P                  ,          .V^,          ) 4      ,          #    r   r
   r%   r   r   r   s   &&,r6   _eval_rewrite_as_hypererf._eval_rewrite_as_hyper   s8    s48|E166(QqvvXJA>>>r8   c                    \        V^,          4      V,          V\        \        P                  V^,          4      ,          \        \        4      ,          ,
          # r   r   expintr   r   r
   r   s   &&,r6   _eval_rewrite_as_expinterf._eval_rewrite_as_expint   s6    AqDz!|aqvvq!t 44T"X===r8   c                V   ^ RI Hp V'       de   V! W\        P                  4      pV\        P                  J d:   \        P
                  \        V) 4      \        V^,          ) 4      ,          ,           # \        P                  \        V4      \        V^,          ) 4      ,          ,
          # )r(   )limit)	sympy.series.limitsr   r   rM   rO   rP   _erfsr   rN   )r0   r{   limitvarr   r   lims   &&&,  r6   _eval_rewrite_as_tractableerf._eval_rewrite_as_tractable   sl    -QZZ0Ca(((}}uaRyadU';;;uuuQxQTE
***r8   c                B    \         P                  \        V4      ,
          # r   )r   rN   erfcr   s   &&,r6   _eval_rewrite_as_erfcerf._eval_rewrite_as_erfc   s    uutAwr8   c                F    \         ) \        \         V,          4      ,          # r   r	   erfir   s   &&,r6   _eval_rewrite_as_erfierf._eval_rewrite_as_erfi   s    r$qs)|r8   c                p   V P                   ^ ,          P                  WVR7      pVP                  V^ 4      pV\        P                  J d   TP                  T^ VR8X  d   RMRR7      pWP                  9   d0   VP                  '       d   ^V,          \        \        4      ,          # V P                  V4      # r(   logxcdir-+dirr   )r*   as_leading_termsubsr   ComplexInfinityr   free_symbolsrQ   r   r
   r/   r0   r3   r   r   rY   arg0s   &&&&  r6   _eval_as_leading_termerf._eval_as_leading_term   s    iil**1d*Cxx1~1$$$99Qdbjsc9BD   T\\\S5b>!99T?"r8   c                (  < ^ RI Hp V^ ,          pV\        P                  \        P                  39   Ed,   V P
                  ^ ,          p VP                  V4      w  rT	) p	T	P                  '       d   \        Y,          4      p
\        T
4       Uu. uFb  p\        P                  T,          \        ^T,          ^,
          4      ,          T^T,          ^,           ,          ^T,          ,          ,          NKd  	  upT! ^Yz,          ,          T4      .,           p\        P                  \        T^,          ) 4      \!        \"        4      ,          \%        T!  ,          ,
          # \&        \(        V `W  WW44      #   \        \        3 d    T u # i ; iu upi r(   Order)sympy.series.orderr   r   rM   rO   r*   leadterm
ValueErrorNotImplementedErroris_positiver   rangerP   r   rN   r   r   r
   r   superr:   _eval_aseries)r0   rb   args0r3   r   r   pointr{   _exnewnrd   s	__class__s   &&&&&        r6   r   erf._eval_aseries  s6   ,aQZZ!3!344		!A

1 B~~~qt}#Dk+) ]]A%
1Q37(;;q1Q37|aQRd?RSS)+.3AagIq.A-BCuuQTE
48 3sAw>>>S$-a@@  34 +s   E6 A(F6FF r<   r   )$__name__
__module____qualname____firstlineno____doc__
unbranchedrA   rG   classmethodr[   staticmethodr   re   rl   rr   rv   r|   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r7   r.   __static_attributes____classdictcell____classcell__r   __classdict__s   @@r6   r:   r:   1   s     JX J5  B 	K  	K3;(55H==N?>+	#A* -LLr8   r:   c                      a  ] tR tRt o RtRtRR ltRR lt]R 4       t	]
]R 4       4       tR tR	 tRR ltR tR tR tR tR tR tR tR tR tR t]tR tRtV tR
# )r   i   aR  
Complementary Error Function.

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

The function is defined as:

.. math ::
    \mathrm{erfc}(x) = \frac{2}{\sqrt{\pi}} \int_x^\infty e^{-t^2} \mathrm{d}t

Examples
========

>>> from sympy import I, oo, erfc
>>> from sympy.abc import z

Several special values are known:

>>> erfc(0)
1
>>> erfc(oo)
0
>>> erfc(-oo)
2
>>> erfc(I*oo)
-oo*I
>>> erfc(-I*oo)
oo*I

The error function obeys the mirror symmetry:

>>> from sympy import conjugate
>>> conjugate(erfc(z))
erfc(conjugate(z))

Differentiation with respect to $z$ is supported:

>>> from sympy import diff
>>> diff(erfc(z), z)
-2*exp(-z**2)/sqrt(pi)

It also follows

>>> erfc(-z)
2 - erfc(z)

We can numerically evaluate the complementary error function to arbitrary
precision on the whole complex plane:

>>> erfc(4).evalf(30)
0.0000000154172579002800188521596734869

>>> erfc(4*I).evalf(30)
1.0 - 1296959.73071763923152794095062*I

See Also
========

erf: Gaussian error function.
erfi: Imaginary error function.
erf2: Two-argument error function.
erfinv: Inverse error function.
erfcinv: Inverse Complementary error function.
erf2inv: Inverse two-argument error function.

References
==========

.. [1] https://en.wikipedia.org/wiki/Error_function
.. [2] https://dlmf.nist.gov/7
.. [3] https://mathworld.wolfram.com/Erfc.html
.. [4] https://functions.wolfram.com/GammaBetaErf/Erfc

Tc                    V^8X  d@   R\        V P                  ^ ,          ^,          ) 4      ,          \        \        4      ,          # \	        W4      hr=   r_   r>   r?   s   &&r6   rA   
erfc.fdiffo  s<    q=c499Q<?*++DH44$T44r8   c                    \         # rD   rS   r?   s   &&r6   rG   erfc.inverseu  s	    
 r8   c                   VP                   '       dk   V\        P                  J d   \        P                  # V\        P                  J d   \        P                  # VP
                  '       d   \        P                  # \        V\        4      '       d)   \        P                  VP                  ^ ,          ,
          # \        V\        4      '       d   VP                  ^ ,          # VP
                  '       d   \        P                  # VP                  \        4      pV\        P                  \        P                  39   d   V) # VP                  4       '       d   ^V ! V) 4      ,
          # R# rJ   )rK   r   rL   rM   r-   rQ   rN   rR   rF   r*   rS   rU   r	   rO   rV   rW   s   && r6   r[   	erfc.eval|  s    ===aee|uu

"vvuuc6""55388A;&&c7##88A;;;;55L ((+Q//004K ''))sC4y=  *r8   c                   V ^ 8X  d   \         P                  # V ^ 8  g   V ^,          ^ 8X  d   \         P                  # \        V4      p\	        V ^,
          \        ^4      ,          4      p\        V4      ^8  d4   VR,          ) V^,          ,          V ^,
          ,          W,          ,          # R\         P                  V,          ,          W,          ,          V \        V4      ,          \        \        4      ,          ,          # r^   )
r   rN   r-   r   r   r`   rP   r   r   r
   ra   s   &&* r6   re   erfc.taylor_term  s     655LUa!eqj66M
Aq1uadl#A>"Q&&r**QT1QU;QSAA!--**QT11Yq\>$r(3JKKr8   c                b    V P                  V P                  ^ ,          P                  4       4      # rh   ri   rk   s   &r6   rl   erfc._eval_conjugate  rn   r8   c                    V P                   ^ ,          P                  RJ d   R# V P                   ^ ,          P                  RJ d   R# R# )r(   TFN)r*   r+   ru   rk   s   &r6   rr   erfc._eval_is_real  s9    99Q<((D099Q<$$, -r8   Nc                P    V P                  \        4      P                  R RVR7      # 	tractableT)r1   r   rewriter:   r0   r{   r   r   s   &&&,r6   r   erfc._eval_rewrite_as_tractable  #    ||C ((4((SSr8   c                B    \         P                  \        V4      ,
          # r   )r   rN   r:   r   s   &&,r6   _eval_rewrite_as_erferfc._eval_rewrite_as_erf  s    uus1v~r8   c                n    \         P                  \        \        \        V,          4      ,          ,           # r   )r   rN   r	   r   r   s   &&,r6   r   erfc._eval_rewrite_as_erfi  s    uuqac{""r8   c                $   \         P                  \        ,
          V,          \        \        4      ,          p\         P                  \         P                  \        ,           \        V4      \        \        V4      ,          ,
          ,          ,
          # r   r   r   s   &&, r6   r   erfc._eval_rewrite_as_fresnels  sI    uuqy!mDH$uu	HSMAhsmO$CDDDr8   c                $   \         P                  \        ,
          V,          \        \        4      ,          p\         P                  \         P                  \        ,           \        V4      \        \        V4      ,          ,
          ,          ,
          # r   r   r   s   &&, r6   r   erfc._eval_rewrite_as_fresnelc  sI    uuQwk$r("uu	HSMAhsmO$CDDDr8   c                    \         P                  V\        \        4      ,          \	        \         P
                  .. ^ .\        R^4      .V^,          4      ,          ,
          # r   )r   rN   r   r
   r&   r   r   r   s   &&,r6   r   erfc._eval_rewrite_as_meijerg  sC    uuqbz'166(Bhr1o=NPQSTPT"UUUUr8   c                    \         P                  ^V,          \        \        4      ,          \	        \         P
                  .^\         P
                  ,          .V^,          ) 4      ,          ,
          # r   )r   rN   r   r
   r%   r   r   s   &&,r6   r   erfc._eval_rewrite_as_hyper  sA    uuqs48|E166(QqvvXJA$FFFFr8   c                   ^ RI Hp \        P                  \	        V^,          4      V,          \        P                  V! \        P
                  V^,          4      \	        \        4      ,          ,
          ,          ,
          # r   )r   r   r   rN   r   r   r
   r   s   &&, r6   r    erfc._eval_rewrite_as_uppergamma  sF    FuutAqDz!|QUUZ1-Ed2h-N%NOOOr8   c                    \         P                  \        V^,          4      V,          ,
          V\        \         P                  V^,          4      ,          \        \
        4      ,          ,           # r   )r   rN   r   r   r   r
   r   s   &&,r6   r   erfc._eval_rewrite_as_expint  s?    uutAqDz!|#aqvvq!t(<&<T"X&EEEr8   c                ,    V P                  \        4      # r   r	  r0   r2   s   &,r6   _eval_expand_funcerfc._eval_expand_func      ||C  r8   c                6   V P                   ^ ,          P                  WVR7      pVP                  V^ 4      pV\        P                  J d   TP                  T^ VR8X  d   RMRR7      pVP                  '       d   \        P                  # V P                  V4      # r   )	r*   r   r   r   r   r   rQ   rN   r/   r   s   &&&&  r6   r   erfc._eval_as_leading_term  sx    iil**1d*Cxx1~1$$$99Qdbjsc9BD<<<55L99T?"r8   c                r    \         P                  \        V P                  !  P	                  WW44      ,
          # r   )r   rN   r:   r*   r   )r0   rb   r   r3   r   s   &&&&&r6   r   erfc._eval_aseries  s&    uusDII44QqGGGr8   r   r<   r   )r   r   r   r   r   r   rA   rG   r   r[   r   r   re   rl   rr   r   r  r   r   r   r   r   r   r   r!  r   r7   r.   r   r   r   r   s   @r6   r   r      s     JX J5 ! !6 L  L3T#EEVGPF!	# -LH Hr8   r   c                      a a ] tR tRt oRtRtRR lt]R 4       t]	]
R 4       4       tR tR tR	 tRR
 ltR tR tR tR tR tR tR tR tR t]tR tV 3R ltRtVtV ;t# )r   i  a!  
Imaginary error function.

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

The function erfi is defined as:

.. math ::
    \mathrm{erfi}(x) = \frac{2}{\sqrt{\pi}} \int_0^x e^{t^2} \mathrm{d}t

Examples
========

>>> from sympy import I, oo, erfi
>>> from sympy.abc import z

Several special values are known:

>>> erfi(0)
0
>>> erfi(oo)
oo
>>> erfi(-oo)
-oo
>>> erfi(I*oo)
I
>>> erfi(-I*oo)
-I

In general one can pull out factors of -1 and $I$ from the argument:

>>> erfi(-z)
-erfi(z)

>>> from sympy import conjugate
>>> conjugate(erfi(z))
erfi(conjugate(z))

Differentiation with respect to $z$ is supported:

>>> from sympy import diff
>>> diff(erfi(z), z)
2*exp(z**2)/sqrt(pi)

We can numerically evaluate the imaginary error function to arbitrary
precision on the whole complex plane:

>>> erfi(2).evalf(30)
18.5648024145755525987042919132

>>> erfi(-2*I).evalf(30)
-0.995322265018952734162069256367*I

See Also
========

erf: Gaussian error function.
erfc: Complementary error function.
erf2: Two-argument error function.
erfinv: Inverse error function.
erfcinv: Inverse Complementary error function.
erf2inv: Inverse two-argument error function.

References
==========

.. [1] https://en.wikipedia.org/wiki/Error_function
.. [2] https://mathworld.wolfram.com/Erfi.html
.. [3] https://functions.wolfram.com/GammaBetaErf/Erfi

Tc                    V^8X  d?   ^\        V P                  ^ ,          ^,          4      ,          \        \        4      ,          # \	        W4      hr<   r>   r?   s   &&r6   rA   
erfi.fdiff.  s9    q=S1q))$r(22$T44r8   c                   VP                   '       dk   V\        P                  J d   \        P                  # VP                  '       d   \        P                  # V\        P
                  J d   \        P
                  # VP                  '       d   \        P                  # VP                  4       '       d   V ! V) 4      ) # VP                  \        4      pVe   V\        P
                  J d   \        # \        V\        4      '       d   \        VP                  ^ ,          ,          # \        V\        4      '       d4   \        \        P                  VP                  ^ ,          ,
          ,          # \        V\        4      '       dD   VP                  ^ ,          P                  '       d   \        VP                  ^,          ,          # R # R # R # r   )rK   r   rL   rQ   r-   rM   rV   rU   r	   rR   rF   r*   rS   rN   rT   rX   r{   nzs   && r6   r[   	erfi.eval4  s%   ;;;AEEzuuvvajjzz!99966M %%''G8O ''*>QZZ"f%%|#"g&&!%%"''!*,--"g&&2771:+=+=+=|# ,>& r8   c                   V ^ 8  g   V ^,          ^ 8X  d   \         P                  # \        V4      p\        V ^,
          \        ^4      ,          4      p\	        V4      ^8  d3   VR,          V^,          ,          V ^,
          ,          W,          ,          # ^W,          ,          V \        V4      ,          \        \        4      ,          ,          # r^   )r   r-   r   r   r`   r   r   r
   ra   s   &&* r6   re   erfi.taylor_termR  s     q5AEQJ66M
Aq1uadl#A>"Q&%b)AqD0AE:AC@@14x9Q<R!899r8   c                b    V P                  V P                  ^ ,          P                  4       4      # rh   ri   rk   s   &r6   rl   erfi._eval_conjugate_  rn   r8   c                <    V P                   ^ ,          P                  # rh   rq   rk   s   &r6   _eval_is_extended_realerfi._eval_is_extended_realb      yy|,,,r8   c                <    V P                   ^ ,          P                  # rh   r*   rQ   rk   s   &r6   r   erfi._eval_is_zeroe      yy|###r8   c                P    V P                  \        4      P                  R RVR7      # r  r	  r  s   &&&,r6   r   erfi._eval_rewrite_as_tractableh  r  r8   c                F    \         ) \        \         V,          4      ,          # r   )r	   r:   r   s   &&,r6   r  erfi._eval_rewrite_as_erfk  s    r#ac({r8   c                Z    \         \        \         V,          4      ,          \         ,
          # r   )r	   r   r   s   &&,r6   r   erfi._eval_rewrite_as_erfcn  s    ac{Qr8   c                    \         P                  \        ,           V,          \        \        4      ,          p\         P                  \        ,
          \        V4      \        \        V4      ,          ,
          ,          # r   r   r   s   &&, r6   r   erfi._eval_rewrite_as_fresnelsq  r   r8   c                    \         P                  \        ,           V,          \        \        4      ,          p\         P                  \        ,
          \        V4      \        \        V4      ,          ,
          ,          # r   r   r   s   &&, r6   r   erfi._eval_rewrite_as_fresnelcu  r   r8   c           
         V\        \        4      ,          \        \        P                  .. ^ .\        R^4      .V^,          ) 4      ,          # r   r   r   s   &&,r6   r   erfi._eval_rewrite_as_meijergy  s9    bz'166(Bhr1o5FANNNr8   c                    ^V,          \        \        4      ,          \        \        P                  .^\        P                  ,          .V^,          4      ,          # r   r   r   s   &&,r6   r   erfi._eval_rewrite_as_hyper|  s6    s48|E166(QqvvXJ1===r8   c                    ^ RI Hp \        V^,          ) 4      V,          V! \        P                  V^,          ) 4      \        \
        4      ,          \        P                  ,
          ,          # r   )r   r   r   r   r   r
   rN   r   s   &&, r6   r    erfi._eval_rewrite_as_uppergamma  sA    FQTE{1}j!Q$7R@155HIIr8   c                    \        V^,          ) 4      V,          V\        \        P                  V^,          ) 4      ,          \        \        4      ,          ,
          # r   r   r   s   &&,r6   r   erfi._eval_rewrite_as_expint  s:    QTE{1}qA!66tBx???r8   c                ,    V P                  \        4      # r   r	  r   s   &,r6   r!  erfi._eval_expand_func  r#  r8   c                T   V P                   ^ ,          P                  WVR7      pVP                  V^ 4      pWP                  9   d0   VP                  '       d   ^V,          \        \        4      ,          # VP                  '       d   V P                  V4      # V P                  V4      # r(   r   )	r*   r   r   r   rQ   r   r
   ry   r/   r   s   &&&&  r6   r   erfi._eval_as_leading_term  sy    iil**1d*Cxx1~   T\\\S5b>!^^^99T?"yy~r8   c                  < ^ RI Hp V^ ,          pV\        P                  J d   V P                  ^ ,          p\        V4       Uu. uFF  p\        ^V,          ^,
          4      ^V,          V^V,          ^,           ,          ,          ,          NKH  	  upV! ^Wq,          ,          V4      .,           p	\        ) \        V^,          4      \        \        4      ,          \        V	!  ,          ,           # \        \        V `;  WW44      # u upi r   )r   r   r   rM   r*   r   r   r	   r   r   r
   r   r   r   r   r0   rb   r   r3   r   r   r   r{   rd   r   r   s   &&&&&     r6   r   erfi._eval_aseries  s    ,aAJJ		!A"1X'% AaC!G$1q1Q37|(;<<%'*/!$*:);<A2QT48+sAw666T4.qAA	's   ADr   r<   r   ) r   r   r   r   r   r   rA   r   r[   r   r   re   rl   r5  r   r   r  r   r   r   r   r   r   r   r!  r7   r.   r   r   r   r   r   r   s   @@r6   r   r     s     GR J5 $ $: 	:  	:3-$T==O>J@! -L
B 
Br8   r   c                      a  ] tR tRt o RtR t]R 4       tR tR t	R t
R tR	 tR
 tR tR tR tR tR tR tR tRtV tR# )erf2i  a  
Two-argument error function.

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

This function is defined as:

.. math ::
    \mathrm{erf2}(x, y) = \frac{2}{\sqrt{\pi}} \int_x^y e^{-t^2} \mathrm{d}t

Examples
========

>>> from sympy import oo, erf2
>>> from sympy.abc import x, y

Several special values are known:

>>> erf2(0, 0)
0
>>> erf2(x, x)
0
>>> erf2(x, oo)
1 - erf(x)
>>> erf2(x, -oo)
-erf(x) - 1
>>> erf2(oo, y)
erf(y) - 1
>>> erf2(-oo, y)
erf(y) + 1

In general one can pull out factors of -1:

>>> erf2(-x, -y)
-erf2(x, y)

The error function obeys the mirror symmetry:

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

Differentiation with respect to $x$, $y$ is supported:

>>> from sympy import diff
>>> diff(erf2(x, y), x)
-2*exp(-x**2)/sqrt(pi)
>>> diff(erf2(x, y), y)
2*exp(-y**2)/sqrt(pi)

See Also
========

erf: Gaussian error function.
erfc: Complementary error function.
erfi: Imaginary error function.
erfinv: Inverse error function.
erfcinv: Inverse Complementary error function.
erf2inv: Inverse two-argument error function.

References
==========

.. [1] https://functions.wolfram.com/GammaBetaErf/Erf2/

c                   V P                   w  r#V^8X  d/   R\        V^,          ) 4      ,          \        \        4      ,          # V^8X  d/   ^\        V^,          ) 4      ,          \        \        4      ,          # \	        W4      hr   )r*   r   r   r
   r   r0   r@   r3   r4   s   &&  r6   rA   
erf2.fdiff  s`    yyq=c1a4%j=b))]S!Q$Z<R(($T44r8   c                   \         P                  \         P                  \         P                  3pV\         P                  J g   V\         P                  J d   \         P                  # W8X  d   \         P                  # W9   g   W#9   d   \        V4      \        V4      ,
          # \        V\        4      '       d,   VP                  ^ ,          V8X  d   VP                  ^,          # VP                  '       g[   VP                  '       gI   VP                  '       d   VP                  '       g%   VP                  '       d.   VP                  '       d   \        V4      \        V4      ,
          # VP                  4       pVP                  4       pV'       d   V'       d   V ! V) V) 4      ) # V'       g	   V'       d   \        V4      \        V4      ,
          # R# rJ   )r   rM   rO   r-   rL   r:   rR   rT   r*   rQ   r+   is_infiniterV   )rX   r3   r4   chksign_xsign_ys   &&&   r6   r[   	erf2.eval  s'   zz1--qvv6:aee55LV66MXq6CF?"a!!affQi1n66!9999			Q%7%7%7AMMM"""q}}}q6CF?" ++-++-vQBK<q6#a&=  r8   c                    V P                  V P                  ^ ,          P                  4       V P                  ^,          P                  4       4      # rh   ri   rk   s   &r6   rl   erf2._eval_conjugate
  s5    yy1//1499Q<3I3I3KLLr8   c                    V P                   ^ ,          P                  ;'       d    V P                   ^,          P                  # rh   rq   rk   s   &r6   r5  erf2._eval_is_extended_real  s,    yy|,,NN11N1NNr8   c                8    \        V4      \        V4      ,
          # r   r:   r0   r3   r4   r   s   &&&,r6   r  erf2._eval_rewrite_as_erf  s    1vAr8   c                8    \        V4      \        V4      ,
          # r   r   rg  s   &&&,r6   r   erf2._eval_rewrite_as_erfc  s    Awa  r8   c                z    \         \        \         V,          4      \        \         V,          4      ,
          ,          # r   r   rg  s   &&&,r6   r   erf2._eval_rewrite_as_erfi  s"    $qs)D1I%&&r8   c                    \        V4      P                  \        4      \        V4      P                  \        4      ,
          # r   )r:   r
  r   rg  s   &&&,r6   r   erf2._eval_rewrite_as_fresnels  '    1v~~h'#a&..*BBBr8   c                    \        V4      P                  \        4      \        V4      P                  \        4      ,
          # r   )r:   r
  r   rg  s   &&&,r6   r   erf2._eval_rewrite_as_fresnelc  rp  r8   c                    \        V4      P                  \        4      \        V4      P                  \        4      ,
          # r   )r:   r
  r&   rg  s   &&&,r6   r   erf2._eval_rewrite_as_meijerg  s'    1v~~g&Q)@@@r8   c                    \        V4      P                  \        4      \        V4      P                  \        4      ,
          # r   )r:   r
  r%   rg  s   &&&,r6   r   erf2._eval_rewrite_as_hyper"  s'    1v~~e$s1v~~e'<<<r8   c                   ^ RI Hp \        V^,          4      V,          \        P                  V! \        P
                  V^,          4      \        \        4      ,          ,
          ,          \        V^,          4      V,          \        P                  V! \        P
                  V^,          4      \        \        4      ,          ,
          ,          ,
          # r   r   )r0   r3   r4   r   r   s   &&&, r6   r    erf2._eval_rewrite_as_uppergamma%  s{    FQT
1aeejA&>tBx&GGHAJqL!%%*QVVQT":48"CCDE 	Fr8   c                    \        V4      P                  \        4      \        V4      P                  \        4      ,
          # r   )r:   r
  r   rg  s   &&&,r6   r   erf2._eval_rewrite_as_expint*  s'    1v~~f%Av(>>>r8   c                ,    V P                  \        4      # r   r	  r   s   &,r6   r!  erf2._eval_expand_func-  r#  r8   c                (    \        V P                  !  # r   )r   r*   rk   s   &r6   r   erf2._eval_is_zero0  s    dii  r8   r   N)r   r   r   r   r   rA   r   r[   rl   r5  r  r   r   r   r   r   r   r   r   r!  r   r   r   r(  s   @r6   rW  rW    sq     BJ5 ! !0MO!'CCA=F
?!! !r8   rW  c                   T   a  ] tR tRt o RtR
R ltR
R lt]R 4       tR t	R t
RtV tR	# )rF   i3  a  
Inverse Error Function. The erfinv function is defined as:

.. math ::
    \mathrm{erf}(x) = y \quad \Rightarrow \quad \mathrm{erfinv}(y) = x

Examples
========

>>> from sympy import erfinv
>>> from sympy.abc import x

Several special values are known:

>>> erfinv(0)
0
>>> erfinv(1)
oo

Differentiation with respect to $x$ is supported:

>>> from sympy import diff
>>> diff(erfinv(x), x)
sqrt(pi)*exp(erfinv(x)**2)/2

We can numerically evaluate the inverse error function to arbitrary
precision on [-1, 1]:

>>> erfinv(0.2).evalf(30)
0.179143454621291692285822705344

See Also
========

erf: Gaussian error function.
erfc: Complementary error function.
erfi: Imaginary error function.
erf2: Two-argument error function.
erfcinv: Inverse Complementary error function.
erf2inv: Inverse two-argument error function.

References
==========

.. [1] https://en.wikipedia.org/wiki/Error_function#Inverse_functions
.. [2] https://functions.wolfram.com/GammaBetaErf/InverseErf/

c                    V^8X  d\   \        \        4      \        V P                  V P                  ^ ,          4      ^,          4      ,          \
        P                  ,          # \        W4      hr<   r   r
   r   r/   r*   r   r   r   r?   s   &&r6   rA   erfinv.fdifff  sG    q=8C		$))A, 7 :;;AFFBB$T44r8   c                    \         # rD   rf  r?   s   &&r6   rG   erfinv.inversel  s	    
 
r8   c                   V\         P                  J d   \         P                  # V\         P                  J d   \         P                  # VP                  '       d   \         P
                  # V\         P                  J d   \         P                  # \        V\        4      '       d7   VP                  ^ ,          P                  '       d   VP                  ^ ,          # VP                  '       d   \         P
                  # VP                  R4      pVeR   \        V\        4      '       d:   VP                  ^ ,          P                  '       d   VP                  ^ ,          ) # R# R# R# )r(   Nr   )r   rL   rP   rO   rQ   r-   rN   rM   rR   r:   r*   r+   rU   r-  s   && r6   r[   erfinv.evals  s    :55L!--%%%YYY66M!%%Z::a!&&)"<"<"<66!999966M ''+>z"c22
7T7T7TGGAJ; 8U2>r8   c                &    \        ^V,
          4      # r<   r   r   s   &&,r6   _eval_rewrite_as_erfcinverfinv._eval_rewrite_as_erfcinv  s    qs|r8   c                <    V P                   ^ ,          P                  # rh   r9  rk   s   &r6   r   erfinv._eval_is_zero  r;  r8   r   Nr<   )r   r   r   r   r   rA   rG   r   r[   r  r   r   r   r(  s   @r6   rF   rF   3  s8     /d5  *$ $r8   rF   c                   Z   a  ] tR tRt o RtRR ltRR lt]R 4       tR t	R t
R tR	tV tR
# )rS   i  a@  
Inverse Complementary Error Function. The erfcinv function is defined as:

.. math ::
    \mathrm{erfc}(x) = y \quad \Rightarrow \quad \mathrm{erfcinv}(y) = x

Examples
========

>>> from sympy import erfcinv
>>> from sympy.abc import x

Several special values are known:

>>> erfcinv(1)
0
>>> erfcinv(0)
oo

Differentiation with respect to $x$ is supported:

>>> from sympy import diff
>>> diff(erfcinv(x), x)
-sqrt(pi)*exp(erfcinv(x)**2)/2

See Also
========

erf: Gaussian error function.
erfc: Complementary error function.
erfi: Imaginary error function.
erf2: Two-argument error function.
erfinv: Inverse error function.
erf2inv: Inverse two-argument error function.

References
==========

.. [1] https://en.wikipedia.org/wiki/Error_function#Inverse_functions
.. [2] https://functions.wolfram.com/GammaBetaErf/InverseErfc/

c                    V^8X  d]   \        \        4      ) \        V P                  V P                  ^ ,          4      ^,          4      ,          \
        P                  ,          # \        W4      hr<   r  r?   s   &&r6   rA   erfcinv.fdiff  sI    q=H9S499Q<!8!!;<<QVVCC$T44r8   c                    \         # rD   rj  r?   s   &&r6   rG   erfcinv.inverse  s	    
 r8   c                L   V\         P                  J d   \         P                  # VP                  '       d   \         P                  # V\         P                  J d   \         P
                  # V^8X  d   \         P                  # VP                  '       d   \         P                  # R# r   N)r   rL   rQ   rM   rN   r-   rO   rX   r{   s   &&r6   r[   erfcinv.eval  sh    :55LYYY::!%%Z66M!V%%%999:: r8   c                &    \        ^V,
          4      # r<   rE   r   s   &&,r6   _eval_rewrite_as_erfinverfcinv._eval_rewrite_as_erfinv  s    ac{r8   c                J    V P                   ^ ,          ^,
          P                  # rh   r9  rk   s   &r6   r   erfcinv._eval_is_zero  s    		!q )))r8   c           	     |    V P                   ^ ,          p\        VP                  \        V\	        ^4      4      .4      # rh   )r*   r   rQ   r   r   rz   s   & r6   _eval_is_infiniteerfcinv._eval_is_infinite  s.    IIaLE!WQZ$89::r8   r   Nr<   )r   r   r   r   r   rA   rG   r   r[   r  r   r  r   r   r(  s   @r6   rS   rS     s=     )X5  *; ;r8   rS   c                   @   a  ] tR tRt o RtR t]R 4       tR tRt	V t
R# )rT   i  a  
Two-argument Inverse error function. The erf2inv function is defined as:

.. math ::
    \mathrm{erf2}(x, w) = y \quad \Rightarrow \quad \mathrm{erf2inv}(x, y) = w

Examples
========

>>> from sympy import erf2inv, oo
>>> from sympy.abc import x, y

Several special values are known:

>>> erf2inv(0, 0)
0
>>> erf2inv(1, 0)
1
>>> erf2inv(0, 1)
oo
>>> erf2inv(0, y)
erfinv(y)
>>> erf2inv(oo, y)
erfcinv(-y)

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

>>> from sympy import diff
>>> diff(erf2inv(x, y), x)
exp(-x**2 + erf2inv(x, y)**2)
>>> diff(erf2inv(x, y), y)
sqrt(pi)*exp(erf2inv(x, y)**2)/2

See Also
========

erf: Gaussian error function.
erfc: Complementary error function.
erfi: Imaginary error function.
erf2: Two-argument error function.
erfinv: Inverse error function.
erfcinv: Inverse complementary error function.

References
==========

.. [1] https://functions.wolfram.com/GammaBetaErf/InverseErf2/

c                B   V P                   w  r#V^8X  d0   \        V P                  W#4      ^,          V^,          ,
          4      # V^8X  dK   \        \        4      \
        P                  ,          \        V P                  W#4      ^,          4      ,          # \        W4      hr<   )r*   r   r/   r   r
   r   r   r   rY  s   &&  r6   rA   erf2inv.fdiff  sp    yyq=tyy~q(A-..]8AFF?3tyy~q'8#999$T44r8   c                <   V\         P                  J g   V\         P                  J d   \         P                  # VP                  '       d#   VP                  '       d   \         P                  # VP                  '       d%   V\         P                  J d   \         P
                  # V\         P                  J d#   VP                  '       d   \         P                  # VP                  '       d   \        V4      # V\         P
                  J d   \        V) 4      # VP                  '       d   V# V\         P
                  J d   \        V4      # VP                  '       d.   VP                  '       d   \         P                  # \        V4      # VP                  '       d   V# R # r   )r   rL   rQ   r-   rN   rM   rF   rS   )rX   r3   r4   s   &&&r6   r[   erf2inv.eval   s    :aee55LYYY199966MYYY1:::!%%ZAIII55LYYY!9!**_A2;YYYH!**_!9999yyyvvay 999H r8   c                r    V P                   w  rVP                  '       d   VP                  '       d   R # R# R# )TNr9  )r0   r3   r4   s   &  r6   r   erf2inv._eval_is_zero;  s(    yy999 #9r8   r   N)r   r   r   r   r   rA   r   r[   r   r   r   r(  s   @r6   rT   rT     s.     0f5  4 r8   rT   c                      a a ] tR tRt oRt]R 4       tRR ltV 3R ltR t	R t
R tR	 t]t]t]tRR
 ltR tV 3R ltRV 3R lltV 3R ltRtVtV ;t# )EiiD  a   
The classical exponential integral.

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

For use in SymPy, this function is defined as

.. math:: \operatorname{Ei}(x) = \sum_{n=1}^\infty \frac{x^n}{n\, n!}
                                 + \log(x) + \gamma,

where $\gamma$ is the Euler-Mascheroni constant.

If $x$ is a polar number, this defines an analytic function on the
Riemann surface of the logarithm. Otherwise this defines an analytic
function in the cut plane $\mathbb{C} \setminus (-\infty, 0]$.

**Background**

The name exponential integral comes from the following statement:

.. math:: \operatorname{Ei}(x) = \int_{-\infty}^x \frac{e^t}{t} \mathrm{d}t

If the integral is interpreted as a Cauchy principal value, this statement
holds for $x > 0$ and $\operatorname{Ei}(x)$ as defined above.

Examples
========

>>> from sympy import Ei, polar_lift, exp_polar, I, pi
>>> from sympy.abc import x

>>> Ei(-1)
Ei(-1)

This yields a real value:

>>> Ei(-1).n(chop=True)
-0.219383934395520

On the other hand the analytic continuation is not real:

>>> Ei(polar_lift(-1)).n(chop=True)
-0.21938393439552 + 3.14159265358979*I

The exponential integral has a logarithmic branch point at the origin:

>>> Ei(x*exp_polar(2*I*pi))
Ei(x) + 2*I*pi

Differentiation is supported:

>>> Ei(x).diff(x)
exp(x)/x

The exponential integral is related to many other special functions.
For example:

>>> from sympy import expint, Shi
>>> Ei(x).rewrite(expint)
-expint(1, x*exp_polar(I*pi)) - I*pi
>>> Ei(x).rewrite(Shi)
Chi(x) + Shi(x)

See Also
========

expint: Generalised exponential integral.
E1: Special case of the generalised exponential integral.
li: Logarithmic integral.
Li: Offset logarithmic integral.
Si: Sine integral.
Ci: Cosine integral.
Shi: Hyperbolic sine integral.
Chi: Hyperbolic cosine integral.
uppergamma: Upper incomplete gamma function.

References
==========

.. [1] https://dlmf.nist.gov/6.6
.. [2] https://en.wikipedia.org/wiki/Exponential_integral
.. [3] Abramowitz & Stegun, section 5: https://web.archive.org/web/20201128173312/http://people.math.sfu.ca/~cbm/aands/page_228.htm

c                   VP                   '       d   \        P                  # V\        P                  J d   \        P                  # V\        P                  J d   \        P                  # VP                   '       d   \        P                  # VP                  4       w  r#V'       d0   \        V4      ^\        ,          \        ,          V,          ,           # R# r  )	rQ   r   rO   rM   r-   extract_branch_factorr  r	   r
   rX   r{   r.  rb   s   &&  r6   r[   Ei.eval  s    999%%%!**_::!$$$66M999%%%'')b6AaCF1H$$ r8   c                    \        V P                  ^ ,          4      pV^8X  d   \        V4      V,          # \        W4      hrh   )r   r*   r   r   r0   r@   rY   s   && r6   rA   Ei.fdiff  s4    1&q=s8C<$T44r8   c                   < V P                   ^ ,          \        R4      ,          P                  '       d5   \        SV `  V4      \
        \        ,          P	                  V4      ,           # \        SV `  V4      # r   )r*   r   r   r   _eval_evalfr	   r
   )r0   precr   s   &&r6   r  Ei._eval_evalf  sT    IIaLB'4447&t,"/A/A$/GGGw"4((r8   c                n    ^ RI Hp V! ^ \        R4      V,          4      ) \        \        ,          ,
          # )r(   r   r   )r   r   r   r	   r
   r   s   &&, r6   r   Ei._eval_rewrite_as_uppergamma  s)    F 1jnQ.//!B$66r8   c                h    \        ^\        R4      V,          4      ) \        \        ,          ,
          # )r=   r   )r   r   r	   r
   r   s   &&,r6   r   Ei._eval_rewrite_as_expint  s$    q*R.*++ad22r8   c                    \        V\        4      '       d   \        VP                  ^ ,          4      # \        \	        V4      4      # rh   )rR   r   lir*   r   r   s   &&,r6   _eval_rewrite_as_liEi._eval_rewrite_as_li  s1    aaffQi= 
 #a&zr8   c                    VP                   '       d2   \        V4      \        V4      ,           \        \        ,          ,
          # \        V4      \        V4      ,           # r   )is_negativeShiChir	   r
   r   s   &&,r6   _eval_rewrite_as_SiEi._eval_rewrite_as_Si  s8    ===q6CF?QrT))q6CF?"r8   c                8    \        V4      \        V4      ,          # r   )r   _eisr  s   &&&,r6   r   Ei._eval_rewrite_as_tractable  s    1vQr8   c                    ^ RI Hp \        \        RV.4      P                  4      pV! \
        P                  V,          V,          V\
        P                  V34      # r(   )IntegralrZ   )sympy.integrals.integralsr  r   r   namer   Exp1rO   r0   r{   r   r  rZ   s   &&,  r6   _eval_rewrite_as_IntegralEi._eval_rewrite_as_Integral  sE    6'aS1667	!a););Q%?@@r8   c                  < ^ RI Hp V P                  ^ ,          P                  V^ 4      pV P                  ^ ,          P	                  WR7      pVP                  W4      pVP                  '       d   VP                  V4      w  rxVf   \        V4      MTp\        V4      W,          ,           \        ,           V! V4      P                  '       d   \        \        ,          ,
          # \        P                  ,
          # \        S	V `A  WVR7      # )r(   )r   )r   r   )sympyr   r*   r   r   r   rQ   as_coeff_exponentr   r   r  r	   r
   r   r-   r   r   )
r0   r3   r   r   r   x0rY   cer   s
   &&&&     r6   r   Ei._eval_as_leading_term  s    YYq\1%iil**1*8wwq:::((+DA!\3q6tDq6AF?Z/4,,,": :23&&: :w,Q,EEr8   c                   < V P                   ^ ,          P                  V^ 4      pVP                  '       d-   V P                  ! V P                   !  pVP	                  WV4      # \
        SV `  WV4      # rh   )r*   r   rQ   r  _eval_nseriesr   r0   r3   rb   r   r   r  fr   s   &&&&&  r6   r  Ei._eval_nseries  s]    YYq\1%:::(($))4A??1..w$Q400r8   c                  < ^ RI Hp V^ ,          pV\        P                  \        P                  39   d   V P
                  ^ ,          p\        V4       Uu. uF  p\        V4      Wx,          ,          NK  	  upV! ^Wq,          ,          V4      .,           p	\        V4      V,          \        V	!  ,          # \        \        V `3  WW44      # u upi r   )r   r   r   rM   rO   r*   r   r   r   r   r   r  r   rT  s   &&&&&     r6   r   Ei._eval_aseries  s    ,aQZZ!3!344		!A05a911&&91QT61%&'AF1HQ''R,Qq??	 :s   !C
r   r<   r   rh   )r   r   r   r   r   r   r[   rA   r  r   r   r  r  _eval_rewrite_as_Ci_eval_rewrite_as_Chi_eval_rewrite_as_Shir   r  r   r  r   r   r   r   r   s   @@r6   r  r  D  st     Tn % %5)
73#
 ... A

F1
@ 
@r8   r  c                      a a ] tR tRt oRt]R 4       tR tR tR t	R t
R t]t]t]tRV 3R	 lltV 3R
 ltR tRtVtV ;t# )r   i  a
  
Generalized exponential integral.

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

This function is defined as

.. math:: \operatorname{E}_\nu(z) = z^{\nu - 1} \Gamma(1 - \nu, z),

where $\Gamma(1 - \nu, z)$ is the upper incomplete gamma function
(``uppergamma``).

Hence for $z$ with positive real part we have

.. math:: \operatorname{E}_\nu(z)
          =   \int_1^\infty \frac{e^{-zt}}{t^\nu} \mathrm{d}t,

which explains the name.

The representation as an incomplete gamma function provides an analytic
continuation for $\operatorname{E}_\nu(z)$. If $\nu$ is a
non-positive integer, the exponential integral is thus an unbranched
function of $z$, otherwise there is a branch point at the origin.
Refer to the incomplete gamma function documentation for details of the
branching behavior.

Examples
========

>>> from sympy import expint, S
>>> from sympy.abc import nu, z

Differentiation is supported. Differentiation with respect to $z$ further
explains the name: for integral orders, the exponential integral is an
iterated integral of the exponential function.

>>> expint(nu, z).diff(z)
-expint(nu - 1, z)

Differentiation with respect to $\nu$ has no classical expression:

>>> expint(nu, z).diff(nu)
-z**(nu - 1)*meijerg(((), (1, 1)), ((0, 0, 1 - nu), ()), z)

At non-postive integer orders, the exponential integral reduces to the
exponential function:

>>> expint(0, z)
exp(-z)/z
>>> expint(-1, z)
exp(-z)/z + exp(-z)/z**2

At half-integers it reduces to error functions:

>>> expint(S(1)/2, z)
sqrt(pi)*erfc(sqrt(z))/sqrt(z)

At positive integer orders it can be rewritten in terms of exponentials
and ``expint(1, z)``. Use ``expand_func()`` to do this:

>>> from sympy import expand_func
>>> expand_func(expint(5, z))
z**4*expint(1, z)/24 + (-z**3 + z**2 - 2*z + 6)*exp(-z)/24

The generalised exponential integral is essentially equivalent to the
incomplete gamma function:

>>> from sympy import uppergamma
>>> expint(nu, z).rewrite(uppergamma)
z**(nu - 1)*uppergamma(1 - nu, z)

As such it is branched at the origin:

>>> from sympy import exp_polar, pi, I
>>> expint(4, z*exp_polar(2*pi*I))
I*pi*z**3/3 + expint(4, z)
>>> expint(nu, z*exp_polar(2*pi*I))
z**(nu - 1)*(exp(2*I*pi*nu) - 1)*gamma(1 - nu) + expint(nu, z)

See Also
========

Ei: Another related function called exponential integral.
E1: The classical case, returns expint(1, z).
li: Logarithmic integral.
Li: Offset logarithmic integral.
Si: Sine integral.
Ci: Cosine integral.
Shi: Hyperbolic sine integral.
Chi: Hyperbolic cosine integral.
uppergamma

References
==========

.. [1] https://dlmf.nist.gov/8.19
.. [2] https://functions.wolfram.com/GammaBetaErf/ExpIntegralE/
.. [3] https://en.wikipedia.org/wiki/Exponential_integral

c           	        ^ RI HpHp \        V4      pW8w  d   \	        WR4      # VP
                  '       d   V^ 8:  g,   VP
                  '       gP   ^V,          P
                  '       d7   \        \        W!^,
          ,          V! ^V,
          V4      ,          4      4      # VP                  4       w  r&V\        P                  J d   R# VP                  '       d   V^ 8  g   R# \	        W4      ^\        ,          \        ,          V,          \        P                  V^,
          ,          ,          \        V^,
          4      ,          \        V4      V^,
          ,          ,          ,
          # \        ^\        ,          \        ,          V,          V,          4      ^,
          W!^,
          ,          ,          V! ^V,
          4      ,          \	        W4      ,           # )r(   )gammar   N)r   r  r   r   r   
is_Integerr   r  r   r-   
is_integerr
   r	   rP   r   r   )rX   nur{   r  r   nu2rb   s   &&&    r6   r[   expint.evalc  s7   On9#>!===R1WR]]]"?P?P?Pj!VZB5J)JKLL &&(;===6"=B$q&(1==26229R!V3DDZPQ]UWZ[U[E\\] ] !Br	!$q(!1f+5eAFmCfRmSSr8   c           	         V P                   w  r#V^8X  d1   W2^,
          ,          ) \        . ^^.^ ^ ^V,
          .. V4      ,          # V^8X  d   \        V^,
          V4      ) # \        W4      hr<   )r*   r&   r   r   )r0   r@   r  r{   s   &&  r6   rA   expint.fdiffy  sh    		q=QK<QFQ1r6NB JJJ]261%%%$T44r8   c                V    ^ RI Hp W!^,
          ,          V! ^V,
          V4      ,          # r   )r   r   )r0   r  r{   r   r   s   &&&, r6   r   "expint._eval_rewrite_as_uppergamma  s!    F6{:a"fa000r8   c                n   V^8X  dC   \        V\        \        ) \        ,          4      ,          4      ) \        \        ,          ,
          # VP                  '       d   V^8  d   \        V4      ) pWA^,
          ,          \        V^,
          4      ,          \        V4      P                  \         4      ,          \        V4      \        V^,
          4      ,          \        \        V^,
          4       Uu. uF(  p\        W,
          ^,
          4      WE,          ,          NK*  	  up!  ,          ,           # V # u upi r<   )r  r   r	   r
   r  r   r   E1r
  r   r   r   )r0   r  r{   r   r3   rd   s   &&&,  r6   _eval_rewrite_as_Eiexpint._eval_rewrite_as_Ei  s    7qA2b5))**QrT11]]]rAvAAAv;ya00Ar1BBAya((%Q-H-Qi
+AD00-HIJJ J K Is   1.D2c                V    V P                  \        4      P                   ! \        3/ VB # r   )r
  r  r   r   s   &,r6   r!  expint._eval_expand_func  s!    ||B''8%88r8   c                J    V^8w  d   V # \        V4      \        V4      ,
          # r<   )r  r  )r0   r  r{   r   s   &&&,r6   r  expint._eval_rewrite_as_Si  s     7K1vAr8   c                  < V P                   ^ ,          P                  V4      '       g   V P                   ^ ,          pV^8X  d-   V P                  ! V P                   !  pVP                  WV4      # VP                  '       d4   V^8  d-   V P
                  ! V P                   !  pVP                  WV4      # \        SV `  WV4      # rh   )r*   hasr  r  r  r  r   )r0   r3   rb   r   r   r  r  r   s   &&&&&  r6   r  expint._eval_nseries  s    yy|""1BQw,,dii8qT2226,,dii8qT22w$Q400r8   c                  < ^ RI Hp V^,          pV P                  ^ ,          pV\        P                  J d   V P                  ^,          p\        V4       U	u. uF7  p	\        P                  V	,          \        Wy4      ,          W,          ,          NK9  	  up	V! ^W,          ,          V4      .,           p
\        V) 4      V,          \        V
!  ,          # \        \        V `3  WW44      # u up	i r   )r   r   r*   r   rM   r   rP   r   r   r   r   r   r   )r0   rb   r   r3   r   r   r   r  r{   rd   r   r   s   &&&&&      r6   r   expint._eval_aseries  s    ,aYYq\AJJ		!AKPQR8T8a!OB$::QTAA8TX]^_`a`d^dfgXhWiiAGAIa((VT01CC Us   =C)c                    ^ RI Hp V P                  w  rE\        \	        RV4      P
                  4      pV! Wd) ,          \        V) V,          4      ,          V^\        P                  34      # r  )	r  r  r*   r   r   r  r   r   rM   )r0   r*   r   r  rb   r3   rZ   s   &*,    r6   r   expint._eval_rewrite_as_Integral  sS    6yy'T27782QBqD	)Aq!**+=>>r8   r   rh   )r   r   r   r   r   r   r[   rA   r   r  r!  r  r  r  r  r  r   r  r   r   r   r   s   @@r6   r   r     sd     dN T T*51
9 ...	1
D? ?r8   r   c                    \        ^V 4      # )a  
Classical case of the generalized exponential integral.

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

This is equivalent to ``expint(1, z)``.

Examples
========

>>> from sympy import E1
>>> E1(0)
expint(1, 0)

>>> E1(5)
expint(1, 5)

See Also
========

Ei: Exponential integral.
expint: Generalised exponential integral.
li: Logarithmic integral.
Li: Offset logarithmic integral.
Si: Sine integral.
Ci: Cosine integral.
Shi: Hyperbolic sine integral.
Chi: Hyperbolic cosine integral.

)r   )r{   s   &r6   r  r    s    @ !Q<r8   c                      a  ] tR tRt o Rt]R 4       tRR ltR tR t	R t
R tR	 t]tR
 t]tR tR tRR ltRR ltR tRtV tR# )r  i  a  
The classical logarithmic integral.

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

For use in SymPy, this function is defined as

.. math:: \operatorname{li}(x) = \int_0^x \frac{1}{\log(t)} \mathrm{d}t \,.

Examples
========

>>> from sympy import I, oo, li
>>> from sympy.abc import z

Several special values are known:

>>> li(0)
0
>>> li(1)
-oo
>>> li(oo)
oo

Differentiation with respect to $z$ is supported:

>>> from sympy import diff
>>> diff(li(z), z)
1/log(z)

Defining the ``li`` function via an integral:
>>> from sympy import integrate
>>> integrate(li(z))
z*li(z) - Ei(2*log(z))

>>> integrate(li(z),z)
z*li(z) - Ei(2*log(z))


The logarithmic integral can also be defined in terms of ``Ei``:

>>> from sympy import Ei
>>> li(z).rewrite(Ei)
Ei(log(z))
>>> diff(li(z).rewrite(Ei), z)
1/log(z)

We can numerically evaluate the logarithmic integral to arbitrary precision
on the whole complex plane (except the singular points):

>>> li(2).evalf(30)
1.04516378011749278484458888919

>>> li(2*I).evalf(30)
1.0652795784357498247001125598 + 3.08346052231061726610939702133*I

We can even compute Soldner's constant by the help of mpmath:

>>> from mpmath import findroot
>>> findroot(li, 2)
1.45136923488338

Further transformations include rewriting ``li`` in terms of
the trigonometric integrals ``Si``, ``Ci``, ``Shi`` and ``Chi``:

>>> from sympy import Si, Ci, Shi, Chi
>>> li(z).rewrite(Si)
-log(I*log(z)) - log(1/log(z))/2 + log(log(z))/2 + Ci(I*log(z)) + Shi(log(z))
>>> li(z).rewrite(Ci)
-log(I*log(z)) - log(1/log(z))/2 + log(log(z))/2 + Ci(I*log(z)) + Shi(log(z))
>>> li(z).rewrite(Shi)
-log(1/log(z))/2 + log(log(z))/2 + Chi(log(z)) - Shi(log(z))
>>> li(z).rewrite(Chi)
-log(1/log(z))/2 + log(log(z))/2 + Chi(log(z)) - Shi(log(z))

See Also
========

Li: Offset logarithmic integral.
Ei: Exponential integral.
expint: Generalised exponential integral.
E1: Special case of the generalised exponential integral.
Si: Sine integral.
Ci: Cosine integral.
Shi: Hyperbolic sine integral.
Chi: Hyperbolic cosine integral.

References
==========

.. [1] https://en.wikipedia.org/wiki/Logarithmic_integral
.. [2] https://mathworld.wolfram.com/LogarithmicIntegral.html
.. [3] https://dlmf.nist.gov/6
.. [4] https://mathworld.wolfram.com/SoldnersConstant.html

c                   VP                   '       d   \        P                  # V\        P                  J d   \        P                  # V\        P
                  J d   \        P
                  # VP                   '       d   \        P                  # R # r   )rQ   r   r-   rN   rO   rM   r  s   &&r6   r[   li.evalB  sW    99966M!%%Z%%%!**_::99966M r8   c                    V P                   ^ ,          pV^8X  d!   \        P                  \        V4      ,          # \	        W4      hrh   r*   r   rN   r   r   r  s   && r6   rA   li.fdiffM  4    iilq=553s8##$T44r8   c                    V P                   ^ ,          pVP                  '       g    V P                  VP                  4       4      # R# rJ   )r*   r   r/   rj   rz   s   & r6   rl   li._eval_conjugateT  s5    IIaL%%%99Q[[]++ &r8   c                8    \        V4      \        ^4      ,           # r   )Lir  r   s   &&,r6   _eval_rewrite_as_Lili._eval_rewrite_as_LiZ      !ur!u}r8   c                *    \        \        V4      4      # r   )r  r   r   s   &&,r6   r  li._eval_rewrite_as_Ei]  s    #a&zr8   c           	     "   ^ RI Hp V! ^ \        V4      ) 4      ) \        P                  \        \        V4      4      \        \        P
                  \        V4      ,          4      ,
          ,          ,           \        \        V4      ) 4      ,
          # r   )r   r   r   r   r   rN   r   s   &&, r6   r   li._eval_rewrite_as_uppergamma`  s`    FAAw''CFc!%%A,&7789;>Aw<H 	Ir8   c                   \        \        \        V4      ,          4      \        \        \        \        V4      ,          4      ,          ,
          \        P
                  \        \        P                  \        V4      ,          4      \        \        V4      4      ,
          ,          ,
          \        \        \        V4      ,          4      ,
          # r   )Cir	   r   Sir   r   rN   r   s   &&,r6   r  li._eval_rewrite_as_Sie  sp    1SV8qAc!fH~-AEE#a&L)CAK789;>qQx=I 	Jr8   c                   \        \        V4      4      \        \        V4      4      ,
          \        P                  \        \        P
                  \        V4      ,          4      \        \        V4      4      ,
          ,          ,
          # r   )r  r   r  r   r   rN   r   s   &&,r6   r  li._eval_rewrite_as_Shik  sJ    CFc#a&k)AFFCc!f4ECPQF4S,TTUr8   c           	        \        V4      \        RR\        V4      4      ,          \        P                  \        \        V4      4      \        \        P                  \        V4      ,          4      ,
          ,          ,           \
        ,           # )r=   )r=   r=   )r   r   )r   r%   r   r   rN   r   r   s   &&,r6   r   li._eval_rewrite_as_hyperp  sY    AuVVSV44CFc!%%A,&7789;EF 	Gr8   c                   \        \        V4      ) 4      ) \        P                  \        \        P                  \        V4      ,          4      \        \        V4      4      ,
          ,          ,
          \	        RR\        V4      ) 4      ,
          # )r=   )r   r<   ))r(   r(   r   )r   r   r   rN   r&   r   s   &&,r6   r   li._eval_rewrite_as_meijergt  sY    c!fWAEE#a&L(9CAK(G HH*lSVG<= 	>r8   Nc                8    V\        \        V4      4      ,          # r   )r  r   r  s   &&&,r6   r   li._eval_rewrite_as_tractablex  s    4A<r8   c                   V P                   ^ ,          p\        ^V4       Uu. uF,  p\        V4      V,          \        V4      V,          ,          NK.  	  pp\        \        \        V4      4      ,           \        V!  ,           # u upi rh   )r*   r   r   r   r   r   )r0   r3   rb   r   r   r{   rd   r   s   &&&&&   r6   r  li._eval_nseries{  sd    IIaL7<Q{C{!c!fq[IaL1,--{CCAK'#q'11 Ds   2Bc                T    V P                   ^ ,          pVP                  '       d   R# R# rp   r9  rz   s   & r6   r   li._eval_is_zero       IIaL999 r8   r   r<   r   rh   )r   r   r   r   r   r   r[   rA   rl   r  r  r   r  r  r  r  r   r   r   r  r   r   r   r(  s   @r6   r  r    su     `F  5,I
J .V 0G> 2
 r8   r  c                   ^   a  ] tR tRt o Rt]R 4       tRR ltR tR t	RR lt
RR	 ltR
tV tR# )r  i  a  
The offset logarithmic integral.

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

For use in SymPy, this function is defined as

.. math:: \operatorname{Li}(x) = \operatorname{li}(x) - \operatorname{li}(2)

Examples
========

>>> from sympy import Li
>>> from sympy.abc import z

The following special value is known:

>>> Li(2)
0

Differentiation with respect to $z$ is supported:

>>> from sympy import diff
>>> diff(Li(z), z)
1/log(z)

The shifted logarithmic integral can be written in terms of $li(z)$:

>>> from sympy import li
>>> Li(z).rewrite(li)
li(z) - li(2)

We can numerically evaluate the logarithmic integral to arbitrary precision
on the whole complex plane (except the singular points):

>>> Li(2).evalf(30)
0

>>> Li(4).evalf(30)
1.92242131492155809316615998938

See Also
========

li: Logarithmic integral.
Ei: Exponential integral.
expint: Generalised exponential integral.
E1: Special case of the generalised exponential integral.
Si: Sine integral.
Ci: Cosine integral.
Shi: Hyperbolic sine integral.
Chi: Hyperbolic cosine integral.

References
==========

.. [1] https://en.wikipedia.org/wiki/Logarithmic_integral
.. [2] https://mathworld.wolfram.com/LogarithmicIntegral.html
.. [3] https://dlmf.nist.gov/6

c                    V\         P                  J d   \         P                  # V\        ^4      8X  d   \         P                  # R# r  )r   rM   r-   r  s   &&r6   r[   Li.eval  s0    

?::!A$Y66M r8   c                    V P                   ^ ,          pV^8X  d!   \        P                  \        V4      ,          # \	        W4      hrh   r  r  s   && r6   rA   Li.fdiff  r  r8   c                J    V P                  \        4      P                  V4      # r   )r
  r  evalf)r0   r  s   &&r6   r  Li._eval_evalf  s    ||B%%d++r8   c                8    \        V4      \        ^4      ,
          # r   )r  r   s   &&,r6   r  Li._eval_rewrite_as_li  r  r8   Nc                N    V P                  \        4      P                  R RR7      # )r  T)r1   )r
  r  r  s   &&&,r6   r   Li._eval_rewrite_as_tractable  s!    ||B''$'??r8   c                Z    V P                   ! V P                  !  pVP                  WV4      # r   )r  r*   r  )r0   r3   rb   r   r   r  s   &&&&& r6   r  Li._eval_nseries  s'    $$dii0qT**r8   r   r<   r   rh   )r   r   r   r   r   r   r[   rA   r  r  r   r  r   r   r(  s   @r6   r  r    s>     =@  5,@+ +r8   r  c                   `   a a ] tR tRt oRt]R 4       tR	R ltR tR t	R
V 3R llt
RtVtV ;t# )TrigonometricIntegrali  z(Base class for trigonometric integrals. c                   V\         P                  J d   V P                  # V\         P                  J d   V P	                  4       # V\         P
                  J d   V P                  4       # VP                  '       d   V P                  # VP                  \        \        4      4      pVf,   V P                  ^ 4      ^ 8X  d   VP                  \        4      pVe   V P                  V^4      # VP                  \        \        ) 4      4      pVe   V P                  VR4      # VP                  \        R4      4      pVf(   V P                  ^ 4      ^ 8X  d   VP                  R4      pVe   V P                  V4      # VP                  4       w  r#V^ 8X  d	   W!8X  d   R # ^\        ,          \        ,          V,          V P                  ^ 4      ,          V ! V4      ,           # )Nr   )r   r-   _atzerorM   _atinfrO   	_atneginfrQ   rU   r   r	   	_trigfunc_Ifactor_minusfactorr  r
   r  s   &&  r6   r[   TrigonometricIntegral.eval  sl   ;;;!**_::<!$$$==?"999;;''
16:#--*a/++A.B><<A&&''
A27><<B''''
27:#--*a/++B/B>##B'''')6bgtAvaxa((3r722r8   c                    \        V P                  ^ ,          4      pV^8X  d   V P                  V4      V,          # \        W4      hrh   )r   r*   r/  r   r  s   && r6   rA   TrigonometricIntegral.fdiff	  s:    1&q=>>#&s**$T44r8   c                J    V P                  V4      P                  \        4      # r   )r   r
  r  r   s   &&,r6   r  )TrigonometricIntegral._eval_rewrite_as_Ei  s    ++A.66r::r8   c                N    ^ RI Hp V P                  V4      P                  V4      # r   )r   r   r   r
  r   s   &&, r6   r   1TrigonometricIntegral._eval_rewrite_as_uppergamma  s!    F++A.66zBBr8   c                  < V P                   ^ ,          P                  V^ 4      ^ 8w  d   \        SV `  WV4      # V P	                  V4      P                  WV4      pV P	                  ^ 4      ^ 8w  d
   V^,          pVP                  \        R RR7      pV P	                  ^ 4      ^ 8w  d   V\        \        V4      ,           ,          pVP                  WP                   ^ ,          4      P                  WV4      # )r(   c                      W,          V,          # r   r   )rZ   rb   s   &&r6   <lambda>5TrigonometricIntegral._eval_nseries.<locals>.<lambda>  s
    !$q&r8   F)simultaneous)	r*   r   r   r  r/  replacer   r   r   )r0   r3   rb   r   r   
baseseriesr   s   &&&&& r6   r  #TrigonometricIntegral._eval_nseries  s    99Q<Q"a'7(t44^^A&44Q4@
>>!!!OJ''-@u'U
>>!!*s1v--Jq))A,/==aDIIr8   r   r<   rh   )r   r   r   r   r   r   r[   rA   r  r   r  r   r   r   r   s   @@r6   r*  r*    s8     3 3 3>5;C
J 
Jr8   r*  c                      a a ] tR tRt oRt]t]P                  t	]
R 4       t]
R 4       t]
R 4       t]
R 4       tR tR t]tR	 tV 3R
 ltR tRtVtV ;t# )r  i$  a<  
Sine integral.

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

This function is defined by

.. math:: \operatorname{Si}(z) = \int_0^z \frac{\sin{t}}{t} \mathrm{d}t.

It is an entire function.

Examples
========

>>> from sympy import Si
>>> from sympy.abc import z

The sine integral is an antiderivative of $sin(z)/z$:

>>> Si(z).diff(z)
sin(z)/z

It is unbranched:

>>> from sympy import exp_polar, I, pi
>>> Si(z*exp_polar(2*I*pi))
Si(z)

Sine integral behaves much like ordinary sine under multiplication by ``I``:

>>> Si(I*z)
I*Shi(z)
>>> Si(-z)
-Si(z)

It can also be expressed in terms of exponential integrals, but beware
that the latter is branched:

>>> from sympy import expint
>>> Si(z).rewrite(expint)
-I*(-expint(1, z*exp_polar(-I*pi/2))/2 +
     expint(1, z*exp_polar(I*pi/2))/2) + pi/2

It can be rewritten in the form of sinc function (by definition):

>>> from sympy import sinc
>>> Si(z).rewrite(sinc)
Integral(sinc(_t), (_t, 0, z))

See Also
========

Ci: Cosine integral.
Shi: Hyperbolic sine integral.
Chi: Hyperbolic cosine integral.
Ei: Exponential integral.
expint: Generalised exponential integral.
sinc: unnormalized sinc function
E1: Special case of the generalised exponential integral.
li: Logarithmic integral.
Li: Offset logarithmic integral.

References
==========

.. [1] https://en.wikipedia.org/wiki/Trigonometric_integral

c                8    \         \        P                  ,          # r   r
   r   r   rX   s   &r6   r-  	Si._atinfn  s    !&&yr8   c                :    \         ) \        P                  ,          # r   rC  rD  s   &r6   r.  Si._atneginfr  s    s166zr8   c                    \        V4      ) # r   )r  r  s   &&r6   r1  Si._minusfactorv  s    1vr8   c                <    \         \        V4      ,          V,          # r   )r	   r  rX   r{   signs   &&&r6   r0  Si._Ifactorz  s    Qx}r8   c                    \         ^,          \        \        \        4      V,          4      \        \        \        ) 4      V,          4      ,
          ^,          \        ,          ,           # r   )r
   r  r   r	   r   s   &&,r6   r   Si._eval_rewrite_as_expint~  s=    !tr*Q-/*R
A2q0@-AA1DQFFFr8   c                x    ^ RI Hp \        \        RV.4      P                  4      pV! \        V4      V^ V34      # r  )r  r  r   r   r  r$   r  s   &&,  r6   r  Si._eval_rewrite_as_Integral  s6    6'aS1667Q!Q++r8   c                j   V P                   ^ ,          P                  WVR7      pVP                  V^ 4      pV\        P                  J d2   TP                  T^ \        V4      P                  '       d   RMRR7      pVP                  '       d   V# VP                  '       g   V P                  V4      # V # r(   r   r   r   r   r*   r   r   r   rL   r   r   r  rQ   r\  r/   r   s   &&&&  r6   r   Si._eval_as_leading_term  s    iil**1d*Cxx1~155=99Qbh.B.B.Bs9LD<<<J!!!99T?"Kr8   c                t  < ^ RI Hp V^ ,          pV\        P                  J Edw   V P                  ^ ,          p\        V^,          ^,           4       Uu. uFM  p\        P                  V,          \        ^V,          4      ,          V^V,          ^,           ,          ,          NKO  	  upV! ^Wq,          ,          V4      .,           p	\        V^,          4       Uu. uFT  p\        P                  V,          \        ^V,          ^,           4      ,          V^V^,           ,          ,          ,          NKV  	  upV! ^Wq,          ,          V4      .,           p
\        ^,          \        V4      \        V	!  ,          ,
          \        V4      \        V
!  ,          ,
          # \        \        V `;  WW44      # u upi u upi r   )r   r   r   rM   r*   r   rP   r   r
   r"   r   r#   r   r  r   )r0   rb   r   r3   r   r   r   r{   rd   pqr   s   &&&&&      r6   r   Si._eval_aseries  sP   ,a AJJ		!A"1a4!8_., !IacN2Q1q\AA,.16qvq1A0BCA #1a4[*( !IacAg$66QAYGG(*-21QT61-=,>?Aa4#a&a.(3q6#q'>99 R,Qq??.*s   AF0AF5c                T    V P                   ^ ,          pVP                  '       d   R# R# rp   r9  rz   s   & r6   r   Si._eval_is_zero  r  r8   r   )r   r   r   r   r   r#   r/  r   r-   r,  r   r-  r.  r1  r0  r   r  _eval_rewrite_as_sincr   r   r   r   r   r   r   s   @@r6   r  r  $  s     DL IffG       G,
 7@  r8   r  c                      a a ] tR tRt oRt]t]P                  t	]
R 4       t]
R 4       t]
R 4       t]
R 4       tR tR tR	 tV 3R
 ltRtVtV ;t# )r  i  a
  
Cosine integral.

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

This function is defined for positive $x$ by

.. math:: \operatorname{Ci}(x) = \gamma + \log{x}
                     + \int_0^x \frac{\cos{t} - 1}{t} \mathrm{d}t
       = -\int_x^\infty \frac{\cos{t}}{t} \mathrm{d}t,

where $\gamma$ is the Euler-Mascheroni constant.

We have

.. math:: \operatorname{Ci}(z) =
    -\frac{\operatorname{E}_1\left(e^{i\pi/2} z\right)
           + \operatorname{E}_1\left(e^{-i \pi/2} z\right)}{2}

which holds for all polar $z$ and thus provides an analytic
continuation to the Riemann surface of the logarithm.

The formula also holds as stated
for $z \in \mathbb{C}$ with $\Re(z) > 0$.
By lifting to the principal branch, we obtain an analytic function on the
cut complex plane.

Examples
========

>>> from sympy import Ci
>>> from sympy.abc import z

The cosine integral is a primitive of $\cos(z)/z$:

>>> Ci(z).diff(z)
cos(z)/z

It has a logarithmic branch point at the origin:

>>> from sympy import exp_polar, I, pi
>>> Ci(z*exp_polar(2*I*pi))
Ci(z) + 2*I*pi

The cosine integral behaves somewhat like ordinary $\cos$ under
multiplication by $i$:

>>> from sympy import polar_lift
>>> Ci(polar_lift(I)*z)
Chi(z) + I*pi/2
>>> Ci(polar_lift(-1)*z)
Ci(z) + I*pi

It can also be expressed in terms of exponential integrals:

>>> from sympy import expint
>>> Ci(z).rewrite(expint)
-expint(1, z*exp_polar(-I*pi/2))/2 - expint(1, z*exp_polar(I*pi/2))/2

See Also
========

Si: Sine integral.
Shi: Hyperbolic sine integral.
Chi: Hyperbolic cosine integral.
Ei: Exponential integral.
expint: Generalised exponential integral.
E1: Special case of the generalised exponential integral.
li: Logarithmic integral.
Li: Offset logarithmic integral.

References
==========

.. [1] https://en.wikipedia.org/wiki/Trigonometric_integral

c                "    \         P                  # r   )r   r-   rD  s   &r6   r-  	Ci._atinf  s    vvr8   c                $    \         \        ,          # r   )r	   r
   rD  s   &r6   r.  Ci._atneginf  s    tr8   c                D    \        V4      \        \        ,          ,           # r   r  r	   r
   r  s   &&r6   r1  Ci._minusfactor  s    !uqt|r8   c                `    \        V4      \        \        ,          ^,          V,          ,           # r   r  r	   r
   rK  s   &&&r6   r0  Ci._Ifactor  s    1v"Qt##r8   c                    \        \        \        4      V,          4      \        \        \        ) 4      V,          4      ,           ) ^,          # r   )r  r   r	   r   s   &&,r6   r   Ci._eval_rewrite_as_expint  s2    JqM!O$r*aR.*:';;<Q>>r8   c                    ^ RI Hp \        \        RV.4      P                  4      p\
        P                  \        V4      ,           V! ^\        V4      ,
          V,          V^ V34      ,
          # r  )	r  r  r   r   r  r   r   r   r"   r  s   &&,  r6   r  Ci._eval_rewrite_as_Integral  sP    6'aS1667||c!f$x3q61q!Qi'HHHr8   c                   V P                   ^ ,          P                  WVR7      pVP                  V^ 4      pV\        P                  J d2   TP                  T^ \        V4      P                  '       d   RMRR7      pVP                  '       dH   VP                  V4      w  rgVf   \        V4      MTp\        V4      Wr,          ,           \        ,           # VP                  '       d   V P                  V4      # V # rS  r*   r   r   r   rL   r   r   r  rQ   r  r   r   ry   r/   r0   r3   r   r   rY   r   r  r  s   &&&&    r6   r   Ci._eval_as_leading_term      iil**1d*Cxx1~155=99Qbh.B.B.Bs9LD<<<((+DA!\3q6tDq6AF?Z//^^^99T?"Kr8   c                  < ^ RI Hp V^ ,          pV\        P                  \        P                  39   Ed   V P
                  ^ ,          p\        V^,          ^,           4       Uu. uFM  p\        P                  V,          \        ^V,          4      ,          V^V,          ^,           ,          ,          NKO  	  upV! ^Wq,          ,          V4      .,           p	\        V^,          4       Uu. uFT  p\        P                  V,          \        ^V,          ^,           4      ,          V^V^,           ,          ,          ,          NKV  	  upV! ^Wq,          ,          V4      .,           p
\        V4      \        V	!  ,          \        V4      \        V
!  ,          ,
          pV\        P                  J d   V\        \        ,          ,          pV# \        \        V `C  WW44      # u upi u upi r   )r   r   r   rM   rO   r*   r   rP   r   r#   r   r"   r	   r
   r   r  r   )r0   rb   r   r3   r   r   r   r{   rd   rW  rX  resultr   s   &&&&&       r6   r   Ci._eval_aseries&  so   ,aQZZ!3!344		!A"1a4!8_., !IacN2Q1q\AA,.16qvq1A0BCA #1a4[*( !IacAg$66QAYGG(*-21QT61-=,>?AVS!W%AQ(88F***!B$MR,Qq??.*s   %AG+AG"r   )r   r   r   r   r   r"   r/  r   r   r,  r   r-  r.  r1  r0  r   r  r   r   r   r   r   r   s   @@r6   r  r    s     M^ IG      $ $?I
@ @r8   r  c                      a  ] tR tRt o Rt]t]P                  t	]
R 4       t]
R 4       t]
R 4       t]
R 4       tR tR tR	 tR
tV tR# )r  i8  ai  
Sinh integral.

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

This function is defined by

.. math:: \operatorname{Shi}(z) = \int_0^z \frac{\sinh{t}}{t} \mathrm{d}t.

It is an entire function.

Examples
========

>>> from sympy import Shi
>>> from sympy.abc import z

The Sinh integral is a primitive of $\sinh(z)/z$:

>>> Shi(z).diff(z)
sinh(z)/z

It is unbranched:

>>> from sympy import exp_polar, I, pi
>>> Shi(z*exp_polar(2*I*pi))
Shi(z)

The $\sinh$ integral behaves much like ordinary $\sinh$ under
multiplication by $i$:

>>> Shi(I*z)
I*Si(z)
>>> Shi(-z)
-Shi(z)

It can also be expressed in terms of exponential integrals, but beware
that the latter is branched:

>>> from sympy import expint
>>> Shi(z).rewrite(expint)
expint(1, z)/2 - expint(1, z*exp_polar(I*pi))/2 - I*pi/2

See Also
========

Si: Sine integral.
Ci: Cosine integral.
Chi: Hyperbolic cosine integral.
Ei: Exponential integral.
expint: Generalised exponential integral.
E1: Special case of the generalised exponential integral.
li: Logarithmic integral.
Li: Offset logarithmic integral.

References
==========

.. [1] https://en.wikipedia.org/wiki/Trigonometric_integral

c                "    \         P                  # r   r   rM   rD  s   &r6   r-  
Shi._atinf{      zzr8   c                "    \         P                  # r   )r   rO   rD  s   &r6   r.  Shi._atneginf  s    !!!r8   c                    \        V4      ) # r   )r  r  s   &&r6   r1  Shi._minusfactor  s    Awr8   c                <    \         \        V4      ,          V,          # r   )r	   r  rK  s   &&&r6   r0  Shi._Ifactor  s    Awt|r8   c                    \        V4      \        \        \        \        ,          4      V,          4      ,
          ^,          \        \        ,          ^,          ,
          # r   )r  r   r	   r
   r   s   &&,r6   r   Shi._eval_rewrite_as_expint  s5    19QrT?1,--q01R4699r8   c                T    V P                   ^ ,          pVP                  '       d   R# R# rp   r9  rz   s   & r6   r   Shi._eval_is_zero  r  r8   c                f   V P                   ^ ,          P                  V4      pVP                  V^ 4      pV\        P                  J d2   TP                  T^ \        V4      P                  '       d   RMRR7      pVP                  '       d   V# VP                  '       g   V P                  V4      # V # )r(   r   r   r   rT  r   s   &&&&  r6   r   Shi._eval_as_leading_term  s    iil**1-xx1~155=99Qbh.B.B.Bs9LD<<<J!!!99T?"Kr8   r   N)r   r   r   r   r   r!   r/  r   r-   r,  r   r-  r.  r1  r0  r   r   r   r   r   r(  s   @r6   r  r  8  s}     =~ IffG  " "    :
 r8   r  c                      a  ] tR tRt o Rt]t]P                  t	]
R 4       t]
R 4       t]
R 4       t]
R 4       tR tR tR	tV tR
# )r  i  aX  
Cosh integral.

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

This function is defined for positive $x$ by

.. math:: \operatorname{Chi}(x) = \gamma + \log{x}
                     + \int_0^x \frac{\cosh{t} - 1}{t} \mathrm{d}t,

where $\gamma$ is the Euler-Mascheroni constant.

We have

.. math:: \operatorname{Chi}(z) = \operatorname{Ci}\left(e^{i \pi/2}z\right)
                     - i\frac{\pi}{2},

which holds for all polar $z$ and thus provides an analytic
continuation to the Riemann surface of the logarithm.
By lifting to the principal branch we obtain an analytic function on the
cut complex plane.

Examples
========

>>> from sympy import Chi
>>> from sympy.abc import z

The $\cosh$ integral is a primitive of $\cosh(z)/z$:

>>> Chi(z).diff(z)
cosh(z)/z

It has a logarithmic branch point at the origin:

>>> from sympy import exp_polar, I, pi
>>> Chi(z*exp_polar(2*I*pi))
Chi(z) + 2*I*pi

The $\cosh$ integral behaves somewhat like ordinary $\cosh$ under
multiplication by $i$:

>>> from sympy import polar_lift
>>> Chi(polar_lift(I)*z)
Ci(z) + I*pi/2
>>> Chi(polar_lift(-1)*z)
Chi(z) + I*pi

It can also be expressed in terms of exponential integrals:

>>> from sympy import expint
>>> Chi(z).rewrite(expint)
-expint(1, z)/2 - expint(1, z*exp_polar(I*pi))/2 - I*pi/2

See Also
========

Si: Sine integral.
Ci: Cosine integral.
Shi: Hyperbolic sine integral.
Ei: Exponential integral.
expint: Generalised exponential integral.
E1: Special case of the generalised exponential integral.
li: Logarithmic integral.
Li: Offset logarithmic integral.

References
==========

.. [1] https://en.wikipedia.org/wiki/Trigonometric_integral

c                "    \         P                  # r   rv  rD  s   &r6   r-  
Chi._atinf  rx  r8   c                "    \         P                  # r   rv  rD  s   &r6   r.  Chi._atneginf  rx  r8   c                D    \        V4      \        \        ,          ,           # r   rf  r  s   &&r6   r1  Chi._minusfactor  s    1v"}r8   c                `    \        V4      \        \        ,          ^,          V,          ,           # r   rc  rK  s   &&&r6   r0  Chi._Ifactor  s    !uqtAvd{""r8   c                    \         ) \        ,          ^,          \        V4      \        \        \         \        ,          4      V,          4      ,           ^,          ,
          # r   )r	   r
   r  r   r   s   &&,r6   r   Chi._eval_rewrite_as_expint 	  s7    r"uQw"Q%"Yqt_Q%6"77:::r8   c                   V P                   ^ ,          P                  WVR7      pVP                  V^ 4      pV\        P                  J d2   TP                  T^ \        V4      P                  '       d   RMRR7      pVP                  '       dH   VP                  V4      w  rgVf   \        V4      MTp\        V4      Wr,          ,           \        ,           # VP                  '       d   V P                  V4      # V # rS  rm  rn  s   &&&&    r6   r   Chi._eval_as_leading_term	  rp  r8   r   N)r   r   r   r   r   r    r/  r   r   r,  r   r-  r.  r1  r0  r   r   r   r   r(  s   @r6   r  r    s{     HT IG      # #; r8   r  c                   \   a  ] tR tRt o RtRt]R 4       tRR ltR t	]	t
R tR t]tR	tV tR
# )FresnelIntegrali	  z%Base class for the Fresnel integrals.Tc                   V\         P                  J d   \         P                  # VP                  '       d   \         P                  # \         P
                  pTpR pVP                  R4      pVe   V) pTpRpVP                  \        4      pVe#   V P                  \        ,          V,          pTpRpV'       d   W ! V4      ,          # R# )FNTr   )	r   rM   r   rQ   r-   rN   rU   r	   _sign)rX   r{   prefactnewargchangedr.  s   &&    r6   r[   FresnelIntegral.eval	  s     

?66M 99966M %%,,R0>hGFG,,Q/>iik')GFG3v;&& r8   c                    V^8X  dJ   V P                  \        P                  \        ,          V P                  ^ ,          ^,          ,          4      # \        W4      hr<   )r/  r   r   r
   r*   r   r?   s   &&r6   rA   FresnelIntegral.fdiff;	  s<    q=>>!&&)DIIaL!O";<<$T44r8   c                <    V P                   ^ ,          P                  # rh   rq   rk   s   &r6   r5  &FresnelIntegral._eval_is_extended_realA	  r7  r8   c                <    V P                   ^ ,          P                  # rh   r9  rk   s   &r6   r   FresnelIntegral._eval_is_zeroF	  r;  r8   c                b    V P                  V P                  ^ ,          P                  4       4      # rh   ri   rk   s   &r6   rl   FresnelIntegral._eval_conjugateI	  rn   r8   r   Nr<   )r   r   r   r   r   r   r   r[   rA   r5  r|   r   rl   r7   r.   r   r   r(  s   @r6   r  r  	  sA     0J' '<5- -O$3 -Lr8   r  c                      a a ] tR tRt oRt]t]P                  ) t	]
]R 4       4       tR tR tR tR tR tV 3R	 ltR
tVtV ;t# )r   iO	  a  
Fresnel integral S.

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

This function is defined by

.. math:: \operatorname{S}(z) = \int_0^z \sin{\frac{\pi}{2} t^2} \mathrm{d}t.

It is an entire function.

Examples
========

>>> from sympy import I, oo, fresnels
>>> from sympy.abc import z

Several special values are known:

>>> fresnels(0)
0
>>> fresnels(oo)
1/2
>>> fresnels(-oo)
-1/2
>>> fresnels(I*oo)
-I/2
>>> fresnels(-I*oo)
I/2

In general one can pull out factors of -1 and $i$ from the argument:

>>> fresnels(-z)
-fresnels(z)
>>> fresnels(I*z)
-I*fresnels(z)

The Fresnel S integral obeys the mirror symmetry
$\overline{S(z)} = S(\bar{z})$:

>>> from sympy import conjugate
>>> conjugate(fresnels(z))
fresnels(conjugate(z))

Differentiation with respect to $z$ is supported:

>>> from sympy import diff
>>> diff(fresnels(z), z)
sin(pi*z**2/2)

Defining the Fresnel functions via an integral:

>>> from sympy import integrate, pi, sin, expand_func
>>> integrate(sin(pi*z**2/2), z)
3*fresnels(z)*gamma(3/4)/(4*gamma(7/4))
>>> expand_func(integrate(sin(pi*z**2/2), z))
fresnels(z)

We can numerically evaluate the Fresnel integral to arbitrary precision
on the whole complex plane:

>>> fresnels(2).evalf(30)
0.343415678363698242195300815958

>>> fresnels(-2*I).evalf(30)
0.343415678363698242195300815958*I

See Also
========

fresnelc: Fresnel cosine integral.

References
==========

.. [1] https://en.wikipedia.org/wiki/Fresnel_integral
.. [2] https://dlmf.nist.gov/7
.. [3] https://mathworld.wolfram.com/FresnelIntegrals.html
.. [4] https://functions.wolfram.com/GammaBetaErf/FresnelS
.. [5] The converging factors for the fresnel integrals
        by John W. Wrench Jr. and Vicki Alley

c                   V ^ 8  d   \         P                  # \        V4      p\        V4      ^8  dz   VR,          p\        ^,          ) V^,          ,          ^V ,          ^,
          ,          ^V ,          ^V ,          ^,           ,          ^V ,          ^,           ,          ,          V,          # V^,          V^,          ) V ,          ,          \        ^4      RV ,          ^,
          ,          \        ^V ,          ^,           ,          ,          ,          ^V ,          ^,           \        ^V ,          ^,           4      ,          ,          # r(   r   r_   r   r-   r   r`   r
   r   rb   r3   rc   rW  s   &&* r6   re   fresnels.taylor_term	  s     q566M
A>"Q&"2&Qq!tQqS1W-qsAaC!G}acAg/FG1LL!t1uqj(AaD2a4!8,<R!A#'],JKPQRSPSVWPWYbcdefcfijcjYkOkllr8   c           	        \         P                  \        ,           ^,          \        \         P                  \        ,           ^,          \	        \
        4      ,          V,          4      \        \        \         P                  \        ,
          ^,          \	        \
        4      ,          V,          4      ,          ,
          ,          #    r   rN   r	   r:   r   r
   r   s   &&,r6   r  fresnels._eval_rewrite_as_erf	  f    	1}QUUQYM$r($:1$< =#quuqyRSmTXY[T\F\]^F^B_@_ _``r8   c           	         \         V^,          ,          ^,          \        \        ^^4      .\        ^^4      \        ^^4      .\         ^,          ) V^,          ,          ^,          4      ,          #    )r
   r%   r   r   s   &&,r6   r   fresnels._eval_rewrite_as_hyper	  sY    !Q$wqy5(1a.!1HQNHQPQN3SVXZ[V[U[\]_`\`U`acUcdddr8   c           
     h   \         V\        ^	^4      ,          ,          \        ^4      V^,          \        ^^4      ,          ,          V) \        ^^4      ,          ,          ,          \        . ^.\        ^^4      .\        ^^4      ^ .\         ^,          ) V^,          ,          ^,          4      ,          # )	   )r
   r   r   r&   r   s   &&,r6   r   !fresnels._eval_rewrite_as_meijerg	  s    1hq!n$$QAA0F(FXVWYZ^G[([\"qcHQN#3hq!na5H2q5&QRTUQU+VX.YZ 	[r8   c                    ^ RI Hp \        \        RV.4      P                  4      pV! \        \        V^,          ,          ^,          4      V^ V34      # r  )r  r  r   r   r  r#   r
   r  s   &&,  r6   r  "fresnels._eval_rewrite_as_Integral	  B    6'aS1667Bq!tGAIAq	22r8   c                B   ^ RI Hp V P                  ^ ,          P                  WVR7      pVP	                  V^ 4      pV\
        P                  J d2   TP                  T^ \        V4      P                  '       d   RMRR7      pVP                  '       d   \        V^,          ,          ^,          # V\
        P                  \
        P                  39   d=   V\
        P                  J d   ^MRpV\
        P                  ,          V! W4      ,           # V P                  V4      # r(   r   r   r   r   r   r   )r   r   r*   r   r   r   r   r   r   r  rQ   r
   rM   rO   r   r/   r0   r3   r   r   r   rY   r   r   s   &&&&    r6   r   fresnels._eval_as_leading_term	  s    ,iil**1d*Cxx1~1$$$99Qbh.B.B.Bs9LD<<<c1f9Q;ajj!"4"455QZZ'RAQVV8eAk))99T?"r8   c           
     ~  < ^ RI Hp V^ ,          pV\        P                  \        P                  ) 39   Ed   V P                  ^ ,          p\        ^ V4       Uu. uF  p^V,          ^,           V8  g   K  \        P                  V,          \        ^V,          ^,           4      ,          ^^V,          ^,           ,          V^V,          ^,           ,          ,          ^^V,          ,          ,          \        ^V,          4      ,          ,          NK  	  p	p^^V,          ,          .\        ^V4       Uu. uF  p^V,          ^,           V8  g   K  \        P                  V,          \        ^V,          ^,
          4      ,          ^^V,          ^,           ,          V^V,          ^,           ,          ,          ^^V,          ^,
          ,          ,          \        ^V,          ^,
          4      ,          ,          NK  	  up,           p
V	 Uu. uF!  p\        ^\        ,          4      ) V,          NK#  	  p	pV
 Uu. uF!  p\        ^\        ,          4      ) V,          NK#  	  p
pV\        P                  J d   ^MRpV\        P                  ,          \        V^,          4      \        V	!  ,          \        V^,          4      \        V
!  ,          ,           P                  V\        ^\        ,          4      V,          4      ,           V! ^Wq,          ,          V4      ,           # \        SV `A  WW44      # u upi u upi u upi u upi r(   r   r   )r   r   r   rM   r*   r   rP   r   r   r
   r   r#   r   r"   r   r   r   r0   rb   r   r3   r   r   r   r{   rd   rW  rX  rZ   r   r   s   &&&&&        r6   r   fresnels._eval_aseries	  sp   ,a QZZ!**--		!A  1+6%Q1q1I!IacAg$66acAg,QqS1W-AaC81Q3GI I%  6 AaC	1+6%Q1q1QQ]]A-	!A#'0BBacAg,QqS1W-AaC!G<YqsQw=OOQ Q%6 6A )**1$qt*QA*()*1$qt*QA*ajj(bA QVV8s1a4ya03q!t9S!W3DD$q$qt*Q,'(*/!$*:; ; w$Qq77#66 +*s&   L+5BL+2L0B+L0'L53'L:r   )r   r   r   r   r   r#   r/  r   rN   r  r   r   re   r  r   r   r  r   r   r   r   r   r   s   @@r6   r   r   O	  s`     Sh IUUFE	m  	mae[3
#8 8r8   r   c                      a a ] tR tRt oRt]t]P                  t	]
]R 4       4       tR tR tR tR tR tV 3R	 ltR
tVtV ;t# )r   i	  a  
Fresnel integral C.

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

This function is defined by

.. math:: \operatorname{C}(z) = \int_0^z \cos{\frac{\pi}{2} t^2} \mathrm{d}t.

It is an entire function.

Examples
========

>>> from sympy import I, oo, fresnelc
>>> from sympy.abc import z

Several special values are known:

>>> fresnelc(0)
0
>>> fresnelc(oo)
1/2
>>> fresnelc(-oo)
-1/2
>>> fresnelc(I*oo)
I/2
>>> fresnelc(-I*oo)
-I/2

In general one can pull out factors of -1 and $i$ from the argument:

>>> fresnelc(-z)
-fresnelc(z)
>>> fresnelc(I*z)
I*fresnelc(z)

The Fresnel C integral obeys the mirror symmetry
$\overline{C(z)} = C(\bar{z})$:

>>> from sympy import conjugate
>>> conjugate(fresnelc(z))
fresnelc(conjugate(z))

Differentiation with respect to $z$ is supported:

>>> from sympy import diff
>>> diff(fresnelc(z), z)
cos(pi*z**2/2)

Defining the Fresnel functions via an integral:

>>> from sympy import integrate, pi, cos, expand_func
>>> integrate(cos(pi*z**2/2), z)
fresnelc(z)*gamma(1/4)/(4*gamma(5/4))
>>> expand_func(integrate(cos(pi*z**2/2), z))
fresnelc(z)

We can numerically evaluate the Fresnel integral to arbitrary precision
on the whole complex plane:

>>> fresnelc(2).evalf(30)
0.488253406075340754500223503357

>>> fresnelc(-2*I).evalf(30)
-0.488253406075340754500223503357*I

See Also
========

fresnels: Fresnel sine integral.

References
==========

.. [1] https://en.wikipedia.org/wiki/Fresnel_integral
.. [2] https://dlmf.nist.gov/7
.. [3] https://mathworld.wolfram.com/FresnelIntegrals.html
.. [4] https://functions.wolfram.com/GammaBetaErf/FresnelC
.. [5] The converging factors for the fresnel integrals
        by John W. Wrench Jr. and Vicki Alley

c                L   V ^ 8  d   \         P                  # \        V4      p\        V4      ^8  dz   VR,          p\        ^,          ) V^,          ,          ^V ,          ^,
          ,          ^V ,          ^V ,          ^,
          ,          ^V ,          ^,           ,          ,          V,          # W^,          ) V ,          ,          \        ^4      RV ,          ,          \        ^V ,          ,          ,          ,          ^V ,          ^,           \        ^V ,          4      ,          ,          # r  r  r  s   &&* r6   re   fresnelc.taylor_termH
  s     q566M
A>"Q&"2&Qq!tQqS1W-qsAaC!G}acAg/FG1LLTEA:~11b1Q3i)?@QqS1WiXYZ[X[nD\]]r8   c           	        \         P                  \        ,
          ^,          \        \         P                  \        ,           ^,          \	        \
        4      ,          V,          4      \        \        \         P                  \        ,
          ^,          \	        \
        4      ,          V,          4      ,          ,           ,          # r  r  r   s   &&,r6   r  fresnelc._eval_rewrite_as_erfU
  r  r8   c           	         V\        \        ^^4      .\        P                  \        ^^4      .\        ^,          ) V^,          ,          ^,          4      ,          # r<   )r%   r   r   r   r
   r   s   &&,r6   r   fresnelc._eval_rewrite_as_hyperX
  sA    5(1a.)AFFHQN+Cb!eVAqD[QS^TTTr8   c           
     L   \         V\        ^^4      ,          ,          \        ^4      \        V^,          ^4      ,          \        V) ^4      ,          ,          \	        . ^.\        ^^4      .\        ^^4      ^ .\         ^,          ) V^,          ,          ^,          4      ,          # r  )r
   r   r   r   r&   r   s   &&,r6   r   !fresnelc._eval_rewrite_as_meijerg[
  s    1hq!n$$QQT1(=dA2qk(IJ"qcHQN#3hq!na5H2q5&QRTUQU+VX.YZ 	[r8   c                    ^ RI Hp \        \        RV.4      P                  4      pV! \        \        V^,          ,          ^,          4      V^ V34      # r  )r  r  r   r   r  r"   r
   r  s   &&,  r6   r  "fresnelc._eval_rewrite_as_Integral_
  r  r8   c                   ^ RI Hp V P                  ^ ,          P                  WVR7      pVP	                  V^ 4      pV\
        P                  J d2   TP                  T^ \        V4      P                  '       d   RMRR7      pVP                  '       d   V# V\
        P                  \
        P                  39   d=   V\
        P                  J d   ^MRpV\
        P                  ,          V! W4      ,           # V P                  V4      # r  )r   r   r*   r   r   r   r   r   r   r  rQ   rM   rO   r   r/   r  s   &&&&    r6   r   fresnelc._eval_as_leading_termd
  s    ,iil**1d*Cxx1~1$$$99Qbh.B.B.Bs9LD<<<Jajj!"4"455QZZ'RAQVV8eAk))99T?"r8   c           
     z  < ^ RI Hp V^ ,          pV\        P                  \        P                  ) 39   Ed   V P                  ^ ,          p\        V4       Uu. uF  p^V,          ^,           V8  g   K  \        P                  V,          \        ^V,          ^,           4      ,          ^^V,          ^,           ,          V^V,          ^,           ,          ,          ^^V,          ,          ,          \        ^V,          4      ,          ,          NK  	  p	p^^V,          ,          .\        ^V4       Uu. uF  p^V,          ^,           V8  g   K  \        P                  V,          \        ^V,          ^,
          4      ,          ^^V,          ^,           ,          V^V,          ^,           ,          ,          ^^V,          ^,
          ,          ,          \        ^V,          ^,
          4      ,          ,          NK  	  up,           p
V	 Uu. uF!  p\        ^\        ,          4      ) V,          NK#  	  p	pV
 Uu. uF   p\        ^\        ,          4      V,          NK"  	  p
pV\        P                  J d   ^MRpV\        P                  ,          \        V^,          4      \        V	!  ,          \        V^,          4      \        V
!  ,          ,           P                  V\        ^\        ,          4      V,          4      ,           V! ^Wq,          ,          V4      ,           # \        SV `A  WW44      # u upi u upi u upi u upi r  )r   r   r   rM   r*   r   rP   r   r   r
   r   r"   r   r#   r   r   r   r  s   &&&&&        r6   r   fresnelc._eval_aseriess
  sl   ,a QZZ!**--		!A  (3"QacAgkI!IacAg$66acAg,QqS1W-AaC81Q3GI I"  3 AaC	1+6%Q1q1QQ]]A-	!A#'0BBacAg,QqS1W-AaC!G<YqsQw=OOQ Q%6 6A )**1$qt*QA*()*1$qt*Q,,A*ajj(bA QVV8s1a4ya03q!t9S!W3DD$q$qt*Q,'(*/!$*:; ; w$Qq77#36 +*s&   L)4BL)1L.B+L.'L32&L8r   )r   r   r   r   r   r"   r/  r   rN   r  r   r   re   r  r   r   r  r   r   r   r   r   r   s   @@r6   r   r   	  s^     Sh IEEE	^  	^aU[3
#8 8r8   r   c                   V   a a ] tR tRt oRt]R 4       tV 3R ltRR ltR t	Rt
VtV ;t# )	r   i
  z]
Helper function to make the $\mathrm{erf}(z)$ function
tractable for the Gruntz algorithm.

c                J    VP                   '       d   \        P                  # R # r   )rQ   r   rN   )rX   rY   s   &&r6   r[   
_erfs.eval
  s    ;;;55L r8   c                t  < ^ RI Hp V^ ,          pV\        P                  J d   V P                  ^ ,          p\        V4       Uu. uF|  p^\        \        4      ,          \        ^V,          4      ,          \        ^4      ) V) ,          ,          \        V4      ,          ^V,          ^V,          ^,           ,          ,          NK~  	  p	pV! ^V^V,          ^,           ,          ,          V4      p
\        V	!  P                  W1V4      V
,           # VP                  \        4      pV\        P                  J d   V P                  ^ ,          p\        V4       Uu. uF|  p^\        \        4      ,          \        ^V,          4      ,          \        ^4      ) V) ,          ,          \        V4      ,          ^V,          ^V,          ^,           ,          ,          NK~  	  p	pV! ^V^V,          ^,           ,          ,          V4      p
\        V	!  P                  W1V4      V
,           # \        SV `9  WW44      # u upi u upi r   )r   r   r   rM   r*   r   r   r
   r   r   r  rU   r	   r   r   )r0   rb   r   r3   r   r   r   r{   rd   lorZ   r   s   &&&&&       r6   r   _erfs._eval_aseries
  s   ,a AJJ		!ADI!HNDLq 48i!n,q0 /r. $Q<(+,Q3!A#'*:; ;DL  NaAaC!Gna(AG**16:: **1-

?		!A EJ!HNDLq 48i!n,q0 /r. $Q<(+,Q3!A#'*:; ;DL  NaAaC!Gna(AG**16:: w$Qq77%NNs   BH0BH5c                    V^8X  dH   V P                   ^ ,          pR\        \        4      ,          ^V,          \        V4      ,          ,           # \	        W4      hr   )r*   r   r
   r   r   r0   r@   r{   s   && r6   rA   _erfs.fdiff
  s@    q=		!Ad2h;1U1X--$T44r8   c                p    \         P                  \        V4      ,
          \        V^,          4      ,          # r   )r   rN   r:   r   r   s   &&,r6   _eval_rewrite_as_intractable"_erfs._eval_rewrite_as_intractable
  s!    AAqD	))r8   r   r<   )r   r   r   r   r   r   r[   r   rA   r  r   r   r   r   s   @@r6   r   r   
  s2     
  865* *r8   r   c                   b   a a ] tR tRt oRtV 3R ltR	R ltR tV 3R ltR
V 3R llt	Rt
VtV ;t# )r  i
  zr
Helper function to make the $\mathrm{Ei}(z)$ and $\mathrm{li}(z)$
functions tractable for the Gruntz algorithm.

c                  < ^ RI Hp V^ ,          \        P                  \        P                  39  d   \
        S
V `  WW44      # V P                  ^ ,          p\        V4       Uu. uF*  p\        V4      ^V,          V^,           ,          ,          NK,  	  ppV! ^Wa^,           ,          ,          V4      p	\        V!  P                  W1V4      V	,           # u upi r   )r   r   r   rM   rO   r   r   r*   r   r   r   r  )r0   rb   r   r3   r   r   r{   rd   r  r  r   s   &&&&&     r6   r   _eis._eval_aseries
  s    ,8AJJ(:(:;;7(1;;IIaL49!H=HqYq\QqSAEN**H=!AAJ,"Q&&qT2Q66 >s   $0Cc                    V^8X  d;   V P                   ^ ,          p\        P                  V,          \        V4      ,
          # \	        W4      hr<   )r*   r   rN   r  r   r  s   && r6   rA   
_eis.fdiff
  s8    q=		!A5519tAw&&$T44r8   c                :    \        V) 4      \        V4      ,          # r   )r   r  r   s   &&,r6   r  !_eis._eval_rewrite_as_intractable
  s    A2wr!u}r8   c                   < V P                   ^ ,          P                  V^ 4      pVP                  '       d.   V P                  ! V P                   !  pVP	                  WVR7      # \
        SV `  WVR7      # rQ  )r*   r   rQ   r  r   r   )r0   r3   r   r   r  r  r   s   &&&&  r6   r   _eis._eval_as_leading_term
  se    YYq\1%:::11499=A**1d*CCw,Q,EEr8   c                   < V P                   ^ ,          P                  V^ 4      pVP                  '       d-   V P                  ! V P                   !  pVP	                  WV4      # \
        SV `  WV4      # rh   )r*   r   rQ   r  r  r   r  s   &&&&&  r6   r  _eis._eval_nseries
  s]    YYq\1%:::11499=A??1..w$Q400r8   r   r<   rh   )r   r   r   r   r   r   rA   r  r   r  r   r   r   r   s   @@r6   r  r  
  s)     	75F1 1r8   r  N)T)Pr   
sympy.corer   sympy.core.addr   sympy.core.cacher   sympy.core.functionr   r   r   sympy.core.logicr   sympy.core.numbersr	   r
   r   r   sympy.core.relationalr   sympy.core.powerr   sympy.core.singletonr   sympy.core.symbolr   r   sympy.core.sympifyr   (sympy.functions.combinatorial.factorialsr   r   r   $sympy.functions.elementary.complexesr   r   r   #sympy.functions.elementary.integersr   r   (sympy.functions.elementary.miscellaneousr   r   &sympy.functions.elementary.exponentialr   r   r   %sympy.functions.elementary.hyperbolicr    r!   (sympy.functions.elementary.trigonometricr"   r#   r$   sympy.functions.special.hyperr%   r&   r7   r:   r   r   rW  rF   rS   rT   r  r   r  r  r  r*  r  r  r  r  r  r   r   r   r  r   r8   r6   <module>r     s  F "  $ O O % 7 7 '   " : & [ [ L L > ? F F < C C 8*l-/ l-^H? HD}B? }B@O!? O!bZ$_ Z$zP; P;f[o [Bt@ t@n}?_ }?@ Fe eNZ+ Z+@<JO <J~E	 EPJ@	 J@Xg
 gTn
 nj5-o 5-p^8 ^8B^8 ^8L.*O .*b*1? *1r8   