
    \h                        S r SSKJr  SSKJrJr  SSKJr  SSKJ	r	  SSK
JrJrJr  SSKJr  SSKJr  SS	KJrJrJrJr  SS
KJr  SSKJr  SSKJr  SSKJr  SSKJ r   SSK!J"r"J#r#J$r$J%r%J&r&J'r'J(r(J)r)J*r*J+r+J,r,J-r-J.r.  SSK!J/r/J0r0  SSK1J2r2J3r3J4r4  SSK5J6r6  SSK7J8r8  SSK9J:r:  SSK;J<r<J=r=  SSK>J?r?   " S S\5      r@S rA " S S\5      rB " S S\B5      rC " S S\B5      rD " S  S!\5      rE " S" S#\E5      rF " S$ S%\E5      rG " S& S'\E5      rH " S( S)\E5      rI " S* S+\E5      rJ " S, S-\E5      rK " S. S/\E5      rL " S0 S1\E5      rM " S2 S3\E5      rN " S4 S5\E5      rO " S6 S7\E5      rP " S8 S9\5      rQg:);z%Hypergeometric and Meijer G-functions    )Counter)SMod)Add)Expr)DefinedFunction
DerivativeArgumentIndexError)Tuple)Mul)Ipioozoo)global_parameters)Ne)default_sort_key)Dummy)lcm)sqrtexplogsincosasinatansinhcoshasinhacoshatanhacoth)	factorialRisingFactorial)Absre
unpolarify)	exp_polar)ceiling)	Piecewise)AndOr)orderedc                   .    \ rS rSrSSS.S jrSS jrSrg)	TupleArg   Nr   logxcdirc                p    [        U R                   Vs/ s H  oDR                  " X1US.6PM     sn6 $ s  snf )Nr1   )r/   argsas_leading_term)selfr2   r3   xfs        U/var/www/auris/envauris/lib/python3.13/site-packages/sympy/functions/special/hyper.pyr6   TupleArg.as_leading_term%   s.    tyyYy!++QEyYZZYs   3c                 j    SSK Jn  [        U R                   Vs/ s H  oT" XQX#5      PM     sn6 $ s  snf )zCompute limit x->xlim.
        r   )limit)sympy.series.limitsr=   r/   r5   )r7   r8   xlimdirr=   r9   s         r:   r=   TupleArg.limit(   s/     	.$))D)Q%d0)DEEDs   0 )+)__name__
__module____qualname____firstlineno__r6   r=   __static_attributes__rB       r:   r/   r/      s     (,! [FrI   r/   c                 P    [        U  Vs/ s H  n[        U5      PM     sn6 $ s  snf )aI  
Turn an iterable argument *v* into a tuple and unpolarify, since both
hypergeometric and meijer g-functions are unbranched in their parameters.

Examples
========

>>> from sympy.functions.special.hyper import _prep_tuple
>>> _prep_tuple([1, 2, 3])
(1, 2, 3)
>>> _prep_tuple((4, 5))
(4, 5)
>>> _prep_tuple((7, 8, 9))
(7, 8, 9)

)r/   r'   )vr8   s     r:   _prep_tuplerL   3   s%    " Q/QjmQ/00/s   #c                   "    \ rS rSrSrSrS rSrg)TupleParametersBaseG   z_Base class that takes care of differentiation, when some of
the arguments are actually tuples. Tc                     SnU R                   S   R                  U5      (       d#  U R                   S   R                  U5      (       a\  [        U R                  5       HC  u  p4U R                  U   R	                  U5      nUS:w  d  M+  X R                  SU45      U-  -  nME     X R                  S5      U R                   S   R	                  U5      -  -   $ ! [        [        4 a    [        X5      s $ f = f)Nr            )	r5   has	enumerate	_diffargsdifffdiffr
   NotImplementedErrorr	   )r7   sresipms         r:   _eval_derivative$TupleParametersBase._eval_derivativeM   s    		'Cyy|""diil&6&6q&9&9%dnn5DAq)..q1AAvzz1a&1!33 6 Atyy|'8'8';;;;"$78 	'd&&	's   BC 
AC C65C6rB   N)rD   rE   rF   rG   __doc__is_commutativer_   rH   rB   rI   r:   rN   rN   G   s    / N
'rI   rN   c                      ^  \ rS rSrSrU 4S jr\S 5       rSS jrS r	S r
U 4S jrSU 4S	 jjr\S
 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       rS rSrU =r$ )hyperZ   a1  
The generalized hypergeometric function is defined by a series where
the ratios of successive terms are a rational function of the summation
index. When convergent, it is continued analytically to the largest
possible domain.

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

The hypergeometric function depends on two vectors of parameters, called
the numerator parameters $a_p$, and the denominator parameters
$b_q$. It also has an argument $z$. The series definition is

.. math ::
    {}_pF_q\left(\begin{matrix} a_1, \cdots, a_p \\ b_1, \cdots, b_q \end{matrix}
                 \middle| z \right)
    = \sum_{n=0}^\infty \frac{(a_1)_n \cdots (a_p)_n}{(b_1)_n \cdots (b_q)_n}
                        \frac{z^n}{n!},

where $(a)_n = (a)(a+1)\cdots(a+n-1)$ denotes the rising factorial.

If one of the $b_q$ is a non-positive integer then the series is
undefined unless one of the $a_p$ is a larger (i.e., smaller in
magnitude) non-positive integer. If none of the $b_q$ is a
non-positive integer and one of the $a_p$ is a non-positive
integer, then the series reduces to a polynomial. To simplify the
following discussion, we assume that none of the $a_p$ or
$b_q$ is a non-positive integer. For more details, see the
references.

The series converges for all $z$ if $p \le q$, and thus
defines an entire single-valued function in this case. If $p =
q+1$ the series converges for $|z| < 1$, and can be continued
analytically into a half-plane. If $p > q+1$ the series is
divergent for all $z$.

Please note the hypergeometric function constructor currently does *not*
check if the parameters actually yield a well-defined function.

Examples
========

The parameters $a_p$ and $b_q$ can be passed as arbitrary
iterables, for example:

>>> from sympy import hyper
>>> from sympy.abc import x, n, a
>>> h = hyper((1, 2, 3), [3, 4], x); h
hyper((1, 2), (4,), x)
>>> hyper((3, 1, 2), [3, 4], x, evaluate=False)  # don't remove duplicates
hyper((1, 2, 3), (3, 4), x)

There is also pretty printing (it looks better using Unicode):

>>> from sympy import pprint
>>> pprint(h, use_unicode=False)
  _
 |_  /1, 2 |  \
 |   |     | x|
2  1 \  4  |  /

The parameters must always be iterables, even if they are vectors of
length one or zero:

>>> hyper((1, ), [], x)
hyper((1,), (), x)

But of course they may be variables (but if they depend on $x$ then you
should not expect much implemented functionality):

>>> hyper((n, a), (n**2,), x)
hyper((a, n), (n**2,), x)

The hypergeometric function generalizes many named special functions.
The function ``hyperexpand()`` tries to express a hypergeometric function
using named special functions. For example:

>>> from sympy import hyperexpand
>>> hyperexpand(hyper([], [], x))
exp(x)

You can also use ``expand_func()``:

>>> from sympy import expand_func
>>> expand_func(x*hyper([1, 1], [2], -x))
log(x + 1)

More examples:

>>> from sympy import S
>>> hyperexpand(hyper([], [S(1)/2], -x**2/4))
cos(x)
>>> hyperexpand(x*hyper([S(1)/2, S(1)/2], [S(3)/2], x**2))
asin(x)

We can also sometimes ``hyperexpand()`` parametric functions:

>>> from sympy.abc import a
>>> hyperexpand(hyper([-a], [], x))
(1 - x)**a

See Also
========

sympy.simplify.hyperexpand
gamma
meijerg

References
==========

.. [1] Luke, Y. L. (1969), The Special Functions and Their Approximations,
       Volume 1
.. [2] https://en.wikipedia.org/wiki/Generalized_hypergeometric_function

c                   > UR                  S[        R                  5      (       as  [        [	        U6 5      n[        [	        U6 5      nXV-  n/ / 4=nu  p[        XV45       H4  u  pX-  n
[        U
5       H  nX   R                  U/X   -  5        M     M6     O([        [        U5      5      n[        [        U5      5      n[        TU ](  " U [        U5      [        U5      U40 UD6$ )Nevaluate)popr   rg   r   r   rU   r-   extendlistsuper__new__rL   )clsapbqzkwargscacbcommonargr\   ck	__class__s               r:   rl   hyper.__new__   s    ::j"3"<"<==$B$BWFr6!C&"!2(+ AFMM1#ad(+ $ ,
 gbk"Bgbk"BwsKO[_aR6RRrI   c                     [        U5      [        U5      ::  d-  [        U5      [        U5      S-   :X  a0  [        U5      S:*  S:X  a  [        U5      nX4:w  a  [        XU5      $ g g g )NrQ   T)lenr%   r'   rd   )rm   rn   ro   rp   nzs        r:   eval
hyper.eval   s]    r7c"g#b'SWq["8c!fkd=RABwRR((  >S"8rI   c                 H   US:w  a  [        X5      e[        U R                   Vs/ s H  o"S-   PM	     sn6 n[        U R                   Vs/ s H  oDS-   PM	     sn6 n[	        U R                  6 [	        U R                  6 -  nU[        X5U R                  5      -  $ s  snf s  snf )NrR   rQ   )r
   r   rn   ro   r   rd   argument)r7   argindexanapbnbqfacs          r:   rX   hyper.fdiff   s    q=$T44TWW-W!eW-.TWW-W!eW-.477mCM)54==111 .-s   B
Bc                 @   SSK Jn  SSKJn  [	        U R
                  5      S:X  ar  [	        U R                  5      S:X  aY  U R                  S:X  aI  U R
                  u  pEU R                  S   nU" U5      U" Xd-
  U-
  5      -  U" Xd-
  5      -  U" Xe-
  5      -  $ U" U 5      $ )Nr   gammahyperexpandrS   rQ   )'sympy.functions.special.gamma_functionsr   sympy.simplify.hyperexpandr   r{   rn   ro   r   )r7   hintsr   r   r   r   rv   s          r:   _eval_expand_funchyper._eval_expand_func   s    A:tww<1TWW!2t}}7I77DA
A8E!%!),,U15\9%,FF4  rI   c                 6   SSK Jn  [        SSS9nU Vs/ s H  n[        Xv5      PM     nnU V	s/ s H  n	[        X5      PM     n
n	[	        U6 [	        U
6 -  n[        U" XU-  -  [        U5      -  US[        45      U R                  4U S45      $ s  snf s  sn	f )Nr   )SumnT)integer)	sympy.concrete.summationsr   r   r$   r   r*   r#   r   convergence_statement)r7   rn   ro   rp   rq   r   r   r   rfapr   rfbqcoeffs               r:   _eval_rewrite_as_Sumhyper._eval_rewrite_as_Sum   s    1#t$/12r!%r2/12r!%r2T
S$Z'#edlYq\9Aq":F3357;TlD 	D 32s
   BBc                 (  > U R                   S   nUR                  US5      nU[        R                  L a-  UR	                  US[        U5      R                  (       a  SOSS9nU[        R                  L a  [        R                  $ [        TU ])  XUS9$ )NrS   r   -rC   )r@   r1   )r5   subsr   NaNr=   r&   is_negativeZeroOnerk   _eval_as_leading_term)r7   r8   r2   r3   ru   x0rx   s         r:   r   hyper._eval_as_leading_term  su    iilXXa^;1aBtH,@,@ScJB<55Lw,Q,EErI   c           
        > SSK Jn  U R                  S   nUR                  US5      nU R                  S   nU R                  S   n	Xa:X  a  US:X  d  SSKJn
  U
" [        TU ]  XU5      5      $ / n[        U5       Hl  n[        U Vs/ s H  n[        X5      PM     sn6 n[        U	 Vs/ s H  n[        X5      PM     sn6 nUR                  UU-  Xl-  -  [        U5      -  5        Mn     [        U6 U" X-  U5      -   $ s  snf s  snf )Nr   )OrderrS   rQ   r   )sympy.series.orderr   r5   r=   r   r   rk   _eval_nseriesranger   r$   appendr#   r   )r7   r8   r   r2   r3   r   ru   r   rn   ro   r   termsr\   r   numr   denrx   s                    r:   r   hyper._eval_nseries  s    ,iilYYq!_YYq\YYq\R1W ?uw4Q4@AAqAr:r!-r:;Cr:r!-r:;CLL3s7sv.)A,>? 
 UeADm+,	 ;:s   C?
)D
c                      U R                   S   $ )z)Argument of the hypergeometric function. rS   r5   r7   s    r:   r   hyper.argument%       yy|rI   c                 ,    [        U R                  S   6 $ )z5Numerator parameters of the hypergeometric function. r   r   r5   r   s    r:   rn   hyper.ap*       diil##rI   c                 ,    [        U R                  S   6 $ )z7Denominator parameters of the hypergeometric function. rQ   r   r   s    r:   ro   hyper.bq/  r   rI   c                 4    U R                   U R                  -   $ Nrn   ro   r   s    r:   rV   hyper._diffargs4      ww  rI   c                 X    [        U R                  5      [        U R                  5      -
  $ )z5A quantity related to the convergence of the series. )sumrn   ro   r   s    r:   eta	hyper.eta8  s     477|c$''l**rI   c                 p   [        S U R                  U R                  -    5       5      (       a  U R                   Vs/ s H"  oR                  (       d  M  US:*  S:X  d  M   UPM$     nnU R                   Vs/ s H"  oR                  (       d  M  US:*  S:X  d  M   UPM$     nn[	        U5      [	        U5      :  a  [
        R                  $ SnU HH  nSnU(       a#  UR                  5       nX:  a  SnOSnU(       a  M#  U(       a  M8  [
        R                  s  $    U(       d  U(       a  [        $ [	        U R                  5      [	        U R                  5      S-   :X  a  [
        R                  $ [	        U R                  5      [	        U R                  5      ::  a  [        $ [
        R                  $ s  snf s  snf )a  
Compute the radius of convergence of the defining series.

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

Note that even if this is not ``oo``, the function may still be
evaluated outside of the radius of convergence by analytic
continuation. But if this is zero, then the function is not actually
defined anywhere else.

Examples
========

>>> from sympy import hyper
>>> from sympy.abc import z
>>> hyper((1, 2), [3], z).radius_of_convergence
1
>>> hyper((1, 2, 3), [4], z).radius_of_convergence
0
>>> hyper((1, 2), (3, 4), z).radius_of_convergence
oo

c              3   V   #    U  H  oR                   =(       a    US :*  S:H  v   M!     g7f)r   TN)
is_integer).0r   s     r:   	<genexpr>.hyper.radius_of_convergence.<locals>.<genexpr>W  s%     L:KQ||0aD 00:Ks   ')r   TFrQ   )
anyrn   ro   
is_Integerr{   r   r   rh   r   r   )r7   r   aintsbintspoppedr   	cancelleds          r:   radius_of_convergencehyper.radius_of_convergence=  s;   4 L$''DGG:KLLL $M1<<QQ!V<LQEM $M1<<QQ!V<LQEM5zCJ&vvF!			Av$(	!F e !y66M   	tww<3tww<!++55L\S\)I66M1 NMs#   F.F. F.6F3F3F3c           	         U R                   nUS:X  a  gU[        :X  a  gU R                  nU R                  n[	        [        U5      S:  [        U5      S:*  5      n[	        S[        U5      :*  [        U5      S:  [        U5      S:*  [        US5      5      n[	        [        U5      S:  [        U5      S:  5      n[        XEU5      $ )z:Return a condition on z under which the series converges. r   FTrQ   )	r   r   r   r   r+   r&   absr   r,   )r7   Rerp   c1c2c3s          r:   r   hyper.convergence_statementr  s     &&67HHMMACFaK(beRUQYA!R1X>A!SVaZ(""~rI   c                     SSK Jn  U" U 5      $ Nr   r   r   r   )r7   rq   r   s      r:   _eval_simplifyhyper._eval_simplify      :4  rI   rB   rR   )r   )rD   rE   rF   rG   ra   rl   classmethodr}   rX   r   r   r   r   propertyr   rn   ro   rV   r   r   r   r   rH   __classcell__rx   s   @r:   rd   rd   Z   s    slS  ) )2!DF-2   $ $ $ $ ! ! + + 2 2h  ! !rI   rd   c                   
  ^  \ rS rSrSrU 4S jrSS jrS rS rS r	S r
S	 rS
 r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       rSrU =r$ )meijergi  a  
The Meijer G-function is defined by a Mellin-Barnes type integral that
resembles an inverse Mellin transform. It generalizes the hypergeometric
functions.

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

The Meijer G-function depends on four sets of parameters. There are
"*numerator parameters*"
$a_1, \ldots, a_n$ and $a_{n+1}, \ldots, a_p$, and there are
"*denominator parameters*"
$b_1, \ldots, b_m$ and $b_{m+1}, \ldots, b_q$.
Confusingly, it is traditionally denoted as follows (note the position
of $m$, $n$, $p$, $q$, and how they relate to the lengths of the four
parameter vectors):

.. math ::
    G_{p,q}^{m,n} \left(\begin{matrix}a_1, \cdots, a_n & a_{n+1}, \cdots, a_p \\
                                    b_1, \cdots, b_m & b_{m+1}, \cdots, b_q
                      \end{matrix} \middle| z \right).

However, in SymPy the four parameter vectors are always available
separately (see examples), so that there is no need to keep track of the
decorating sub- and super-scripts on the G symbol.

The G function is defined as the following integral:

.. math ::
     \frac{1}{2 \pi i} \int_L \frac{\prod_{j=1}^m \Gamma(b_j - s)
     \prod_{j=1}^n \Gamma(1 - a_j + s)}{\prod_{j=m+1}^q \Gamma(1- b_j +s)
     \prod_{j=n+1}^p \Gamma(a_j - s)} z^s \mathrm{d}s,

where $\Gamma(z)$ is the gamma function. There are three possible
contours which we will not describe in detail here (see the references).
If the integral converges along more than one of them, the definitions
agree. The contours all separate the poles of $\Gamma(1-a_j+s)$
from the poles of $\Gamma(b_k-s)$, so in particular the G function
is undefined if $a_j - b_k \in \mathbb{Z}_{>0}$ for some
$j \le n$ and $k \le m$.

The conditions under which one of the contours yields a convergent integral
are complicated and we do not state them here, see the references.

Please note currently the Meijer G-function constructor does *not* check any
convergence conditions.

Examples
========

You can pass the parameters either as four separate vectors:

>>> from sympy import meijerg, Tuple, pprint
>>> from sympy.abc import x, a
>>> pprint(meijerg((1, 2), (a, 4), (5,), [], x), use_unicode=False)
 __1, 2 /1, 2  4, a |  \
/__     |           | x|
\_|4, 1 \ 5         |  /

Or as two nested vectors:

>>> pprint(meijerg([(1, 2), (3, 4)], ([5], Tuple()), x), use_unicode=False)
 __1, 2 /1, 2  3, 4 |  \
/__     |           | x|
\_|4, 1 \ 5         |  /

As with the hypergeometric function, the parameters may be passed as
arbitrary iterables. Vectors of length zero and one also have to be
passed as iterables. The parameters need not be constants, but if they
depend on the argument then not much implemented functionality should be
expected.

All the subvectors of parameters are available:

>>> from sympy import pprint
>>> g = meijerg([1], [2], [3], [4], x)
>>> pprint(g, use_unicode=False)
 __1, 1 /1  2 |  \
/__     |     | x|
\_|2, 2 \3  4 |  /
>>> g.an
(1,)
>>> g.ap
(1, 2)
>>> g.aother
(2,)
>>> g.bm
(3,)
>>> g.bq
(3, 4)
>>> g.bother
(4,)

The Meijer G-function generalizes the hypergeometric functions.
In some cases it can be expressed in terms of hypergeometric functions,
using Slater's theorem. For example:

>>> from sympy import hyperexpand
>>> from sympy.abc import a, b, c
>>> hyperexpand(meijerg([a], [], [c], [b], x), allow_hyper=True)
x**c*gamma(-a + c + 1)*hyper((-a + c + 1,),
                             (-b + c + 1,), -x)/gamma(-b + c + 1)

Thus the Meijer G-function also subsumes many named functions as special
cases. You can use ``expand_func()`` or ``hyperexpand()`` to (try to)
rewrite a Meijer G-function in terms of named special functions. For
example:

>>> from sympy import expand_func, S
>>> expand_func(meijerg([[],[]], [[0],[]], -x))
exp(x)
>>> hyperexpand(meijerg([[],[]], [[S(1)/2],[0]], (x/2)**2))
sin(x)/sqrt(pi)

See Also
========

hyper
sympy.simplify.hyperexpand

References
==========

.. [1] Luke, Y. L. (1969), The Special Functions and Their Approximations,
       Volume 1
.. [2] https://en.wikipedia.org/wiki/Meijer_G-function

c                   >^ [        U5      S:X  a  US   US   4US   US   4US   /n[        U5      S:w  a  [        S5      eS nU" US   5      U" US   5      snm[        UT5      R                  [        [
        [        * 5      (       a  [        S	5      e[        U4S
 jUS    5       5      (       a  [        S5      e[        TU ]$  " XTUS   40 UD6$ )N   r   rQ   rS   rR      z4args must be either as, as', bs, bs', z or as, bs, zc                     [        U 5      S:w  a  [        S5      eU  Vs/ s H  n[        [        U5      5      PM     n n[	        [        U S   5      [        U S   5      5      $ s  snf )NrS   zwrong argumentr   rQ   )r{   	TypeErrorrj   r-   r/   rL   )r]   r\   s     r:   trmeijerg.__new__.<locals>.tr  sZ    1v{ 011+,-1agaj!1A-K!-{1Q4/@AA .s   A#z$G-function parameters must be finitec              3   v   >#    U  H.  nTS      H!  nX-
  R                   =(       a    X-
  S :  v   M#     M0     g7f)r   N)r   )r   r   r   arg1s      r:   r   "meijerg.__new__.<locals>.<genexpr>  s>      21aA !!/aeai/)0 0s   69zNno parameter a1, ..., an may differ from any b1, ..., bm by a positive integer)
r{   r   r   rT   r   r   
ValueErrorr   rk   rl   )rm   r5   rq   r   arg0r   rx   s        @r:   rl   meijerg.__new__
  s    t9>!Wd1g&a$q'(:DGDDt9> ( ) )	B Q["T!W+
dt  S2#..CDD 2Q2 2 2 A B B ws$QB6BBrI   c                    US:w  a  U R                  US   5      $ [        U R                  5      S:  a  [        U R                  5      nUS==   S-  ss'   [	        X R
                  U R                  U R                  U R                  5      nSU R                  -  U R                  S   S-
  U -  U-   -  $ [        U R                  5      S:  a}  [        U R                  5      nUS==   S-  ss'   [	        U R                  U R
                  X@R                  U R                  5      nSU R                  -  U R                  S   U -  U-
  -  $ [        R                  $ )NrR   rQ   r   )_diff_wrt_parameterr{   anrj   r   aotherbmbotherr   r   r   )r7   r   r   Gr   s        r:   rX   meijerg.fdiff"  s   q=++HQK88tww<1TWWAaDAID;;dmmLAT]]?twwqzA~t&;a&?@@\QTWWAaDAIDadmmLAT]]?dggajo&9::66MrI   c                    [        U R                  5      n[        U R                  5      n[        U R                  5      n[        U R                  5      nU[        U5      :  a  UR                  U5        O{U[        U5      -  nU[        U5      :  a  UR                  U5        OLU[        U5      -  nU[        U5      :  a  UR                  U5        OUR                  U[        U5      -
  5        / n/ nX%U4X4U44 H  u  pn
U(       d  M  UR                  5       nS n[        U	5       H*  u  p[        X-
  R                  5       S5      (       a  M(  Un  O   Uc  [        S5      eU	W   nU	R                  U5        U
R                  X45        U(       a  M  M     [        U R                  5      U -  nU H  u  nnSnUU-
  nUnUS:  a	  SnUU-
  nUn[        U5       H^  nUU[        U R                  UU-   S-   4-   U R                  U R                  U R                  UU-   S-   4-   U R                  5      -  -  nM`     M     U H  u  nnSnUU-
  nUnUS:  a	  SnUU-
  nUn[        U5       H^  nUU[        U R                  U R                  UU-   S-   4-   U R                  UU-   S-   4-   U R                  U R                  5      -  -  nM`     M     U$ )NrQ   z)Derivative not expressible as G-function?r   )rj   r   r   r   r   r{   rh   rU   r   simplifyrY   r   r   r   r   r   )r7   idxr   rn   r   ro   pairs1pairs2l1l2pairsr8   foundr\   yr[   r   r   signr   baserw   s                         r:   r   meijerg._diff_wrt_parameter2  s   , $'']$++$'']$++R=FF3K3r7NCSW}ss2wR=FF3KFF3R=)!v.0@AMBE"FFH%bMDA//1155 ! * =- /? @ @qEq	aV$ " B  $-- %DAqDAAD1uE1XtGDGGtax!|o$=t{{$(GGT[[D1HqL?-J$(MM3 3 3   DAqDAAD1uE1XtGDGGT[[D1HqL?-J$(GGtax!|o$=t{{$(MM3 3 3   
rI   c                 2   S nU" U R                   5      nU" U R                  5      n[        U R                  5      [        U R                  5      pTXE:X  a&  [
        X24;   a  [
        $ S[        -  [        X25      -  $ XE:  a  S[        -  U-  $ S[        -  U-  $ )am  
Return a number $P$ such that $G(x*exp(I*P)) == G(x)$.

Examples
========

>>> from sympy import meijerg, pi, S
>>> from sympy.abc import z

>>> meijerg([1], [], [], [], z).get_period()
2*pi
>>> meijerg([pi], [], [], [], z).get_period()
oo
>>> meijerg([1, 2], [], [], [], z).get_period()
oo
>>> meijerg([1,1], [2], [1, S(1)/2, S(1)/3], [1], z).get_period()
12*pi

c                    [        U 5       Hk  u  pUR                  (       d  [        s  $ [        US-   [	        U 5      5       H1  n[        X U   -
  R                  5       S5      (       a  M)  [        s  s  $    Mm     [        S U  5       6 $ )NrQ   c              3   8   #    U  H  oR                   v   M     g 7fr   )q)r   r8   s     r:   r   6meijerg.get_period.<locals>.compute.<locals>.<genexpr>  s     (aas   )rU   is_Rationalr   r   r{   r   r   r   )lr\   r   js       r:   compute#meijerg.get_period.<locals>.compute  sk    !!}}Iq1uc!f-AaD224a88!	 . % (a())rI   rS   )r   r   r{   rn   ro   r   r   r   )r7   r  betaalphar]   r  s         r:   
get_periodmeijerg.get_period  s    *	* tww 477|S\16e]"	R4E(((UR49R4:rI   c                     SSK Jn  U" U 5      $ r   r   )r7   r   r   s      r:   r   meijerg._eval_expand_func  r   rI   c                 
   SS K nU R                  R                  U5      nUR                  [        5      (       aA  UR                  [        5      u  p4[        U5      S:w  a  g US   R                  S   [        -  nO[        R                  n[        [        U[        -  5      5      S-   nU[        R                  U-  -  [        [        U-  U-  5      -  n USU-  U R                  S   U R                  S   4 Vs/ s H  nUR!                  U5      PM     snu  pxpUR%                  U5         UR'                  XXx5      nS S S 5        [(        R*                  " WU5      $ s  snf ! ["         a     g f = f! , (       d  f       N:= f)Nr   rQ   )mpmathr   _eval_evalfrT   r(   as_coeff_mulr{   r5   r   r   r   r)   r   r   r   r   
_to_mpmathr   workprecr   r   _from_mpmath)r7   precr  znumbranchr   ru   rp   rrn   ro   rK   s               r:   r  meijerg._eval_evalf  sL    	}}((.88I,,Y7LD6{aAY^^A&q(FVVFCr	N#a'aeeAgs1V8a<00	 $ac499Q<1FHF "nnT2FHNQ2
 __T"rq,A #   D))H 		 #"s0   %E$ ;EE$ -E4E$ $
E10E14
Fc                 :    SSK Jn  U" U 5      R                  XUS9$ )Nr   r   r1   )r   r   r6   )r7   r8   r2   r3   r   s        r:   r   meijerg._eval_as_leading_term  s     :4 00D0IIrI   c                    ^^ SSK Jm  U R                  T-  [        UU4S jU R                   5       6 -  [        UU4S jU R
                   5       6 -  [        UU4S jU R                   5       6 -  [        UU4S jU R                   5       6 -  $ )z!Get the defining integrand D(s). r   r   c              3   :   >#    U  H  nT" UT-
  5      v   M     g 7fr   rB   r   r   r   rZ   s     r:   r   $meijerg.integrand.<locals>.<genexpr>  s     2'QE!a%LL'   c              3   @   >#    U  H  nT" S U-
  T-   5      v   M     g7frQ   NrB   r   r   r   rZ   s     r:   r   r,    s!     6gE!a%!)$$g   c              3   @   >#    U  H  nT" S U-
  T-   5      v   M     g7fr/  rB   r+  s     r:   r   r,    s!     :kE!a%!)$$kr1  c              3   :   >#    U  H  nT" UT-
  5      v   M     g 7fr   rB   r0  s     r:   r   r,    s     6+QE!a%LL+r-  )r   r   r   r   r   r   r   r   )r7   rZ   r   s    `@r:   	integrandmeijerg.integrand  sw    A}}a2$''2346dgg678 :dkk:;< 6$++67	8 	8rI   c                      U R                   S   $ )z#Argument of the Meijer G-function. rS   r   r   s    r:   r   meijerg.argument  r   rI   c                 2    [        U R                  S   S   6 $ )z#First set of numerator parameters. r   r   r   s    r:   r   
meijerg.an       diil1o&&rI   c                 X    [        U R                  S   S   U R                  S   S   -   6 $ )zCombined numerator parameters. r   rQ   r   r   s    r:   rn   
meijerg.ap  ,     tyy|A1a8::rI   c                 2    [        U R                  S   S   6 $ )z$Second set of numerator parameters. r   rQ   r   r   s    r:   r   meijerg.aother  r:  rI   c                 2    [        U R                  S   S   6 $ )z%First set of denominator parameters. rQ   r   r   r   s    r:   r   
meijerg.bm  r:  rI   c                 X    [        U R                  S   S   U R                  S   S   -   6 $ )z!Combined denominator parameters. rQ   r   r   r   s    r:   ro   
meijerg.bq  r=  rI   c                 2    [        U R                  S   S   6 $ )z&Second set of denominator parameters. rQ   r   r   s    r:   r   meijerg.bother  r:  rI   c                 4    U R                   U R                  -   $ r   r   r   s    r:   rV   meijerg._diffargs  r   rI   c                 X    [        U R                  5      [        U R                  5      -
  $ )OA quantity related to the convergence region of the integral,
c.f. references. )r   ro   rn   r   s    r:   nu
meijerg.nu
  s     477|c$''l**rI   c                     [        U R                  5      [        U R                  5      -   [        [        U R                  5      [        U R
                  5      -   5      S-  -
  $ )rI  rS   )r{   r   r   r   rn   ro   r   s    r:   deltameijerg.delta  sC     477|c$''l*Qs477|c$''l/J-KA-MMMrI   c                 $    U R                   (       + $ )z2Returns true if expression has numeric data only. )free_symbolsr   s    r:   	is_numbermeijerg.is_number  s     $$$$rI   rB   r   )rD   rE   rF   rG   ra   rl   rX   r   r  r   r  r   r4  r   r   r   rn   r   r   ro   r   rV   rJ  rM  rQ  rH   r   r   s   @r:   r   r     s   DC0 Tl(T!*@J8   ' ' ; ; ' ' ' ' ; ; ' ' ! ! + +
 N N
 % %rI   r   c                   t    \ rS rSrSr\S 5       r\S 5       r\S 5       r\S 5       r	\S 5       r
S rS	 rS
rg)HyperRepi  a  
A base class for "hyper representation functions".

This is used exclusively in ``hyperexpand()``, but fits more logically here.

pFq is branched at 1 if p == q+1. For use with slater-expansion, we want
define an "analytic continuation" to all polar numbers, which is
continuous on circles and on the ray t*exp_polar(I*pi). Moreover, we want
a "nice" expression for the various cases.

This base class contains the core logic, concrete derived classes only
supply the actual functions.

c                 \    [        [        [        US S 5      5      USS  -   nX:w  a  U " U6 $ g )Nr   )tuplemapr'   )rm   r5   newargss      r:   r}   HyperRep.eval-  s8    JSb	23d23i??=  rI   c                     [         e)z0An expression for F(x) which holds for |x| < 1. rY   rm   r8   s     r:   _expr_smallHyperRep._expr_small3  
     "!rI   c                     [         e)z1An expression for F(-x) which holds for |x| < 1. r[  r\  s     r:   _expr_small_minusHyperRep._expr_small_minus8  r_  rI   c                     [         e)z5An expression for F(exp_polar(2*I*pi*n)*x), |x| > 1. r[  rm   r8   r   s      r:   	_expr_bigHyperRep._expr_big=  r_  rI   c                     [         e)z<An expression for F(exp_polar(2*I*pi*n + pi*I)*x), |x| > 1. r[  rd  s      r:   _expr_big_minusHyperRep._expr_big_minusB  r_  rI   c                    U R                   S   R                  SS9u  p4SnU R                   S S U4-   nUR                  (       d  SnU[        R                  -  nXd4-   nU(       a  U R
                  " U6 nU R                  " U6 n	OU R                  " U6 nU R                  " U6 n	X:X  a  U$ [        U	[        U5      S:  4US45      $ )Nr   T
allow_halfFrQ   )r5   extract_branch_factorr   r   Halfra  rh  r]  re  r*   r   )
r7   r5   rq   r8   r   minusrX  	newerargssmallbigs
             r:   _eval_rewrite_as_nonrep HyperRep._eval_rewrite_as_nonrepG  s    yy}22d2C))CR.A4'||EKAdN	**G4E&&	2C$$g.E..),C<L#s1vz*UDM::rI   c                     U R                   S   R                  SS9u  p4U R                   S S U4-   nUR                  (       d  U R                  " U6 $ U R                  " U6 $ )Nr   Trk  )r5   rm  r   ra  r]  )r7   r5   rq   r8   r   s        r:   _eval_rewrite_as_nonrepsmall%HyperRep._eval_rewrite_as_nonrepsmallZ  s^    yy}22d2Cyy"~$||))400&&rI   rB   N)rD   rE   rF   rG   ra   r   r}   r]  ra  re  rh  rs  rv  rH   rB   rI   r:   rT  rT    su      ! !
 " " " " " " " ";&'rI   rT  c                   X    \ rS rSrSr\S 5       r\S 5       r\S 5       r\S 5       r	Sr
g)	HyperRep_power1ib  z>Return a representative for hyper([-a], [], z) == (1 - z)**a. c                     SU-
  U-  $ NrQ   rB   rm   r   r8   s      r:   r]  HyperRep_power1._expr_smalle      AzrI   c                     SU-   U-  $ r{  rB   r|  s      r:   ra  !HyperRep_power1._expr_small_minusi  r~  rI   c                     UR                   (       a  U R                  X5      $ US-
  U-  [        SU-  S-
  [        -  [        -  U-  5      -  $ NrQ   rS   )r   r]  r   r   r   rm   r   r8   r   s       r:   re  HyperRep_power1._expr_bigm  sE    <<??1((Az#qsQwl1nQ.///rI   c                     UR                   (       a  U R                  X5      $ SU-   U-  [        SU-  [        -  [        -  U-  5      -  $ r  )r   ra  r   r   r   r  s       r:   rh  HyperRep_power1._expr_big_minuss  sA    <<((..Az#ac"fQhqj/))rI   rB   NrD   rE   rF   rG   ra   r   r]  ra  re  rh  rH   rB   rI   r:   ry  ry  b  sS    I    0 0
 * *rI   ry  c                   X    \ rS rSrSr\S 5       r\S 5       r\S 5       r\S 5       r	Sr
g)	HyperRep_power2iz  z;Return a representative for hyper([a, a - 1/2], [2*a], z). c                 N    SSU-  S-
  -  S[        SU-
  5      -   SSU-  -
  -  -  $ NrS   rQ   r   r|  s      r:   r]  HyperRep_power2._expr_small}  2    1Q37|Qa!e_AaC888rI   c                 N    SSU-  S-
  -  S[        SU-   5      -   SSU-  -
  -  -  $ r  r  r|  s      r:   ra  !HyperRep_power2._expr_small_minus  r  rI   c                     SnUR                   (       a  SnUS-  nSSU-  S-
  -  SU[        -  [        US-
  5      -  -   SSU-  -
  -  -  [        SU-  [        -  [        -  U-  5      -  $ )Nr   rQ   rS   )is_oddr   r   r   r   rm   r   r8   r   sgns        r:   re  HyperRep_power2._expr_big  su    88CFA1Q37|QQtAE{!22a!A#g>>Ab1 	rI   c                     SnUR                   (       a  SnUSSU-  S-
  -  -  [        SU-   5      U-   SSU-  -
  -  -  [        S[        -  [        -  U-  U-  5      -  $ )NrQ   r   rS   r  )r  r   r   r   r   r  s        r:   rh  HyperRep_power2._expr_big_minus  sc    88C1qsQw<a!es!2a!A#g >>s2b5719Q;?OOOrI   rB   Nr  rB   rI   r:   r  r  z  sU    F9 9 9 9   P PrI   r  c                   X    \ rS rSrSr\S 5       r\S 5       r\S 5       r\S 5       r	Sr
g)	HyperRep_log1i  z2Represent -z*hyper([1, 1], [2], z) == log(1 - z). c                     [        SU-
  5      $ r{  r   r\  s     r:   r]  HyperRep_log1._expr_small      1q5zrI   c                     [        SU-   5      $ r{  r  r\  s     r:   ra  HyperRep_log1._expr_small_minus  r  rI   c                 L    [        US-
  5      SU-  S-
  [        -  [        -  -   $ r  r   r   r   rd  s      r:   re  HyperRep_log1._expr_big  s%    1q5zQqS1WbLN**rI   c                 F    [        SU-   5      SU-  [        -  [        -  -   $ r  r  rd  s      r:   rh  HyperRep_log1._expr_big_minus  s!    1q5zAaCF1H$$rI   rB   Nr  rB   rI   r:   r  r    sS    =    + + % %rI   r  c                   :    \ rS rSrSr\S 5       rS rS rS r	Sr
g)	HyperRep_atanhi  z?Represent hyper([1/2, 1], [3/2], z) == atanh(sqrt(z))/sqrt(z). c                 B    [        [        U5      5      [        U5      -  $ r   )r!   r   r\  s     r:   r]  HyperRep_atanh._expr_small      T!W~d1g%%rI   c                 B    [        [        U5      5      [        U5      -  $ r   )r   r   r\  s     r:   ra   HyperRep_atanh._expr_small_minus  s    DG}T!W$$rI   c                     UR                   (       a1  [        [        U5      5      [        [        -  S-  -   [        U5      -  $ [        [        U5      5      [        [        -  S-  -
  [        U5      -  $ NrS   )is_evenr"   r   r   r   rd  s      r:   re  HyperRep_atanh._expr_big  sQ    99$q'NQrT!V+T!W44$q'NQrT!V+T!W44rI   c                     UR                   (       a   [        [        U5      5      [        U5      -  $ [        [        U5      5      [        -
  [        U5      -  $ r   )r  r   r   r   rd  s      r:   rh  HyperRep_atanh._expr_big_minus  s<    99Q=a((aMB&Q//rI   rB   Nr  rB   rI   r:   r  r    s&    J& &%50rI   r  c                   X    \ rS rSrSr\S 5       r\S 5       r\S 5       r\S 5       r	Sr
g)	HyperRep_asin1i  z@Represent hyper([1/2, 1/2], [3/2], z) == asin(sqrt(z))/sqrt(z). c                 B    [        [        U5      5      [        U5      -  $ r   )r   r   rm   rp   s     r:   r]  HyperRep_asin1._expr_small  s    DG}T!W$$rI   c                 B    [        [        U5      5      [        U5      -  $ r   )r   r   r  s     r:   ra   HyperRep_asin1._expr_small_minus  r  rI   c                     [         R                  U-  [         R                  U-
  [        -  [	        U5      -  [
        [        [	        U5      5      -  [	        U5      -  -   -  $ r   )r   NegativeOnern  r   r   r   r    rm   rp   r   s      r:   re  HyperRep_asin1._expr_big  sG    }}a!&&1*ba!81U47^;KDQRG;S!STTrI   c                     [         R                  U-  [        [        U5      5      [        U5      -  U[        -  [
        -  [        U5      -  -   -  $ r   )r   r  r   r   r   r   r  s      r:   rh  HyperRep_asin1._expr_big_minus  s<    }}atAwQ!7!B$q&a.!HIIrI   rB   Nr  rB   rI   r:   r  r    sW    K% % & & U U J JrI   r  c                   X    \ rS rSrSr\S 5       r\S 5       r\S 5       r\S 5       r	Sr
g)	HyperRep_asin2i  zFRepresent hyper([1, 1], [3/2], z) == asin(sqrt(z))/sqrt(z)/sqrt(1-z). c                 v    [         R                  U5      [        R                  [        R                  U5      -  $ r   )r  r]  ry  r   rn  r  s     r:   r]  HyperRep_asin2._expr_small  s.    ))!,((34 	4rI   c                 v    [         R                  U5      [        R                  [        R                  U5      -  $ r   )r  ra  ry  r   rn  r  s     r:   ra   HyperRep_asin2._expr_small_minus  s.    //2..qvvq9: 	:rI   c                 v    [         R                  X5      [        R                  [        R                  X5      -  $ r   )r  re  ry  r   rn  r  s      r:   re  HyperRep_asin2._expr_big  s.    ''-&&qvvq45 	5rI   c                 v    [         R                  X5      [        R                  [        R                  X5      -  $ r   )r  rh  ry  r   rn  r  s      r:   rh  HyperRep_asin2._expr_big_minus  s.    --a3,,QVVQ:; 	;rI   rB   Nr  rB   rI   r:   r  r    sS    Q4 4 : : 5 5 ; ;rI   r  c                   X    \ rS rSrSr\S 5       r\S 5       r\S 5       r\S 5       r	Sr
g)	HyperRep_sqrts1i  z<Return a representative for hyper([-a, 1/2 - a], [1/2], z). c                 Z    S[        U5      -
  SU-  -  S[        U5      -   SU-  -  -   S-  $ r  r  rm   r   rp   s      r:   r]  HyperRep_sqrts1._expr_small  s4    T!W!$DGqs';;Q>>rI   c           	      Z    SU-   U-  [        SU-  [        [        U5      5      -  5      -  $ r  )r   r   r   r  s      r:   ra  !HyperRep_sqrts1._expr_small_minus  s+    Az#ac$tAw-/000rI   c                    UR                   (       ao  [        U5      S-   SU-  -  [        S[        -  [        -  U-  U-  5      -  [        U5      S-
  SU-  -  [        S[        -  [        -  US-
  -  U-  5      -  -   S-  $ US-  n[        U5      S-
  SU-  -  [        S[        -  [        -  U-  US-   -  5      -  [        U5      S-   SU-  -  [        S[        -  [        -  U-  U-  5      -  -   S-  $ r  r  r   r   r   r   rm   r   rp   r   s       r:   re  HyperRep_sqrts1._expr_big  s    99!Wq[AaC(QrT!VAXaZ8!Wq[AaC(QrT!VQU^A-=)>>?@AB B FA!Wq[AaC(QrT!VAXq1u-=)>>!Wq[AaC(QrT!VAXaZ89:;< <rI   c           	      n   UR                   (       aL  SU-   U-  [        S[        -  [        -  U-  U-  5      -  [	        SU-  [        [        U5      5      -  5      -  $ SU-   U-  [        S[        -  [        -  U-  U-  5      -  [	        SU-  [        [        U5      5      -  S[        -  U-  -
  5      -  $ r  )r  r   r   r   r   r   r   r  s       r:   rh  HyperRep_sqrts1._expr_big_minus  s    99EA:c!B$q&(1*o-c!A#d47m2C.DDDEA:c!B$q&(1*o-c!A#d47m2Cad1f2L.MMMrI   rB   Nr  rB   rI   r:   r  r    sU    G? ? 1 1 < < N NrI   r  c                   N    \ rS rSrSr\S 5       r\S 5       r\S 5       rS r	Sr
g)	HyperRep_sqrts2i  zReturn a representative for
sqrt(z)/2*[(1-sqrt(z))**2a - (1 + sqrt(z))**2a]
== -2*z/(2*a+1) d/dz hyper([-a - 1/2, -a], [1/2], z)c                 r    [        U5      S[        U5      -
  SU-  -  S[        U5      -   SU-  -  -
  -  S-  $ r  r  r  s      r:   r]  HyperRep_sqrts2._expr_small  s=    AwT!W!,DGqs/CCDQFFrI   c           	      r    [        U5      SU-   U-  -  [        SU-  [        [        U5      5      -  5      -  $ r  )r   r   r   r  s      r:   ra  !HyperRep_sqrts2._expr_small_minus  s4    AwAz!#ac$tAw-&7"888rI   c                    UR                   (       a{  [        U5      S-  [        U5      S-
  SU-  -  [        S[        -  [        -  U-  US-
  -  5      -  [        U5      S-   SU-  -  [        S[        -  [        -  U-  U-  5      -  -
  -  $ US-  n[        U5      S-  [        U5      S-
  SU-  -  [        S[        -  [        -  U-  US-   -  5      -  [        U5      S-   SU-  -  [        S[        -  [        -  U-  U-  5      -  -
  -  $ r  r  r  s       r:   re  HyperRep_sqrts2._expr_big  s   99719tAw{ac23qtAvaxQ7G3HH#Aw{ac23qtAvaxz?BC D D FA719tAw{ac23qtAvaxQ7G3HH#Aw{ac23qtAvaxz?BC D DrI   c           	         UR                   (       aX  SU-   U-  [        S[        -  [        -  U-  U-  5      -  [	        U5      -  [        SU-  [        [	        U5      5      -  5      -  $ SU-   U-  [        S[        -  [        -  U-  U-  5      -  [	        U5      -  [        SU-  [        [	        U5      5      -  S[        -  U-  -
  5      -  $ r  )r  r   r   r   r   r   r   r  s       r:   rh  HyperRep_sqrts2._expr_big_minus  s    99EA:c!B$q&(1*o-d1g5c!A#d47m:K6LLLEA:c!B$q&(1*o-d1g5QqSd1g&2a/01 1rI   rB   Nr  rB   rI   r:   r  r    sM    B G G 9 9 D D1rI   r  c                   N    \ rS rSrSr\S 5       r\S 5       r\S 5       rS r	Sr
g)	HyperRep_log2i&  zIRepresent log(1/2 + sqrt(1 - z)/2) == -z/4*hyper([3/2, 1, 1], [2, 2], z) c                 X    [        [        R                  [        SU-
  5      S-  -   5      $ r  r   r   rn  r   r  s     r:   r]  HyperRep_log2._expr_small)  "    166DQKM)**rI   c                 X    [        [        R                  [        SU-   5      S-  -   5      $ r  r  r  s     r:   ra  HyperRep_log2._expr_small_minus-  r  rI   c                    UR                   (       aX  U[        R                  -
  [        -  [        -  [        [        U5      S-  5      -   [        [        S[        U5      -  5      -  -   $ U[        R                  -
  [        -  [        -  [        [        U5      S-  5      -   [        [        S[        U5      -  5      -  -
  $ r  )r  r   rn  r   r   r   r   r   r  s      r:   re  HyperRep_log2._expr_big1  s    99J?1$s4719~5$qay/8IIIJ?1$s4719~5$qay/8IIIrI   c                    UR                   (       a<  [        [        -  U-  [        [        R
                  [        SU-   5      S-  -   5      -   $ [        [        -  U-  [        [        SU-   5      S-  [        R
                  -
  5      -   $ r  )r  r   r   r   r   rn  r   r  s      r:   rh  HyperRep_log2._expr_big_minus8  sc    99a46Ca!eQ 6777a46CQUA 6777rI   rB   Nr  rB   rI   r:   r  r  &  sF    T+ + + + J J8rI   r  c                   X    \ rS rSrSr\S 5       r\S 5       r\S 5       r\S 5       r	Sr
g)	HyperRep_cosasini?  z>Represent hyper([a, -a], [1/2], z) == cos(2*a*asin(sqrt(z))). c                 H    [        SU-  [        [        U5      5      -  5      $ r  )r   r   r   r  s      r:   r]  HyperRep_cosasin._expr_smallD  s    1Q3tDG}$%%rI   c                 H    [        SU-  [        [        U5      5      -  5      $ r  )r   r   r   r  s      r:   ra  "HyperRep_cosasin._expr_small_minusH  s    AaCd1g&''rI   c                 |    [        SU-  [        [        U5      5      -  U[        -  [        -  SU-  S-
  -  -   5      $ r  )r   r    r   r   r   r  s       r:   re  HyperRep_cosasin._expr_bigL  s8    AaCd1g&2a1q)99::rI   c                 v    [        SU-  [        [        U5      5      -  SU-  [        -  [        -  U-  -   5      $ r  )r   r   r   r   r   r  s       r:   rh   HyperRep_cosasin._expr_big_minusP  s3    AaCd1g&1R!344rI   rB   Nr  rB   rI   r:   r  r  ?  sU    I & & ( ( ; ; 5 5rI   r  c                   X    \ rS rSrSr\S 5       r\S 5       r\S 5       r\S 5       r	Sr
g)	HyperRep_sinasiniU  z\Represent 2*a*z*hyper([1 - a, 1 + a], [3/2], z)
== sqrt(z)/sqrt(1-z)*sin(2*a*asin(sqrt(z))) c           	      ~    [        U5      [        SU-
  5      -  [        SU-  [        [        U5      5      -  5      -  $ r  )r   r   r   r  s      r:   r]  HyperRep_sinasin._expr_smallY  s4    AwtAE{"3qs4Q='8#999rI   c           	          [        U5      * [        SU-   5      -  [        SU-  [        [        U5      5      -  5      -  $ r  )r   r   r   r  s      r:   ra  "HyperRep_sinasin._expr_small_minus]  s6    QxQU#D1U47^);$<<<rI   c           	          S[        SSU-  -
  5      -  [        SU-  [        [        U5      5      -  U[        -  [        -  SU-  S-
  -  -   5      -  $ Nr   rQ   rS   )r   r   r    r   r   r  s       r:   re  HyperRep_sinasin._expr_biga  sN    $q1Q3w-QqStAw%7!B$q&!A#':J%J KKKrI   c           	          S[        SSU-  -   5      -  [        SU-  [        [        U5      5      -  SU-  [        -  [        -  U-  -   5      -  $ r  )r   r   r   r   r   r  s       r:   rh   HyperRep_sinasin._expr_big_minuse  sI    $q1Q3w-QqStAw%7!A#b&(1*%D EEErI   rB   Nr  rB   rI   r:   r  r  U  s[    8 : : = = L L F FrI   r  c                   2    \ rS rSrSr\S 5       rSS jrSrg)appellf1ii  aE  
This is the Appell hypergeometric function of two variables as:

.. math ::
    F_1(a,b_1,b_2,c,x,y) = \sum_{m=0}^{\infty} \sum_{n=0}^{\infty}
    \frac{(a)_{m+n} (b_1)_m (b_2)_n}{(c)_{m+n}}
    \frac{x^m y^n}{m! n!}.

Examples
========

>>> from sympy import appellf1, symbols
>>> x, y, a, b1, b2, c = symbols('x y a b1 b2 c')
>>> appellf1(2., 1., 6., 4., 5., 6.)
0.0063339426292673
>>> appellf1(12., 12., 6., 4., 0.5, 0.12)
172870711.659936
>>> appellf1(40, 2, 6, 4, 15, 60)
appellf1(40, 2, 6, 4, 15, 60)
>>> appellf1(20., 12., 10., 3., 0.5, 0.12)
15605338197184.4
>>> appellf1(40, 2, 6, 4, x, y)
appellf1(40, 2, 6, 4, x, y)
>>> appellf1(a, b1, b2, c, x, y)
appellf1(a, b1, b2, c, x, y)

References
==========

.. [1] https://en.wikipedia.org/wiki/Appell_series
.. [2] https://functions.wolfram.com/HypergeometricFunctions/AppellF1/

c                     [        U5      [        U5      :  a  X2p2XepeU " XX4XV5      $ X#:X  a$  [        U5      [        U5      :  a  XepeU " XX4XV5      $ US:X  a  US:X  a  [        R                  $ g g )Nr   )r   r   r   )rm   r   b1b2rv   r8   r  s          r:   r}   appellf1.eval  sw    B"22"66qqbQ**X*1-0@0CCqqbQ**6a1f55L 6rI   c           	         U R                   u  p#pEpgUS:X  a  X#-  U-  [        US-   US-   XES-   Xg5      -  $ US:X  a  X$-  U-  [        US-   X4S-   US-   Xg5      -  $ US;   a  [        X R                   US-
     5      $ [        X5      e)Nr   rQ      )rQ   rS   rR   r   )r5   r  r	   r
   )r7   r   r   r  r  rv   r8   r  s           r:   rX   appellf1.fdiff  s    !YYraq=DFHQUBFBAqDDD]DFHQUBQAqDDD%dIIhqj$9::$T44rI   rB   N)r   )	rD   rE   rF   rG   ra   r   r}   rX   rH   rB   rI   r:   r  r  i  s!     D 	 		5rI   r  N)Rra   collectionsr   
sympy.corer   r   sympy.core.addr   sympy.core.exprr   sympy.core.functionr   r	   r
   sympy.core.containersr   sympy.core.mulr   sympy.core.numbersr   r   r   r   sympy.core.parametersr   sympy.core.relationalr   sympy.core.sortingr   sympy.core.symbolr   sympy.external.gmpyr   sympy.functionsr   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   $sympy.functions.elementary.complexesr%   r&   r'   &sympy.functions.elementary.exponentialr(   #sympy.functions.elementary.integersr)   $sympy.functions.elementary.piecewiser*   sympy.logic.boolalgr+   r,   sympyr-   r/   rL   rN   rd   r   rT  ry  r  r  r  r  r  r  r  r  r  r  r  rB   rI   r:   <module>r     sG   +      O O '  - - 3 $ / # #0 0 0 0 6 D D < 7 : ) Fu F,1('/ '&j! j!Z	R%! R%jC' C'L*h *0Ph P8%H %&0X 0,JX J&;X ;0Nh N:1h 1>8H 825x 5,Fx F(85 85rI   