K idZddlmZddlmZmZddlmZddlm Z ddl m Z m Z m Z ddlmZddlmZdd lmZmZmZmZdd lmZdd lmZdd lmZdd lmZddlm Z ddl!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.ddl!m/Z/m0Z0ddl1m2Z2m3Z3m4Z4ddl5m6Z6ddl7m8Z8ddl9m:Z:ddl;mm?Z?GddeZ@dZAGdde ZBGddeBZCGddeBZDGd d!e ZEGd"d#eEZFGd$d%eEZGGd&d'eEZHGd(d)eEZIGd*d+eEZJGd,d-eEZKGd.d/eEZLGd0d1eEZMGd2d3eEZNGd4d5eEZOGd6d7eEZPGd8d9e ZQy:);z%Hypergeometric and Meijer G-functions)Counter)SMod)Add)Expr)DefinedFunction DerivativeArgumentIndexError)Tuple)Mul)Ipioozoo)global_parameters)Ne)default_sort_key)Dummy)lcm) sqrtexplogsincosasinatansinhcoshasinhacoshatanhacoth) factorialRisingFactorial)Absre unpolarify) exp_polar)ceiling) Piecewise)AndOr)orderedc"eZdZddddZddZy)TupleArgNrlogxcdirc nt|jDcgc]}|j|||dc}Scc}w)Nr0)r/argsas_leading_term)selfr1r2xfs c/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/sympy/functions/special/hyper.pyr5zTupleArg.as_leading_term%s1tyyY!+!++QTEYZZYs2c jddlm}t|jDcgc] }|||||c}Scc}w)z Compute limit x->xlim. r)limit)sympy.series.limitsr;r/r4)r6r7xlimdirr;r8s r9r;zTupleArg.limit(s/ .$))DQ%1dC0DEEDs0)+)__name__ __module__ __qualname__r5r;r9r/r/s(,![FrDr/cJt|Dcgc] }t|c}Scc}w)ay 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')vr7s r9 _prep_tuplerG3s!" Q/jm/ 00/s ceZdZdZdZdZy)TupleParametersBasezh Base class that takes care of differentiation, when some of the arguments are actually tuples. Tc d}|jdj|s|jdj|rZt|jD]B\}}|j|j |}|dk7s*||j d|f|zz }D||j d|jdj |zzS#t tf$rt||cYSwxYw)Nr) r4has enumerate _diffargsdifffdiffr NotImplementedErrorr )r6sresipms r9_eval_derivativez$TupleParametersBase._eval_derivativeMs 'Cyy|"diil&6&6q&9%dnn54DAqq)..q1AAvtzz1a&1!334Atyy|'8'8';;; ;"$78 'dA& & 'sA 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 |jdtjrvtt |}tt |}||z}ggfx}\}}t ||fD]5\} } | |z} t | D]} || j| g| | z7n(tt |}tt |}t |(|t|t||fi|S)Nevaluate) poprr_rr rOr-extendlistsuper__new__rG) clsapbqzkwargscacbcommonargrVck __class__s r9rdz hyper.__new__s ::j"3"<"< =$B$B"WFr6 !C&"b!2r(+ ,1V  ,AFMM1#ad(+, , gbk"Bgbk"BwsKO[_aR6RRrDct|t|ks+t|t|dzk(r0t|dkdk(rt|}||k7r t|||Syyy)NrKT)lenr%r'r])rerfrgrhnzs r9evalz hyper.evalsa r7c"g #b'SWq["8c!fkd=RABBwRR((>S"8rDcB|dk7r t||t|jDcgc]}|dz c}}t|jDcgc]}|dz c}}t |jt |jz }|t |||j zScc}wcc}w)NrLrK)r r rfrgr r]argument)r6argindexanapbnbqfacs r9rRz hyper.fdiffs q=$T84 4TWW-a!e-.TWW-a!e-.477mCM)5c4==111.-s B Bc Bddlm}ddlm}t |j dk(rtt |j dk(r\|jdk(rM|j \}}|j d}|||||z |z z|||z z |||z z S||S)Nrgamma hyperexpandrMrK)'sympy.functions.special.gamma_functionsrsympy.simplify.hyperexpandrrrrfrgrv)r6hintsrrrxrzrns r9_eval_expand_funczhyper._eval_expand_funcsA: tww<1 TWW!2t}}7I77DAq A8E!a%!),,U1q5\9%A,F F4  rDc 6ddlm}tdd}|Dcgc]}t||}}|D cgc]} t| |} } t |t | z } t || ||zzt |z |dtf|jf|dfScc}wcc} w)Nr)SumnT)integer) sympy.concrete.summationsrrr$r r*r#rconvergence_statement) r6rfrgrhrirrrxrfaprzrfbqcoeffs r9_eval_rewrite_as_Sumzhyper._eval_rewrite_as_Sums1 #t $/12!1%22/12!1%22T S$Z'#eadlYq\9Aq":F3357;TlD D32s BBc(|jd}|j|d}|tjur+|j |dt |j rdnd}|tjurtjSt|)|||S)NrMr-r?)r>r0) r4subsrNaNr;r& is_negativeZeroOnerc_eval_as_leading_term)r6r7r1r2rmx0rps r9rzhyper._eval_as_leading_termswiil XXa^ ;1aBtH,@,@ScJB <55Lw,QT,EErDc  ddlm}|jd}|j|d}|jd}|jd} ||k(r|dk(sddlm} | t ||||Sg} t|D]h} t|D cgc]} t| | c} }t| Dcgc]}t|| c}}| j||z || zzt| z jt| |||z|zScc} wcc}w)Nr)OrderrMrKr)sympy.series.orderrr4r;rrrc _eval_nseriesranger r$appendr#r)r6r7rr1r2rrmrrfrgrtermsrVrxnumrzdenrps r9rzhyper._eval_nseries s,iil YYq!_ YYq\ YYq\qR1W ?uw4Q4@A Aq @Ar:!1-:;Cr:!1-:;C LL3s7sAv.)A,> ? @ U eAqDm+, ;:s C; 'D c |jdS)z* Argument of the hypergeometric function. rMr4r6s r9rvzhyper.argument%yy|rDc,t|jdS)z6 Numerator parameters of the hypergeometric function. rr r4rs r9rfzhyper.ap*diil##rDc,t|jdS)z8 Denominator parameters of the hypergeometric function. rKrrs r9rgzhyper.bq/rrDc4|j|jzSNrfrgrs r9rPzhyper._diffargs4ww  rDcXt|jt|jz S)z6 A quantity related to the convergence of the series. )sumrfrgrs r9etaz hyper.eta8s477|c$''l**rDctd|j|jzDr|jDcgc]}|js|dkdk(s|}}|jDcgc]}|js|dkdk(s|}}t |t |krt j Sd}|D]7}d}|r|j}||k\rd}nd}|r|r't j cS|s|rtSt |jt |jdzk(rt jSt |jt |jkrtSt j Scc}wcc}w)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 c3HK|]}|jxr|dkdk(yw)rTN) is_integer).0rxs r9 z.hyper.radius_of_convergence..Ws%LQq||0aD 00Ls "rTFrK) anyrfrg is_Integerrrrrr`rr)r6rxaintsbintspoppedrz cancelleds r9radius_of_convergencezhyper.radius_of_convergence=s94 L$''DGG:KL L $M11< A!SVaZ ("b"~rDc ddlm}||SNrrrr)r6rirs r9_eval_simplifyzhyper._eval_simplify:4  rDrL)r)r@rArBrZrd classmethodrtrRrrrrpropertyrvrfrgrPrrrr __classcell__rps@r9r]r]ZsslS )) 2!DF-2$$$$!!++22h  !rDr]ceZdZdZfdZddZdZdZdZdZ dZ d Z e d Z e d Ze d Ze d Ze dZe dZe dZe dZe dZe dZe dZxZS)meijergaN 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 ct|dk(r|d|df|d|df|dg}t|dk7r tdd}||d||dc}t|jtt t r t d tfd |dDr t d t|$|||dfi|S) NrrKrMrLz4args must be either as, as', bs, bs', z or as, bs, zct|dk7r td|Dcgc]}tt|}}t t |dt |dScc}w)NrMzwrong argumentrrK)rr TypeErrorrbr-r/rG)rWrVs r9trzmeijerg.__new__..trsY1v{ 011+,-agaj!-A-K!-{1Q4/@A A.sAz$G-function parameters must be finitec3dK|]'}dD]}||z jxr||z dkD)yw)rN)r)rrxrzarg1s r9rz"meijerg.__new__..sI2a2$%A!!/a!eai/2/2s-0zNno parameter a1, ..., an may differ from any b1, ..., bm by a positive integer) rrrr rNrr ValueErrorrrcrd)rer4rirarg0rrps @r9rdzmeijerg.__new__ s t9>!Wd1g&a$q'(:DGDD t9>() ) B Q["T!W+ d t  S2# .CD D 2Q2 2AB BwsD$QB6BBrDc|dk7r|j|dSt|jdk\rt|j}|dxxdzcc<t ||j |j |j|j}d|jz |jddz |z|zzSt|j dk\r~t|j }|dxxdz cc<t |j|j ||j|j}d|jz |j d|z|z zStjS)NrLrKr) _diff_wrt_parameterrranrbraotherbmbotherrvrr)r6rwrxGrzs r9rRz meijerg.fdiff"s  q=++HQK8 8 tww<1 TWW A aDAID4;;dmmLAT]]?twwqzA~t&;a&?@ @ \Q TWW A aDAIDadmmLAT]]?dggajo&9: :66MrDc rt|j}t|j}t|j}t|j}|t |kr|j |ny|t |z}|t |kr|j |nK|t |z}|t |kr|j |n|j |t |z g}g}|||f|||ffD]\}} } |s |j } d} t| D]&\} }t| |z jdr$| } n| td|  }| j | | j| |f|rt|j|z}|D]\}}d}||z }|}|dkr d}||z }|}t|D]]}||t|j||zdzfz|j|j|j||zdzfz|jzz}_|D]\}}d}||z }|}|dkr d}||z }|}t|D]]}||t|j|j||zdzfz|j||zdzfz|j|jzz}_|S)NrKz)Derivative not expressible as G-function?r)rbrrrrrrr`rOrsimplifyrSrrrvrr)r6idxrrfrrgpairs1pairs2l1l2pairsr7foundrVyrUrxrzsignrbaseros r9rzmeijerg._diff_wrt_parameter2s,$''] $++  $''] $++  R= FF3K 3r7NCSW}s s2wR=FF3KFF3R=)!2v.R0@A %MBEFFH%bMDAqA//115 !=-/?@@qEq  aV$ % $-- % 3DAqDAAD1uE1X 3tGDGGtax!|o$=t{{$(GGT[[D1HqL?-J$(MM333 3 3 3DAqDAAD1uE1X 3tGDGGT[[D1HqL?-J$(GGtax!|o$=t{{$(MM333 3 3 rDc4d}||j}||j}t|jt|j}}||k(r&t ||fvrt Sdt zt||zS||kr dt z|zSdt z|zS)a 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 ct|D]`\}}|jstcSt|dzt |D],}t |||z j dr$tccSbtd|DS)NrKc34K|]}|jywr)q)rr7s r9rz6meijerg.get_period..compute..s((s)rO is_Rationalrrrrrrr)lrVrzjs r9computez#meijerg.get_period..computesv!!  "1}}Iq1uc!f-"AAaD224a8! " " (a() )rDrM)rrrrrfrgrrr)r6rbetaalpharWrs r9 get_periodzmeijerg.get_periods* *tww 477|S\1 6eT]" R4E4(( ( UR49 R4: rDc ddlm}||Srr)r6rrs r9rzmeijerg._eval_expand_funcrrDcddl}|jj|}|jtrA|j t\}}t |dk7ry|djdtz }ntj}tt|tz dz}|tj|z ztt|z|z z} |d|z |jd|jdfDcgc]}|j!|c}\}}} } |j%|5|j'| | ||} dddt)j* |Scc}w#t"$rYywxYw#1swY3xYw)NrrK)mpmathrv _eval_evalfrNr( as_coeff_mulrrr4r rrr)rrrr _to_mpmathrworkprecrr _from_mpmath) r6precrznumbranchrrmrhrrfrgrFs r9rzmeijerg._eval_evalfsU }}((. 88I ,,Y7LD&6{aAY^^A&q(FVVF Cr N #a 'aeeAgs1V8a<00  $ac499Q<1FH"nnT2HNQ2r __T " -r2q!,A -  D))H    - -s0%E6EE'E.E E+*E+.E7cBddlm}||j|||S)Nrrr0)rrr5)r6r7r1r2rs r9rzmeijerg._eval_as_leading_terms":4 00D0IIrDcddlm|jztfd|jDztfd|j Dztfd|j Dz tfd|jDz S)z" Get the defining integrand D(s). rr~c34K|]}|z ywrrCrrzrrTs r9rz$meijerg.integrand..s2QE!a%L2c3:K|]}d|z zywrKNrCrrxrrTs r9rz$meijerg.integrand..s6E!a%!)$6c3:K|]}d|z zywr rCrs r9rz$meijerg.integrand..s:E!a%!)$:r c34K|]}|z ywrrCr s r9rz$meijerg.integrand..s6QE!a%L6r )rrrvr rrrr)r6rTrs `@r9 integrandzmeijerg.integrandswA}}a2$''2346dgg678:dkk:;<6$++67 8 8rDc |jdS)z$ Argument of the Meijer G-function. rMrrs r9rvzmeijerg.argumentrrDc2t|jddS)z$ First set of numerator parameters. rrrs r9rz meijerg.andiil1o&&rDcXt|jdd|jddzS)z Combined numerator parameters. rrKrrs r9rfz meijerg.ap,tyy|A1a8::rDc2t|jddS)z% Second set of numerator parameters. rrKrrs r9rzmeijerg.aotherrrDc2t|jddS)z& First set of denominator parameters. rKrrrs r9rz meijerg.bmrrDcXt|jdd|jddzS)z" Combined denominator parameters. rKrrrs r9rgz meijerg.bqrrDc2t|jddS)z' Second set of denominator parameters. rKrrs r9rzmeijerg.botherrrDc4|j|jzSrrrs r9rPzmeijerg._diffargsrrDcXt|jt|jz S)\ A quantity related to the convergence region of the integral, c.f. references. )rrgrfrs r9nuz meijerg.nu s477|c$''l**rDct|jt|jztt|jt|j zdz z S)rrM)rrrrrrfrgrs r9deltaz meijerg.deltasC477|c$''l*Qs477|c$''l/J-KA-MMMrDc|j S)z3 Returns true if expression has numeric data only. ) free_symbolsrs r9 is_numberzmeijerg.is_numbers$$$$rDr)r@rArBrZrdrRrrrrrrrrvrrfrrrgrrPrrr"rrs@r9rrsDC0 Tl(T!*@J8'';;'''';;''!!++ NN %%rDrcleZdZdZedZedZedZedZedZ dZ dZ y ) HyperRepa  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\ttt|dd|ddz}||k7r||Sy)Nr)tuplemapr')rer4newargss r9rtz HyperRep.eval-s:JSb 23d23i? 7?=  rDct)z1 An expression for F(x) which holds for |x| < 1. rSrer7s r9 _expr_smallzHyperRep._expr_small3 "!rDct)z2 An expression for F(-x) which holds for |x| < 1. r*r+s r9_expr_small_minuszHyperRep._expr_small_minus8r-rDct)z6 An expression for F(exp_polar(2*I*pi*n)*x), |x| > 1. r*rer7rs r9 _expr_bigzHyperRep._expr_big=r-rDct)z= An expression for F(exp_polar(2*I*pi*n + pi*I)*x), |x| > 1. r*r1s r9_expr_big_minuszHyperRep._expr_big_minusBr-rDc|jdjd\}}d}|jdd|fz}|jsd}|tjz}||fz}|r|j |}|j |} n|j|}|j|} | |k(r|St| t|dkDf|dfS)NrT allow_halfFrK) r4extract_branch_factorrrHalfr/r4r,r2r*r) r6r4rir7rminusr( newerargssmallbigs r9_eval_rewrite_as_nonrepz HyperRep._eval_rewrite_as_nonrepGsyy}22d2C1))CR.A4'||E KAqdN *D**G4E&$&& 2C$D$$g.E $..),C %<L#s1vz*UDM::rDc|jdjd\}}|jdd|fz}|js|j|S|j|S)NrTr6)r4r8rr/r,)r6r4rir7rs r9_eval_rewrite_as_nonrepsmallz%HyperRep._eval_rewrite_as_nonrepsmallZsdyy}22d2C1yy"~$||)4))40 0t&&rDN) r@rArBrZrrtr,r/r2r4r>r@rCrDr9r$r$su  !! """""""";&'rDr$cPeZdZdZedZedZedZedZy)HyperRep_power1z? Return a representative for hyper([-a], [], z) == (1 - z)**a. cd|z |zSNrKrCrerxr7s r9r,zHyperRep_power1._expr_smalleAzrDcd|z|zSrDrCrEs r9r/z!HyperRep_power1._expr_small_minusirFrDc|jr|j||S|dz |ztd|zdz tztz|zzSNrKrM)rr,rrr rerxr7rs r9r2zHyperRep_power1._expr_bigmsG <<??1a( (Az#qsQwl1nQ.///rDc|jr|j||Sd|z|ztd|ztztz|zzSrI)rr/rrr rJs r9r4zHyperRep_power1._expr_big_minusssC <<((A. .Az#ac"fQhqj/))rDN r@rArBrZrr,r/r2r4rCrDr9rBrBbsSI00 **rDrBcPeZdZdZedZedZedZedZy)HyperRep_power2z< Return a representative for hyper([a, a - 1/2], [2*a], z). cNdd|zdz zdtd|z zdd|zz zzSNrMrKrrEs r9r,zHyperRep_power2._expr_small}21Q37|Qa!e_AaC888rDcNdd|zdz zdtd|zzdd|zz zzSrPrQrEs r9r/z!HyperRep_power2._expr_small_minusrRrDcd}|jrd}|dz}dd|zdz zd|tzt|dz zzdd|zz zztd|ztztz|zzS)NrrKrM)is_oddr rrrrerxr7rsgns r9r2zHyperRep_power2._expr_bigsu 88C FA1Q37|QQtAE{!22a!A#g>> Ab1  rDcd}|jrd}|dd|zdz zztd|z|zdd|zz zztdtztz|z|zzS)NrKrrMrU)rVrrrr rWs r9r4zHyperRep_power2._expr_big_minussc 88C1qsQw<a!es!2a!A#g >>s2b5719Q;?OOOrDNrLrCrDr9rNrNzsUF9999PPrDrNcPeZdZdZedZedZedZedZy) HyperRep_log1z3 Represent -z*hyper([1, 1], [2], z) == log(1 - z). ctd|z SrDrr+s r9r,zHyperRep_log1._expr_small1q5zrDctd|zSrDr]r+s r9r/zHyperRep_log1._expr_small_minusr^rDcLt|dz d|zdz tztzzSrIrrr r1s r9r2zHyperRep_log1._expr_bigs%1q5zQqS1WbLN**rDcFtd|zd|ztztzzSrIrar1s r9r4zHyperRep_log1._expr_big_minuss!1q5zAaCF1H$$rDNrLrCrDr9r[r[sS=++%%rDr[c2eZdZdZedZdZdZdZy)HyperRep_atanhz@ Represent hyper([1/2, 1], [3/2], z) == atanh(sqrt(z))/sqrt(z). cBtt|t|z Sr)r!rr+s r9r,zHyperRep_atanh._expr_smallT!W~d1g%%rDcBtt|t|z Sr)rrr+s r9r/z HyperRep_atanh._expr_small_minussDG}T!W$$rDc|jr1tt|ttzdz zt|z Stt|ttzdz z t|z SNrM)is_evenr"rr rr1s r9r2zHyperRep_atanh._expr_bigsQ 99$q'NQrT!V+T!W4 4$q'NQrT!V+T!W4 4rDc|jr tt|t|z Stt|tz t|z Sr)rjrrrr1s r9r4zHyperRep_atanh._expr_big_minuss< 99Q=a( (aMB&Q/ /rDNrLrCrDr9rdrds&J&&%5 0rDrdcPeZdZdZedZedZedZedZy)HyperRep_asin1zA Represent hyper([1/2, 1/2], [3/2], z) == asin(sqrt(z))/sqrt(z). cBtt|t|z Sr)rrrerhs r9r,zHyperRep_asin1._expr_smallsDG}T!W$$rDcBtt|t|z Sr)rrros r9r/z HyperRep_asin1._expr_small_minusrfrDctj|ztj|z tzt |z t t t |zt |z zzSr)r NegativeOner9rrr r rerhrs r9r2zHyperRep_asin1._expr_bigsG}}a!&&1*ba!81U47^;KDQRG;S!STTrDctj|ztt|t|z |tzt zt|z zzSr)rrrrrrr rss r9r4zHyperRep_asin1._expr_big_minuss<}}atAwQ!7!B$q&a.!HIIrDNrLrCrDr9rmrmsWK%%&&UUJJrDrmcPeZdZdZedZedZedZedZy)HyperRep_asin2zG Represent hyper([1, 1], [3/2], z) == asin(sqrt(z))/sqrt(z)/sqrt(1-z). cvtj|tjtj|z Sr)rmr,rBrr9ros r9r,zHyperRep_asin2._expr_smalls.))!,  ( ( 34 4rDcvtj|tjtj|z Sr)rmr/rBrr9ros r9r/z HyperRep_asin2._expr_small_minuss.//2  . .qvvq 9: :rDcztj||tjtj||z Sr)rmr2rBrr9rss r9r2zHyperRep_asin2._expr_bigs2''1-  & &qvvq! 45 5rDcztj||tjtj||z Sr)rmr4rBrr9rss r9r4zHyperRep_asin2._expr_big_minuss2--a3  , ,QVVQ :; ;rDNrLrCrDr9rvrvsSQ44::55;;rDrvcPeZdZdZedZedZedZedZy)HyperRep_sqrts1z= Return a representative for hyper([-a, 1/2 - a], [1/2], z). cZdt|z d|zzdt|zd|zzzdz SrIrQrerxrhs r9r,zHyperRep_sqrts1._expr_smalls4T!W!$DG qs';;Q>>rDc Zd|z|ztd|ztt|zzSrI)rrrr~s r9r/z!HyperRep_sqrts1._expr_small_minuss+Az#ac$tAw-/000rDc|jrot|dzd|zztdtztz|z|zzt|dz d|zztdtztz|dz z|zzzdz S|dz}t|dz d|zztdtztz|z|dzzzt|dzd|zztdtztz|z|zzzdz SrIrjrrrr rerxrhrs r9r2zHyperRep_sqrts1._expr_bigs 99!Wq[AaC(QrT!VAXaZ8!Wq[AaC(QrT!VQU^A-=)>>?@AB B FA!Wq[AaC(QrT!VAXq1u-=)>>!Wq[AaC(QrT!VAXaZ89:;< >> 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/ ct|t|kDr||}}||}}|||||||S||k(r(t|t|kDr||}}|||||||S|dk(r|dk(rtjSyy)Nr)rrr)rerxb1b2rnr7rs r9rtz appellf1.evals B "22"6 6BaqAq"b!Q* * 2X*1-0@0CCaqAq"b!Q* * 6a1f55L6rDc |j\}}}}}}|dk(r"||z|z t|dz|dz||dz||zS|dk(r"||z|z t|dz||dz|dz||zS|dvrt||j|dz St||)NrrK)rKrMrLr)r4rr r )r6rwrxrrrnr7rs r9rRzappellf1.fdiffs!YY2r1a q=bDFHQUBFBAq!DD D ]bDFHQUBQAq!DD D  %dDIIhqj$9: :$T84 4rDN)r)r@rArBrZrrtrRrCrDr9rris! D   5rDrN)RrZ collectionsr sympy.corerrsympy.core.addrsympy.core.exprrsympy.core.functionrr r sympy.core.containersr sympy.core.mulr sympy.core.numbersr rrrsympy.core.parametersrsympy.core.relationalrsympy.core.sortingrsympy.core.symbolrsympy.external.gmpyrsympy.functionsrrrrrrrrrrr 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/rGrIr]rr$rBrNr[rdrmrvr|rrrrrrCrDr9rsG+ OO'--3$/##00006DD<7:)FuF,1('/'&j! j!Z R%!R%j C'C'L*h*0PhP8%H%&0X0,JXJ&;X;0NhN:1h1>8H825x5,FxF(8585rD