403Webshell
Server IP : 93.86.61.54  /  Your IP : 216.73.216.206
Web Server : Apache/2.4.62 (Ubuntu)
System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64
User : www-data ( 33)
PHP Version : 8.4.22
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3/dist-packages/sympy/integrals/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/sympy/integrals/__pycache__/meijerint.cpython-310.pyc
o

�8Vac2�@s�dZddlmZmZddlmZmZmZmZddl	m
Z
ddlmZm
Z
mZddlmZddlmZddlmZdd	lmZdd
lmZmZddlmZmZmZddlmZdd
l m!Z!m"Z"m#Z#ddl$m%Z%m&Z&ddl'm(Z(ddl)m*Z*m+Z+ddl,m-Z-m.Z.ddl/m0Z0m1Z1ddl2m3Z3ddl4m5Z5m6Z6ddl7m8Z9ddl:m;Z;ed�Z<dd�Z=dd�Z>ddl?m@Z@e@d�ZAdd�ZBGd d!�d!eC�ZDd"d#�ZEd$d%�ZFd&d'�ZGd(d)�ZHd*d+�ZId,d-�ZJd.d/�ZKd0d1�ZLd2d3�ZMd4d5�ZNiaOd6d7�ZPd8d9�ZQd:d;�ZRd<d=�ZSd>d?�ZTdodAdB�ZUdCdD�ZVdodEdF�ZWdGdH�ZXdodIdJ�ZYdKdL�ZZdMdN�Z[dOdP�Z\dQdR�Z]dSdT�Z^dUa_eeAdpdWdX���Z`dpdYdZ�Zad[d\�Zbd]d^�Zcd_d`�ZdeAdadb��Zedcdd�Zfdedf�Zgdgdh�Zhdidj�ZieAdodkdl��Zjdmdn�ZkdUS)qa�
Integrate functions by rewriting them as Meijer G-functions.

There are three user-visible functions that can be used by other parts of the
sympy library to solve various integration problems:

- meijerint_indefinite
- meijerint_definite
- meijerint_inversion

They can be used to compute, respectively, indefinite integrals, definite
integrals over intervals of the real line, and inverse laplace-type integrals
(from c-I*oo to c+I*oo). See the respective docstrings for details.

The main references for this are:

[L] Luke, Y. L. (1969), The Special Functions and Their Approximations,
    Volume 1

[R] Kelly B. Roach.  Meijer G Function Representations.
    In: Proceedings of the 1997 International Symposium on Symbolic and
    Algebraic Computation, pages 205-211, New York, 1997. ACM.

[P] A. P. Prudnikov, Yu. A. Brychkov and O. I. Marichev (1990).
    Integrals and Series: More Special Functions, Vol. 3,.
    Gordon and Breach Science Publisher
�)�Dict�Tuple)�oo�S�pi�Expr)�factor_terms)�expand�
expand_mul�expand_power_base)�Add��Mul��Rational)�cacheit)�Dummy�Wild)�hyperexpand�	powdenest�collect)�
sincos_to_sum)�And�Or�BooleanAtom)�
DiracDelta�	Heaviside��exp)�	Piecewise�piecewise_fold)�_rewrite_hyperbolics_as_exp�HyperbolicFunction)�cos�sin��meijerg)�multiset_partitions�ordered)�debug)�default_sort_key�zcs6t|�}t|dd�rt�fdd�|jD��S|j��S)N�is_PiecewiseFc3s �|]}t|g��R�VqdS�N)�_has��.0�i��f��;/usr/lib/python3/dist-packages/sympy/integrals/meijerint.py�	<genexpr>>��z_has.<locals>.<genexpr>)r �getattr�all�args�has)�resr3r4r2r5r.9s
r.c&s�	dd�}tt|d��\��
��}tddd�gd���t�
��tjddf�
fd	d
�	�d,�
fdd�	}d
d�}�|��ddfg�
d<ddlm�m}m	}G�fdd�d|�}ddlm
}m�	m}	m
}
m}m}m}
m�m}m}m�m}m}m}m}m}�t������d�gggdg��|����dt�dk���t������dg�gdgg��|����dt�dk���tt��d�
����d�gggdg��|����dt�dk���t��d�
t����dg�gdgg��|����dt�dk������d�ggdgg����|��||���d��t����d�gd�dgdgd�dg��d|�	�d�|d��t���|��dk��������d�ggd�gg����d|��	��	��	fdd��������fdd�}|dd�|dd�|tjd�|tjd�������
�fdd�}|dd�|dd�|tjd�|tjd��|
|d���ggdgg��|��gdgtjgddg�dd�	tdd���|��gtjgdgtjtjg�dd�	tdd���|��ggtjgdg�dd��	���|	��ggdgtjg�dd��	���|
��ggdgtdd�g�dd��	�d����fd d!�����fd"d#��||���td���d�||���t�d��d���fd$d%�}||���|d�||���||���tjtddggdgdg���fgd�||t����||t�����	tddgtjgdgdtjg���fgd�dd&lm }m!}m"}m#}m$}m%}m&}m'}m(}||��||�	�tj)tgdgddgg�|d��fgd��|��dggtjgddg�dd��	�d��|��gdgddgtjg�dd��	�d��|��tjggdgtdd�tdd�g|d��dd���	�d��|��gtjdgddgtjtjg�dd�	td'�d��|���g�g�ddgg���|��dggtjgdg�dd��	���|��gdgdtjgg�dd��	���|��tjggdgtdd�g�d���	���|��dggtdd�gdtdd�g�	d�dd(tj��|��dggtdd�gdtdd�g�	d�dd(tj�dd)lm*} m+}!m,}"m-}#�| ���gg�dg�dg�dd��|!���g�ddg�d�dg�ddg�dd��|"���gd�dg�dg�dd�dg�dd�	��|#���gg�d�dgg�ddtj�dd*lm.}$m/}%�|$��tjtjggdgdg�tj��|%��tjdtjggdgdg�tdd�d�d+S)-z8 Add formulae for the function -> meijerg lookup table. cSst|tgd�S)N��exclude)rr+)�nr4r4r5�wildD�z"_create_lookup_table.<locals>.wild�pqabcr?cSs|jo|dkS�Nr��
is_Integer��xr4r4r5�<lambda>Gsz&_create_lookup_table.<locals>.<lambda>)�
propertiesTc		
s6��t|t�g��||t|||||�fg||f�dSr-)�
setdefault�_mytyper+�appendr&)	�formula�an�ap�bm�bq�arg�fac�cond�hint��tabler4r5�addJs
�z!_create_lookup_table.<locals>.addcs$��t|t�g��||||f�dSr-)rJrKr+rL)rM�instrTrUrVr4r5�addiNs
�z"_create_lookup_table.<locals>.addicSs0|tdgggdgt�f|tgdgdggt�fgS�N�r)r&r+)�ar4r4r5�constantRs�z&_create_lookup_table.<locals>.constantr4r)�
unpolarify�Function�NotcseZdZe�fdd��ZdS)z2_create_lookup_table.<locals>.IsNonPositiveIntegercs�|�}|jdur
|dkSdS)NTrrD)�clsrR�r_r4r5�eval]s
�z7_create_lookup_table.<locals>.IsNonPositiveInteger.evalN)�__name__�
__module__�__qualname__�classmethodrdr4rcr4r5�IsNonPositiveInteger[sri)�gammarr#r�rer$�sinc�sqrt�sinh�cosh�	factorial�log�erf�erfc�erfi�
polar_liftr\)rU�cs(�tdd�||ddd|S)N���rvr\r)�r�sign�nu)rr4r5�A1ws(z _create_lookup_table.<locals>.A1cs����d��|���d�|d�ddd|�dgg�|�dg�|�dg��d��d|�||���dS)Nrvr\r4�rx�sgn)r{r]rX�brm�tr4r5�tmpaddzs
, *�z$_create_lookup_table.<locals>.tmpaddrwcs�����t��|���t�d���t�|d||�dgd||�dgdtjgg�t����d|�||���dS)Nrvr\r)r+r�Halfr|)r{r]rXr~�p�qrmr4r5r��sD2(���cs>|�}d|�|�tgdg|ddg|dg��fgS)Nrwr\rr%��subs�N�rpr?rr4r5�	make_log1�s"�z'_create_lookup_table.<locals>.make_log1cs6|�}�|�tdg|dggdg|d��fgSr[r%r�r�r4r5�	make_log2�s"�z'_create_lookup_table.<locals>.make_log2cs�|��|�Sr-r4�r�)r�r�r4r5�	make_log3�sz'_create_lookup_table.<locals>.make_log3)	�Ei�I�expint�Si�Ci�Shi�Chi�fresnels�fresnelcz3/2�)�besselj�bessely�besseli�besselk)�
elliptic_k�
elliptic_eN�T)0�list�maprr+r�One�sympyr_r`rarjrr#rrkr$rlrmrnrorprqrrrsrtrurr�absr�rr&r�r�r�r�r�r�r�r�r��NegativeOner�r�r�r�r�r�)&rWr@�crZr^r`rarirjr#rrkr$rlrnrorqrrrsrtrur�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r4)r{r]rXr~rpr�r�r?r�rr�rmrrWr_r5�_create_lookup_tableBs�H	.�.�:�:�4
�<6�.�



48**2  .�(��, 
��248�,
��",,4>>.FD2(8r�)�timethisr&cs\�|jvrdS|jrt|�fS�fdd�|jD�}g}|D]}|t|�7}q|��t|�S)z4 Create a hashable entity describing the type of f. r4c�g|]}t|���qSr4)rK�r0r]rFr4r5�
<listcomp>'�z_mytype.<locals>.<listcomp>)�free_symbols�is_Function�typer:r��sort�tuple)r3rG�typesr<rr4rFr5rK s

rKc@seZdZdZdS)�_CoeffExpValueErrorzD
    Exception raised by _get_coeff_exp, for internal use only.
    N)rerfrg�__doc__r4r4r4r5r�/sr�cCsvddlm}t||���|�\}}|s|tjfS|\}|jr,|j|kr'td��||j	fS||kr5|tj
fStd|��)a�
    When expr is known to be of the form c*x**b, with c and/or b possibly 1,
    return c, b.

    Examples
    ========

    >>> from sympy.abc import x, a, b
    >>> from sympy.integrals.meijerint import _get_coeff_exp
    >>> _get_coeff_exp(a*x**b, x)
    (a, b)
    >>> _get_coeff_exp(x, x)
    (1, 1)
    >>> _get_coeff_exp(2*x, x)
    (2, 1)
    >>> _get_coeff_exp(x**3, x)
    (1, 3)
    r)�powsimpzexpr not of form a*x**bzexpr not of form a*x**b: %s)r�r�r�as_coeff_mulr�Zero�is_Pow�baser�rr�)�exprrGr�r��mr4r4r5�_get_coeff_exp6s



r�cs"�fdd��t�}�|||�|S)a�
    Find the exponents of ``x`` (not including zero) in ``expr``.

    Examples
    ========

    >>> from sympy.integrals.meijerint import _exponents
    >>> from sympy.abc import x, y
    >>> from sympy import sin
    >>> _exponents(x, x)
    {1}
    >>> _exponents(x**2, x)
    {2}
    >>> _exponents(x**2 + x, x)
    {1, 2}
    >>> _exponents(x**3*sin(x + x**y) + 1/x, x)
    {-1, 1, 3, y}
    csV||kr|�dg�dS|jr|j|kr|�|jg�dS|jD]}�|||�q dS�Nr\)�updater�r�rr:)r�rGr<rR��_exponents_r4r5r�ks
�z_exponents.<locals>._exponents_��set)r�rGr<r4r�r5�
_exponentsXs	r�cs$ddlm}�fdd�|�|�D�S)zB Find the types of functions in expr, to estimate the complexity. r)r`csh|]
}�|jvr|j�qSr4)r��func)r0�erFr4r5�	<setcomp>|sz_functions.<locals>.<setcomp>)r�r`�atoms)r�rGr`r4rFr5�
_functionsysr�cs<�fdd�dD�\������fdd��t�}�||�|S)ap
    Find numbers a such that a linear substitution x -> x + a would
    (hopefully) simplify expr.

    Examples
    ========

    >>> from sympy.integrals.meijerint import _find_splitting_points as fsp
    >>> from sympy import sin
    >>> from sympy.abc import x
    >>> fsp(x, x)
    {0}
    >>> fsp((x-1)**3, x)
    {1}
    >>> fsp(sin(x+3)*x, x)
    {-3, 0}
    csg|]	}t|�gd��qS)r=)r�r0r?rFr4r5r��sz*_find_splitting_points.<locals>.<listcomp>�pqcspt|t�sdS|�����}|r&|�dkr&|�|�|��dS|jr+dS|jD]}�||�q.dSrC)�
isinstancer�matchrX�is_Atomr:)r�r<r�rR��compute_innermostr�r�rGr4r5r��s

�z1_find_splitting_points.<locals>.compute_innermostr�)r�rG�	innermostr4r�r5�_find_splitting_pointss

r�cCs�ddlm}m}tj}tj}tj}t|�}t�|�}|D]S}||kr'||9}q||jvr1||9}q|j	rk||j
jvrk|j�|�\}	}
|
|fkrQt
|j��|�\}	}
|
|fkrk|||j
9}||||	|j
dd��9}q||9}q|||fS)aq
    Split expression ``f`` into fac, po, g, where fac is a constant factor,
    po = x**s for some s independent of s, and g is "the rest".

    Examples
    ========

    >>> from sympy.integrals.meijerint import _split_mul
    >>> from sympy import sin
    >>> from sympy.abc import s, x
    >>> _split_mul((3*x)**s*sin(x**2)*x, x)
    (3**s, x*x**s, sin(x**2))
    r)�polarifyr_Fr�)r�r�r_rr�rr�	make_argsr�r�rr�r�r
)r3rGr�r_rS�po�gr:r]r�rr4r4r5�
_split_mul�s*







r�cCsft�|�}g}|D]'}|jr+|jjr+|j}|j}|dkr#|}d|}||g|7}q	|�|�q	|S)a
    Return a list ``L`` such that ``Mul(*L) == f``.

    If ``f`` is not a ``Mul`` or ``Pow``, ``L=[f]``.
    If ``f=g**n`` for an integer ``n``, ``L=[g]*n``.
    If ``f`` is a ``Mul``, ``L`` comes from applying ``_mul_args`` to all factors of ``f``.
    rr\)rr�r�rrEr�rL)r3r:�gsr�r?r�r4r4r5�	_mul_args�s
r�cCsBt|�}t|�dkrdSt|�dkrt|�gSdd�t|d�D�S)a�
    Find all the ways to split ``f`` into a product of two terms.
    Return None on failure.

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

    Although the order is canonical from multiset_partitions, this is
    not necessarily the best order to process the terms. For example,
    if the case of len(gs) == 2 is removed and multiset is allowed to
    sort the terms, some tests fail.

    Examples
    ========

    >>> from sympy.integrals.meijerint import _mul_as_two_parts
    >>> from sympy import sin, exp, ordered
    >>> from sympy.abc import x
    >>> list(ordered(_mul_as_two_parts(x*sin(x)*exp(x))))
    [(x, exp(x)*sin(x)), (x*exp(x), sin(x)), (x*sin(x), exp(x))]
    rvNcSs g|]\}}t|�t|�f�qSr4r
)r0rG�yr4r4r5r��� z%_mul_as_two_parts.<locals>.<listcomp>)r��lenr�r')r3r�r4r4r5�_mul_as_two_parts�s
r�c
Cs�dd�}tt|j�t|j��}|d|j|d}|dt|d|j}|t||j|�||j	|�||j
|�||j|�|j||||�fS)zO Return C, h such that h is a G function of argument z**n and
        g = C*h. cSs2g}|D]}t|�D]}|�|||�q
q|S)z5 (a1, .., ak) -> (a1/n, (a1+1)/n, ..., (ak + n-1)/n) )�rangerL)�paramsr?r<r]r1r4r4r5�inflates�z_inflate_g.<locals>.inflater\rv)
rr�rOrQrzr�deltar&rN�aotherrP�bother�argument)r�r?r��v�Cr4r4r5�
_inflate_gs�r�cCs6dd�}t||j�||j�||j�||j�d|j�S)zQ Turn the G function into one of inverse argument
        (i.e. G(1/x) -> G'(x)) cS�dd�|D�S)NcS�g|]}d|�qS�r\r4r�r4r4r5r��z'_flip_g.<locals>.tr.<locals>.<listcomp>r4��lr4r4r5�trrAz_flip_g.<locals>.trr\)r&rPr�rNr�r�)r�r�r4r4r5�_flip_gs.r�cs�|dkrtt|�|�St|j��t|j�}t||�\}}|j}|dtd�d�tdd�}|��}�fdd�t	��D�}|t
|j|j|j
t|j�||�fS)a\
    Let d denote the integrand in the definition of the G function ``g``.
    Consider the function H which is defined in the same way, but with
    integrand d/Gamma(a*s) (contour conventions as usual).

    If ``a`` is rational, the function H can be written as C*G, for a constant C
    and a G-function G.

    This function returns C, G.
    rrvr\rwcsg|]}|d��qSr�r4r��r�r4r5r�4�z"_inflate_fox_h.<locals>.<listcomp>)�_inflate_fox_hr�rr�r�r�r�rrr�r&rNr�rPr�r�)r�r]r��Dr+�bsr4r�r5r�s

&$r�cKs0t||fi|��}||jvrt|fi|��S|S)z�
    Return a dummy. This will return the same dummy if the same token+name is
    requested more than once, and it is not already in expr.
    This is for being cache-friendly.
    )�_dummy_r�r)�name�tokenr��kwargs�dr4r4r5�_dummy:s
r�cKs0||ftvrt|fi|��t||f<t||fS)z`
    Return a dummy associated to name and token. Same effect as declaring
    it globally.
    )�_dummiesr)r�r�r�r4r4r5r�Fsr�cs0ddlm}m}t�fdd�|�||�D��S)z� Check if f(x), when expressed using G functions on the positive reals,
        will in fact agree with the G functions almost everywhere r)r�Absc3s�|]}�|jvVqdSr-)r��r0r�rFr4r5r6Us�z_is_analytic.<locals>.<genexpr>)r�rr��anyr�)r3rGrr�r4rFr5�_is_analyticQs r�cs�ddlm}m}m}m�m}m}m}m�m	�m
�m�ddlm
}t||�s'|S|jttt|j���}d}|d|d�\��}	t��k|������kftt����|kt���d|�|k�|���|d�fttd���|�|ktd���|�|k�|���d�ftt����|kt�|d||����|k�|�|||���d�ftt����|dkt�|||����|dk�|�|||d���d�ft��kt��k|	����kfg}
|�r�d	}|
D]�\}}|j|jkr�q�t|j�D]�\}
}|	|jdjv�r|�|jd
��d
}n
d}|�|jd����s%q��fdd�|jd
|�|j|d
d
�D�}|
g�|D]i}t|j�D]`\}}|�v�rS�qH||k�r_�|g7�nJt|t��r�|jd
|	k�r�t|t��r�|jd|jv�r��|g7�n&t|t��r�|jd|	k�r�t|t��r�|jd
|jv�r��|g7�n�qH�qAt��t|�d
k�r�q��fdd�t|j�D�|���g}|j|�}d}q�|s�������fdd�}|�dd�|�S)a�
    Do naive simplifications on ``cond``.

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

    Note that this routine is completely ad-hoc, simplification rules being
    added as need arises rather than following any logical pattern.

    Examples
    ========

    >>> from sympy.integrals.meijerint import _condsimp as simp
    >>> from sympy import Or, Eq, And
    >>> from sympy.abc import x, y, z
    >>> simp(Or(x < y, z, Eq(x, y)))
    z | (x <= y)
    >>> simp(Or(x <= y, And(x < y, z)))
    x <= y
    r)�symbolsr�Eq�unbranched_argument�	exp_polarrr�rR�periodic_argumentrru)�BooleanFunctionTzp q r)rbrv���Fr\csg|]}|����qSr4r��r0rG)r�r4r5r��r�z_condsimp.<locals>.<listcomp>Ncsg|]
\}}|�vr|�qSr4r4)r0�k�arg_)�	otherlistr4r5r��s�cs�|jdkr	|j}n|jdkr|j}n|S|������}|s*|��������}|sGt|��rE|jdjsE|jd�urE|jddkS|S|�dkS�Nrr\)�lhs�rhsr�r�r:�is_polar)�origr�r�)rRrr�rrur�rr4r5�repl_eq�s

z_condsimp.<locals>.repl_eqcSs|jo|jdkS)Nz==)�
is_Relational�rel_op)r�r4r4r5rH�sz_condsimp.<locals>.<lambda>)r�r�rr�rrrr�rRrrru�sympy.logic.boolalgrr�r�r�r��	_condsimpr:rrr��	enumerater�r�r�r��replace)rTr�rr�rrr�r�changerx�rules�fro�tor?�arg1�num�	otherargs�arg2r�arg3�newargsrr4)	rRr�rrr�rrur�rr5rXs�4
(�0��� ���.


�
�
�
�
��(�rcCst|t�r|St|���S)z Re-evaluate the conditions. )r��boolr�doit)rTr4r4r5�
_eval_cond�s
r!FcCs.ddlm}|||�}|s|�|dd��}|S)z� Bring expr nearer to its principal branch by removing superfluous
        factors.
        This function does *not* guarantee to yield the principal branch,
        to avoid introducing opaque principal_branch() objects,
        unless full_pb=True. r)�principal_branchcSs|Sr-r4)rGr�r4r4r5rH�sz&_my_principal_branch.<locals>.<lambda>)r�r"r)r��period�full_pbr"r<r4r4r5�_my_principal_branch�s

r%c	s�t||�\}�t|j|�\}�|��}t||�}|t��|�d�d}��fdd�}|t||j�||j�||j�||j	�||�fS)z�
    Rewrite the integral fac*po*g dx, from zero to infinity, as
    integral fac*G, where G has argument a*x. Note po=x**s.
    Return fac, G.
    r\c���fdd�|D�S)Ncs g|]}|d��d�qSr�r4r��r~�sr4r5r��r�z1_rewrite_saxena_1.<locals>.tr.<locals>.<listcomp>r4r�r'r4r5r���z_rewrite_saxena_1.<locals>.tr)
r�r��
get_periodr%r�r&rNr�rPr�)	rSr�r�rG�_r]r#r�r�r4r'r5�_rewrite_saxena_1�s
 $�r,c%
Cs�ddlm}m}m}m}m}m}|j}	t|j	|�\}
}t
t|j�t|j
�t|j�t|j�g�\}}
}}||krTdd�}tt||j�||j�||j
�||j�||
�|�Sg}|jD]}|||�dkg7}qY|j
D]
}|dd||�kg7}qit|�}|jD]}|||�dkg7}q~|jD]
}|dd||�kg7}q�t|�}||j�|d|d||k}dd�}|d	�|d
|	|
||
||f�|dt|j
�t|j�f�|dt|j�t|j�f�|d
|||f�g}g}d|
k||kd|kg}d|kd|k|||d�|t||
d�|||d���g}d|k|||�g}t||	d�d�D]}||t||
��|	d|t�g7}�q)|	dkt||
��|	tkg}||
d�|g}|�rYg}|||fD]}|t|||�g7}�q^||7}|d|�|g}|�r~g}t||
d�|d|k||kt||
��|	tkg|�R�g} || 7}|d| �||g}|�r�g}t||kd|k|	dk|t||
��|	t�g|�R�g}!|!t||dk||	d�|t||
��d�g|�R�g7}!||!7}|d|!�g}"|"|||�||	d�|||
�d�||
d�g7}"|�s|"|g7}"g}#t|j|j�D]\}}|#||g7}#�q|"|t|#��dkg7}"t|"�}"||"g7}|d|"g�t|	dkt||
��|	tk�g}$|�sT|$|g7}$t|$�}$||$g7}|d|$g�t|�S)aV
    Return a condition under which the mellin transform of g exists.
    Any power of x has already been absorbed into the G function,
    so this is just $\int_0^\infty g\, dx$.

    See [L, section 5.6.1]. (Note that s=1.)

    If ``helper`` is True, only check if the MT exists at infinity, i.e. if
    $\int_1^\infty g\, dx$ exists.
    r)r�ra�ceiling�NerkrcSr�)NcSr�r�r4rr4r4r5r�r�z4_check_antecedents_1.<locals>.tr.<locals>.<listcomp>r4r�r4r4r5r�rAz _check_antecedents_1.<locals>.trr\rvcWst|�dSr-��_debug)�msgr4r4r5r)sz#_check_antecedents_1.<locals>.debugz$Checking antecedents for 1 function:z*  delta=%s, eta=%s, m=%s, n=%s, p=%s, q=%sz
  ap = %s, %sz
  bq = %s, %sz"  cond_3=%s, cond_3*=%s, cond_4=%sz	  case 1:z	  case 2:z	  case 3:z
  extra case:z  second extra case:)r�r�rar-r.rkrr�r�r�rr�rPrNrOrQ�_check_antecedents_1r&r�r�rrzr�r�r�r�ziprr)%r�rG�helperr�rar-r.rkrRr��etar+r�r?r�r�r��tmpr~r]�cond_3�cond_3_star�cond_4r)�conds�case1�tmp1�tmp2�tmp3r�extrar�case2�case3�
case_extrar(�case_extra_2r4r4r5r2�s� 0��



$�8(
�
�
*
�6
,

 

r2c
Cs�ddlm}m}m}t|j|�\}}d|}|jD]
}|||d�9}q|jD]}	||d|	d�9}q'|jD]}||d|d�}q7|j	D]
}	|||	d�}qG|||��S)a�
    Evaluate $\int_0^\infty g\, dx$ using G functions,
    assuming the necessary conditions are fulfilled.

    Examples
    ========

    >>> from sympy.abc import a, b, c, d, x, y
    >>> from sympy import meijerg
    >>> from sympy.integrals.meijerint import _int0oo_1
    >>> _int0oo_1(meijerg([a], [b], [c], [d], x*y), x)
    gamma(-a)*gamma(c + 1)/(y*gamma(-d)*gamma(b + 1))
    r)rj�	gammasimpr_r\)
r�rjrDr_r�r�rPrNr�r�)
r�rGrjrDr_r5r+r<r~r]r4r4r5�	_int0oo_1ds



rEcs�ddlm}��fdd�}t|��\}}	t|j��\}}
t|j��\}}|
dkdkr1|
}
t|�}|dkdkr>|}t|�}|
jrD|jsFdS|
j|
j}}
|j|j}}|||||
�}|||}|||
}t||�\}}t||�\}}||�}||�}|||9}t|j��\}}t|j��\}}|	d|d�|t	|�|�}�fdd	�}t
||j�||j�||j
�||j�|��}t
|j|j|j
|j|��}t|dd
�||fS)a�
    Rewrite the integral ``fac*po*g1*g2`` from 0 to oo in terms of G
    functions with argument ``c*x``.

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

    Return C, f1, f2 such that integral C f1 f2 from 0 to infinity equals
    integral fac ``po``, ``g1``, ``g2`` from 0 to infinity.

    Examples
    ========

    >>> from sympy.integrals.meijerint import _rewrite_saxena
    >>> from sympy.abc import s, t, m
    >>> from sympy import meijerg
    >>> g1 = meijerg([], [], [0], [], s*t)
    >>> g2 = meijerg([], [], [m/2], [-m/2], t**2/4)
    >>> r = _rewrite_saxena(1, t**0, g1, g2, t)
    >>> r[0]
    s/(4*sqrt(pi))
    >>> r[1]
    meijerg(((), ()), ((-1/2, 0), ()), s**2*t/4)
    >>> r[2]
    meijerg(((), ()), ((m/2,), (-m/2,)), t/4)
    r)�ilcmc	s@t|j��\}}|��}t|j|j|j|jt||���|�Sr-)	r�r�r*r&rNr�rPr�r%)r�r]r~�per)r$rGr4r5�pb�s
�z_rewrite_saxena.<locals>.pbTNr\c��fdd�|D�S)Ncsg|]}|��qSr4r4r�rr4r5r��r�z/_rewrite_saxena.<locals>.tr.<locals>.<listcomp>r4r�rr4r5r���z_rewrite_saxena.<locals>.tr��polar)�sympy.core.numbersrFr�r�r��is_Rationalr�r�r�r�r&rNr�rPr�r)rSr��g1�g2rGr$rFrHr+r(�b1�b2�m1�n1�m2�n2�tau�r1�r2�C1�C2�a1r~�a2r�r4)rr$rGr5�_rewrite_saxena�s>,r^c3stddlm�	m}m}m}m}m}m�m}m	}	ddlm
�m}
t�j
|�\�}t�j
|�\�}tt�j�t�j�t�j�t�j�g�\}}
��tt�j�t�j�t�j�t�j�g�\}}��||
��d}||��d}�j��dd�
�j��dd�����}d����
}t�||t|
������t�||
t|
������
td�td�||
��|�
f�td�||��|�f�td	||��
f���fd
d�}|�}t��	fdd
��jD��}t��	fdd
��jD��}t����	fdd
��jD��}t����	fdd
��jD��}t�	�
��fdd
��jD��}t�	�
��fdd
��jD��}t|�d�	�
d�������d���dk}t|�d�	�
d�������d���dk}t|
���|tk}|t|
���|t�}t|
���|tk} |t|
���|t�}!|||t|�}"|	|"���}#|	|"���}$|#d|$k�r�t||d�||dkt||#d��	��
���dk�	��
���dk��}%n_�fdd�}&t||d�|d|dktt||#d�|&|#��t�	��
���dk||#d����}%t||d�|d|dktt||$d�|&|$��t�	��
���dk||$d����}'t|%|'�}%	z҈�t��d��|����t��d��|�
�}(t|(dk�dk�r�|(dk})n��������
��f	dd�}*t|*dd�|*dd�t||
��d�||
��d��f|*||
���d�|*||
���d�t||
��d�||
��d��f|*d||
����|*d||
����t||
��d�||
��d��f|*||
���||
����df�}+|(dkt||(d�||+d��	|�dk�t||(d�||+d��	|�dk�g},t|,�})Wnt�y=d})Ynw|df|df|df|df|df|df|df|df|d f|d!f|d"f| d#f|!d$f|%d%f|)d&ffD]\}-}.td'|.|-��qmg��fd(d)�}/�t||||
dk|jdu|jdu||||| �g7�|/d��t|���||d�|jdu�jdu�	�
�dk|||| �	g7�|/d��t|���||d�|jdu�jdu�	��dk||||�	g7�|/d��t|���|���||d�||d��jdu�jdu�	��dk�	�
�dk|���|||�g7�|/d��t|���|���||d�||d��jdu�jdu�	��
�dk|���|||�g7�|/d��t��k|jdu|jdu|dk||||||!�
g7�|/d��t��k|
jdu|jdu|dk||||||!�
g7�|/d��t��k|jdu|jdu|dk|||||| �
g7�|/d��t��k|jdu|jdu|dk|||||| �
g7�|/d ��t��k|���||d�|dk�jdu�	�
�dk|||||!�g7�|/d!��t��k|���||d�|dk�jdu�	�
�dk|||||!�g7�|/d"��t|�����k|dk||d��jdu�	��dk|||||�g7�|/d#��t|�����k|dk||d��jdu�	��dk|||||�g7�|/d$��t��k��k|dk|dk|||||||!�g7�|/d%��t��k��k|dk|dk|||||||!�g7�|/d&��t��k��k|dk|dk||||||||!|%�
g7�|/d*��t��k��k|dk|dk||||||||!|%�
g7�|/d+��t||
d�|jdu|jdu|jdu|||�g7�|/d,��t||d�|
jdu|jdu|jdu|||�g7�|/d-��t||d�|jdu|jdu|jdu||| �g7�|/d.��t||d�|jdu|jdu|jdu||| �g7�|/d/��t|||
d�|jdu|jdu||||| �g7�|/d0��t|||d�|jdu|jdu||||| �g7�|/d1�t�|dd2�}0t�|dd2�}1�t|1||
d��|k|jdu||||�g7�|/d3��t|1||d��|
k|jdu||||�g7�|/d4��t|0||d��|k|jdu| |||�g7�|/d5��t|0||d��|k|jdu| |||�g7�|/d6�t��}2t|2�dk�r|2S�t||�k||
d�||d�|jdu|jdu|jdut|
���||�dtk||||%|)�g7�|/d7��t||�k||d�||d�|
jdu|jdu|jdut|
���||�dtk||||%|)�g7�|/d8��t|��d�||
d�||d�|jdu|jdu|dk|tt|
���k||||%|)�g7�|/d9��t|��d�||d�||d�|
jdu|jdu|dk|tt|
���k||||%|)�g7�|/d:��t��dk||
d�||d�|jdu|jdu|dk|tt|
���kt|
���||�dtk||||%|)�
g7�|/d;��t��dk||d�||d�|
jdu|jdu|dk|tt|
���kt|
���||�dtk||||%|)�
g7�|/d<��t||d�||d�||
dk|jdu|jdu|jdut|
���||
�dtk||| |%|)�g7�|/d=��t||d�||d�||
�k|jdu|jdu|jdut|
���||
�dtk||| |%|)�g7�|/d>��t||d�||d�|��d�|jdu|jdu|dk|tt|
���kt|
���|dtk||| |%|)�
g7�|/d?��t||d�||d�|��d�|jdu|jdu|dk|tt|
���kt|
���|dtk||| |%|)�
g7�|/d@��t||d�||d���dk|jdu|jdu|dk|tt|
���kt|
���||
�dtk||| |%|)�
g7�|/dA��t||d�||d���dk|jdu|jdu|dk|tt|
���kt|
���||
�dtk||| |%|)�
g7�|/dB�t��S)Cz> Return a condition under which the integral theorem applies. r)	rkr�r.r#r�rr$ryr_)rRrrvr\zChecking antecedents:z1  sigma=%s, s=%s, t=%s, u=%s, v=%s, b*=%s, rho=%sz1  omega=%s, m=%s, n=%s, p=%s, q=%s, c*=%s, mu=%s,z"  phi=%s, eta=%s, psi=%s, theta=%scsH��fD]}|jD]}|jD]}||}|jr|jrdSqq	qdS)NFT)rNrP�
is_integer�is_positive)r�r1�j�diff)rOrPr4r5�_c1�s


���z_check_antecedents.<locals>._c1cs,g|]}�jD]}�d||�dk�qqS�r\r)rP�r0r1ra�rPrkr4r5r���,z&_check_antecedents.<locals>.<listcomp>cs,g|]}�jD]}�d||�dk�qqS)r\rv�rNrerfr4r5r��rgcs6g|]}���d|d����tdd�k�qS�r\���rvrr/��mur�r�rkr4r5r���6cs2g|]}���d|����tdd�k�qSrirr/rkr4r5r���2cs6g|]}���d|d����tdd�k�qSrirr/�rk�rho�ur�r4r5r��rmcs2g|]}���d|����tdd�k�qSrirr/ror4r5r��rncs|dko
t�d|��tkS)a�Returns True if abs(arg(1-z)) < pi, avoiding arg(0).

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

            If ``z`` is 1 then arg is NaN. This raises a
            TypeError on `NaN < pi`. Previously this gave `False` so
            this behavior has been hardcoded here but someone should
            check if this NaN is more serious! This NaN is triggered by
            test_meijerint() in test_meijerint.py:
            `meijerint_definite(exp(x), x, 0, I)`
            r\)r�r�r+)rr4r5�_conds
z!_check_antecedents.<locals>._condFcsP|��t��d�����|��t��d�����Sr�)r�)�c1�c2)	�omegar��psir��sigmar$�thetarqr�r4r5�	lambda_s0Is&&�z%_check_antecedents.<locals>.lambda_s0rwTr�r������	�
���
��z  c%s:cstd|�d�dS)Nz
  case %s:rwr/)�count)r:r4r5�prb�z_check_antecedents.<locals>.prr��������)r4�E1�E2�E3�E4��������� �!�"�#) r�rkr�r.r#r�rr$ryr_rRrr�r�rr�rPrNrOrQrzrr�r0rrr!r�	TypeErrorr`�is_negativer2)3rOrPrGr�r.r#r�rryr_rRr+r(rr�r?�bstar�cstar�phir5rcrtru�c3�c4�c5�c6�c7�c8�c9�c10�c11�c12�c13�z0�zos�zso�c14rs�c14_alt�lambda_c�c15rz�lambda_sr6rTr1r��
mt1_exists�
mt2_existsrxr4)rr:rOrPrlrvr�rwr�rkrprxr$ryrqr�r5�_check_antecedents�s$,00$$��*�
��*�
��
 ��"��"��
""�
�"�"�����$�.�.�.�$$�$� � � � �(�(�(�(�����2222 
� 
�,,,,6
�6
�0
�0
�.
�0
�6
�6
�0
�0
�0
�0
�r�cCs�t|j|�\}}t|j|�\}}dd�}||j�t|j�}t|j�||j�}||j�t|j�}	t|j�||j�}
t|||	|
||�|S)a�
    Express integral from zero to infinity g1*g2 using a G function,
    assuming the necessary conditions are fulfilled.

    Examples
    ========

    >>> from sympy.integrals.meijerint import _int0oo
    >>> from sympy.abc import s, t, m
    >>> from sympy import meijerg, S
    >>> g1 = meijerg([], [], [-S(1)/2, 0], [], s**2*t/4)
    >>> g2 = meijerg([], [], [m/2], [-m/2], t/4)
    >>> _int0oo(g1, g2, t)
    4*meijerg(((1/2, 0), ()), ((m/2,), (-m/2,)), s**(-2))/s**2
    cSr�)NcSsg|]}|�qSr4r4rr4r4r5r�sz(_int0oo.<locals>.neg.<locals>.<listcomp>r4r�r4r4r5�negrAz_int0oo.<locals>.neg)r�r�rPr�rNr�r�r&)rOrPrGr5r+rvr�r\r]rQrRr4r4r5�_int0oo�sr�csnt||�\}�t|j|�\}���fdd�}t||��dd�t||j�||j�||j�||j�|j�fS)z Absorb ``po`` == x**s into g. cr&)Ncsg|]}|���qSr4r4)r0rr'r4r5r�"r�z2_rewrite_inversion.<locals>.tr.<locals>.<listcomp>r4r�r'r4r5r�!r)z_rewrite_inversion.<locals>.trTrK)r�r�rr&rNr�rPr�)rSr�r�rGr+r]r�r4r'r5�_rewrite_inversions(�r�csvddlm�m�m�m�m�m�m�m}m	}m
�td��j�t
��
�\}}|dkr5td�tt���
�S���������
f	dd����fdd��
tt�j�t�j�t�j�t�j�g�\}}}}	|||}
|	||}|
|d	}|	|�	�	d
kr�tj}
n	�	d
kr�d
}
n|}
d
�	d	|�j�|�j��	��j}td||||	|
||�	f�td|
�|f��j|d	ks�|d
kr�||	ks�td
�dS�jD]}�jD]}||jr�||kr�td�dSq�q�||	kr�td���
�fdd��jD��S���
fdd�}�	�
�fdd�}�	��fdd�}�	��fdd�}g}|�d
|kd
|k|t|td	k|dk|���t|d
���g7}|�|d
|k|d
|	k|dk|td	k|dk||d
t|td	k|���t|	|��|���t|	|���g7}|�||	k|dk|dk�	|
t|td	k|���g7}|���||	d	kd
|
k|
�	d	k��|d
||k||||	d	k��|dk|td	k|
d
t|td	k|���t|��|���t|���g7}|�d
|k|dk|dk||ttd	k|
|
t|td	k|���t|��|���t|���g7}||dkg7}�|�S)z7 Check antecedents for the laplace inversion integral. r)
rk�imrrr�rr�r�nanr.z#Checking antecedents for inversion:z
  Flipping G.cst|��\}}||9}|||9}||9}g}|���|�td�}|���|�td�}	|r9|}
n|	}
|���|d��|�dk��|�dk�g7}|��|d���|�d��|�dk�|
�dk�g7}|��|d���|�d��|�dk�|
�dk�|�dk�g7}�|�S)Nrvrrw)r�r)r]r~r�r+�plus�coeff�exponentr:�wp�wm�w)	rr�r�r.rrr�rkrGr4r5�statement_half2s ,4,
�z4_check_antecedents_inversion.<locals>.statement_halfcs"��||||d��||||d��S)zW Provide a convergence statement for z**a * exp(b*z**c),
             c/f sphinx docs. TFr4)r]r~r�r+)rr�r4r5�	statementDs�z/_check_antecedents_inversion.<locals>.statementrvr\z9  m=%s, n=%s, p=%s, q=%s, tau=%s, nu=%s, rho=%s, sigma=%sz   epsilon=%s, theta=%s, delta=%sz-  Computation not valid for these parameters.Fz  Not a valid G function.z$  Using asymptotic Slater expansion.c�g|]}�|ddd���qSrdr4r��r�r+r4r5r�s�z0_check_antecedents_inversion.<locals>.<listcomp>cs���fdd��jD��S)Ncr�rdr4r�r�r4r5r�vr�z;_check_antecedents_inversion.<locals>.E.<locals>.<listcomp>rhrr)rr�r�rrr5�Eusz'_check_antecedents_inversion.<locals>.Ecs���d�|�Sr�r4rr)rxr�ryr4r5�Hxr)z'_check_antecedents_inversion.<locals>.Hc����d�|d�S)Nr\Tr4rr�rxr�ryr4r5�Hp{r�z(_check_antecedents_inversion.<locals>.Hpcr�)Nr\Fr4rrr�r4r5�Hm~r�z(_check_antecedents_inversion.<locals>.Hm)r�rkr�rrr�rr�rr�r.r0r�r��_check_antecedents_inversionr�rr�rPrNrOrQr�r�r_r)r�rGrr�r+r�r�r?r�r�rWrzrp�epsilonr�r]r~r�r�r�r�r:r4)rr�r�r.rrr�r�rkrxr�r�ryrGr+r5r�'s�00$�

��(�.6��$$�&.�(.�r�c	CsHt|j|�\}}tt|j|j|j|j|||�|�\}}|||S)zO
    Compute the laplace inversion integral, assuming the formula applies.
    )r�r�r�r&rNr�rPr�)r�rGrr~r]r�r4r4r5�_int_inversion�s,r�NTc&shddlm}m}m�m}m}tsiatt�t|t	�raddlm
}||j|��|�\}}	t
|	�dkr4dS|	d}	|	jrG|	j|ksD|	jjsFdSn|	|krMdSddt	|j|j|j|j||	�fgdfS|}
|�|t�}t|t�}|tv�r/t|}|D]�\}
}}}|j|
dd�}|�r.i}|��D]\}}|||dd�dd	�||<q�|}t|t�s�|�|�}|d
kr�qyt|ttf�s�||�|��}t|�d
kr�qyt|t�s�||�}g}|D]Q\}}t||�|��t|�dd	�|�}z|�|��t|�}Wn	t y�Yq�w|||f��!�|���rq�t	|j|j|j|j||jdd	��}|�"||f�q�|�r.||fSqy|�s4dSt#d�ddl$m%}m&�m'}m(�dd
lm�m)}m}m*�m+�����fdd�}|
}t,dd|�}�fdd�}z|||||d
dd�\}} }!||||| �}Wn|�y�d}Ynw|du�r�t-dd�}"|"|j.v�r�t/||��r�z ||�||"|�|||dd
d�\}} }!||||| ��|"d�}Wn|�y�d}Ynw|du�s�|�!�||��r�t#d�dSt0�1|�}#g}|#D]?}|�|�\}$}	t
|	�dk�r�t2d��|	d}t|j|�\}"}%||$dt	|j|j|j|j|||"dd�dd	�||%�fg7}�q�t#d|�|dfS)aH
    Try to rewrite f as a sum of single G functions of the form
    C*x**s*G(a*x**b), where b is a rational number and C is independent of x.
    We guarantee that result.argument.as_coeff_mul(x) returns (a, (x**b,))
    or (a, ()).
    Returns a list of tuples (C, s, G) and a condition cond.
    Returns None on failure.
    r)r�r_r�zoor)�factorr\NT)�old)�lift)�exponents_onlyFz)Trying recursive Mellin transform method.)�mellin_transform�inverse_mellin_transform�IntegralTransformError�MellinTransformStripError)rr�r��simplify�cancelcsJz�||||ddd�WS�y$���t|���|||ddd�YSw)z� Calling simplify() all the time is slow and not helpful, since
            most of the time it only factors things in a way that has to be
            un-done anyway. But sometimes it can remove apparent poles. T)�
as_meijerg�needeval)r	)�Fr(rG�strip)r�r�r�r�r4r5�my_imts
�
��z_rewrite_single.<locals>.my_imtr(zrewrite-singlecslddlm}m}t||dd�}|dur.|\}}t||dd��}t||f|||d�f�df�S|||d�f�S)Nr)�IntegralrT)�only_double�nonrepsmall)�rewrite)r�r�r�_meijerint_definite_4�_my_unpolarifyr)r3rGr�rrxr<rT)rr4r5�
my_integrators�z&_rewrite_single.<locals>.my_integrator)�
integratorr�r�r])r�r�r�z"Recursive Mellin transform failed.zUnexpected form...z"Recursive Mellin transform worked:)3r�r�r_rr�r�
_lookup_tabler�r�r&r�r�r�r�r�r�rrNrNr�rPr�r�r+rKr��itemsrrr!r�r��
ValueErrorr;rLr0�sympy.integrals.transformsr�r�r�r�r�r�r�r�r�r�r�rr��NotImplementedError)&r3rG�	recursiver�r_r�rr�r�r��f_rr�rM�termsrTrUr��subs_rrr<rSr�rXr�r�r�r�r(r�r�r�r+r]r:r�r~r4)r�r�r�rr�r5�_rewrite_single�s�
�(

�


�����	
��

��
����
r�cCs8t||�\}}}t|||�}|r|||d|dfSdS)z�
    Try to rewrite ``f`` using a (sum of) single G functions with argument a*x**b.
    Return fac, po, g such that f = fac*po*g, fac is independent of ``x``.
    and po = x**s.
    Here g is a result from _rewrite_single.
    Return None on failure.
    rr\N)r�r�)r3rGr�rSr�r�r4r4r5�	_rewrite1@s
�r�cs�t|��\}}}t�fdd�t|�D��rdSt|�}|sdStt|�fdd��fdd��fdd�g��}dD]5}|D]0\}}t|�|�}	t|�|�}
|	rk|
rkt|	d	|
d	�}|d
krk|||	d|
d|fSq;q7dS)a
    Try to rewrite ``f`` as a product of two G functions of arguments a*x**b.
    Return fac, po, g1, g2 such that f = fac*po*g1*g2, where fac is
    independent of x and po is x**s.
    Here g1 and g2 are results of _rewrite_single.
    Returns None on failure.
    c3s �|]}t|�d�duVqdS)FN)r�r�rFr4r5r6Wr7z_rewrite2.<locals>.<genexpr>Nc�&ttt|d���tt|d����Sr	)�maxr�r�r�rFr4r5rH]�&z_rewrite2.<locals>.<lambda>cr�r	)r�r�r�r�rFr4r5rH^r�cr�r	)r�r�r�r�rFr4r5rH_s��FTr\Fr)r�r�r�r�r�r(r�r)r3rGrSr�r�r�r��fac1�fac2rOrPrTr4rFr5�	_rewrite2Ns,


����r�cCs�ddlm}m}g}tt||�tjhBtd�D]'}t|�	|||�|�}|s'q|�	|||�}t
|||�r;|�|�q|S|�t
�rftd�tt|�|�}|rft|�turatt|�|�t��S|�|�|rntt|��SdS)a#
    Compute an indefinite integral of ``f`` by rewriting it as a G function.

    Examples
    ========

    >>> from sympy.integrals.meijerint import meijerint_indefinite
    >>> from sympy import sin
    >>> from sympy.abc import x
    >>> meijerint_indefinite(sin(x), x)
    -cos(x)
    r)�hyperr&)�key�*Try rewriting hyperbolics in terms of exp.N)r�r�r&�sortedr�rr�r*�_meijerint_indefinite_1r�r.rLr;r"r0�meijerint_indefiniter!r�r�rrr�r�extend�nextr()r3rGr�r&�resultsr]r<�rvr4r4r5rls,

�
�rcs&ddlm}m}m}m}td|d��t|��}|durdS|\}}}	}
td|�tj}|	D]�\}}
}t	|j
��\}}t	|��\}}||
7}||||d||}|d|d�tdd	tj�}�fd
d�}t
dd
�||j�D��r�t||j�||j�dg||j�dg||j�|�}nt||j�dg||j�||j�||j�dg|�}|jr�|��d��||�s�d}nd}t|�||�|�|d�}|t||dd�7}q.�fdd�}||�}|jr�g}|jD]\}}
t||��}|||
fg7}q�t|�}nt||��}t|t|
�f||��df�S)z0 Helper that does not attempt any substitution. r)r�r r�r�z,Trying to compute the indefinite integral of�wrtNz could rewrite:r\rzmeijerint-indefinitecrI)Ncsg|]}|�d�qSr�r4r��rpr4r5r��r�z7_meijerint_indefinite_1.<locals>.tr.<locals>.<listcomp>r4r�r	r4r5r��rJz#_meijerint_indefinite_1.<locals>.trcss"�|]}|jo|dkdkVqdS)rTN)r_)r0r~r4r4r5r6�s� z*_meijerint_indefinite_1.<locals>.<genexpr>)�placeTrKcs0ddlm}t||�dd�}t�|���d�S)a�This multiplies out superfluous powers of x we created, and chops off
        constants:

            >> _clean(x*(exp(x)/x - 1/x) + 3)
            exp(x)

        cancel is used before mul_expand since it is possible for an
        expression to have an additive constant that doesn't become isolated
        with simple expansion. Such a situation was identified in issue 6369:

        Examples
        ========

        >>> from sympy import sqrt, cancel
        >>> from sympy.abc import x
        >>> a = sqrt(2*x + 1)
        >>> bad = (3*x*a**5 + 2*x - a**5 + 1)/a**2
        >>> bad.expand().as_independent(x)[0]
        0
        >>> cancel(bad).expand().as_independent(x)[0]
        1
        r)r�F)�deepr\)r�r�r
r�
_from_args�as_coeff_add)r<r�rFr4r5�_clean�sz'_meijerint_indefinite_1.<locals>._clean)r�r�r r�r�r0r�rr�r�r�r�r�r�rPr&rNr�r��is_extended_nonnegativer�r;rrr,r:r�r)r3rGr�r r�r�r�rSr��glrTr<r�r(r�r]r~r+r��fac_rr�rxr
rrr�r4)rprGr5r�sL


.�.�
rcCs�ddlm}m}m}m}m}m}	td|d|||f�|�|�r&td�dS|�|	�r1td�dS||||f\}
}}}
t	d�}|�
||�}|}||krPtjd	fSg}|t
uri|t
urit|�
||�|||�S|t
ur�td
�t||�}td|�t|td	d�tjgD]X}td
|�|js�td�q�t|�
|||�|�}|dur�td�q�t|�
|||�|�}|dur�td�q�|\}}|\}}t|||��}|dkr�td�q�||}||fSn�|t
ur�t|||t
�}|d|dfS||fdt
fk�rt||�}|�rt|dt��r|�|�n�|Sn�|t
u�r]t||�D];}||dkd	k�r[td|�t|�
|||�t|||�|�}|�r[t|dt��rW|�|��q!|S�q!|�
|||�}||}d}|t
k�r�||||��}t|�}|�
|||�}|t||�|9}t
}td||�td|�t||�}|�r�t|dt��r�|�|�n|S|
�t��r�td�tt|
�|||
�}|�r�t|�tu�r�tt|d�|d� |��f|dd�}|S|�!|�|�r�t"t#|��SdS)a�
    Integrate ``f`` over the interval [``a``, ``b``], by rewriting it as a product
    of two G functions, or as a single G function.

    Return res, cond, where cond are convergence conditions.

    Examples
    ========

    >>> from sympy.integrals.meijerint import meijerint_definite
    >>> from sympy import exp, oo
    >>> from sympy.abc import x
    >>> meijerint_definite(exp(-x**2), x, -oo, oo)
    (sqrt(pi), True)

    This function is implemented as a succession of functions
    meijerint_definite, _meijerint_definite_2, _meijerint_definite_3,
    _meijerint_definite_4. Each function in the list calls the next one
    (presumably) several times. This means that calling meijerint_definite
    can be very costly.
    r)rRrr�rr�SingularityFunction�Integratingzwrt %s from %s to %s.z+Integrand has DiracDelta terms - giving up.Nz5Integrand has Singularity Function terms - giving up.rGTz  Integrating -oo to +oo.z  Sensible splitting points:)r��reversez  Trying to split atz  Non-real splitting point.z'  But could not compute first integral.z(  But could not compute second integral.Fz)  But combined condition is always false.r\zTrying x -> x + %szChanged limits tozChanged function tor)$r�rRrr�rrrr0r;rr�rr�r�meijerint_definiter�rr*�is_extended_real�_meijerint_definite_2rr.r&rLrr�r"r!r�r�rrr�rrr()r3rGr]r~rRrr�rrrr��x_�a_�b_r�rr�r��res1�res2�cond1�cond2rTr<�splitr�rr4r4r5r�s� 






�
�
���


�*
�rc	Cs�ddlm}ddlm}|dfg}|dd}|h}t|�}||vr.||dfg7}|�|�t|�}||vrB||dfg7}|�|�|�|t�r^t||��}||vr^||dfg7}|�|�|�t	t
�rxt|�}||vrx||d	fg7}|�|�|S)
z6 Try to guess sensible rewritings for integrand f(x). r)�expand_trig)�TrigonometricFunctionzoriginal integrandrwr
r	zexpand_trig, expand_mulztrig power reduction)r�r �(sympy.functions.elementary.trigonometricr!r
rXr	r;r"r#r$r)	r3rGr r!r<r
�saw�expanded�reducedr4r4r5�_guess_expansionws0




r&cCsjtdd|dd�}|�||�}|}|dkrtjdfSt||�D]\}}td|�t||�}|r2|SqdS)a�
    Try to integrate f dx from zero to infinity.

    The body of this function computes various 'simplifications'
    f1, f2, ... of f (e.g. by calling expand_mul(), trigexpand()
    - see _guess_expansion) and calls _meijerint_definite_3 with each of
    these in succession.
    If _meijerint_definite_3 succeeds with any of the simplified functions,
    returns this result.
    rGzmeijerint-definite2T)�positiver�TryingN)r�r�rr�r&r0�_meijerint_definite_3)r3rG�dummyr��explanationr<r4r4r5r�s


��rcs�t|��}|r|ddkr|S|jrJtd��fdd�|jD�}tdd�|D��rLg}tj}|D]
\}}||7}||g7}q0t|�}|dkrN||fSdSdSdS)	z�
    Try to integrate f dx from zero to infinity.

    This function calls _meijerint_definite_4 to try to compute the
    integral. If this fails, it tries using linearity.
    r\Fz#Expanding and evaluating all terms.cr�r4)r�)r0r�rFr4r5r��r�z)_meijerint_definite_3.<locals>.<listcomp>css�|]}|duVqdSr-r4)r0rxr4r4r5r6�s�z(_meijerint_definite_3.<locals>.<genexpr>N)r��is_Addr0r:r9rr�r)r3rGr<�ressr:rxr�r4rFr5r)�s$
�r)cCsddlm}t||��S)Nrrc)r�r_r!)r3r_r4r4r5r��sr�c
Cs td|�|sot||dd�}|duro|\}}}}td|||�tj}|D]0\}	}
}|	dkr.q$t||	|||
||�\}	}||	t||�7}t|t||��}|dkrTnq$t|�}|dkrbtd�n
td|�tt	|��|fSt
||�}|du�rd	D]�}|\}}}}
}td
||||
�tj}|D]S\}}}|
D]J\}}}t|||||||||||�}|dur�td�dS|\}	}}td|	||�t|t|||��}|dkr�n||	t
|||�7}q�q�t|�}|dkr�td
|�q{td|�|�r||fStt	|��|fSdSdS)a�
    Try to integrate f dx from zero to infinity.

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

    This function tries to apply the integration theorems found in literature,
    i.e. it tries to rewrite f as either one or a product of two G-functions.

    The parameter ``only_double`` is used internally in the recursive algorithm
    to disable trying to rewrite f as a single G-function.
    rF)r�N�#Could rewrite as single G function:r�But cond is always False.z&Result before branch substitutions is:r�z!Could rewrite as two G functions:zNon-rational exponents.zSaxena subst for yielded:z&But cond is always False (full_pb=%s).)r0r�rr�r,rErr2r�rr�r^r�r�)r3rGr�r�rSr�r�rTr<r�r(r$rOrPrZ�s1�f1r[�s2�f2rx�f1_�f2_r4r4r5r��sh
�



�


�r�cCs~ddlm}m}m}m}m}m}|}	|}
tddd�}|�|
|�}t	d|�t
||�s0t	d�dStj}|j
r<t|j�}nt||�rE|g}nd}|r�g}
g}|r�|��}t||�r�||�}|j
re||j7}qMzt|jd|�\}}Wnty|d}Ynw|d	kr�|�|�nK|
�|�nE|jr�||�}|j
r�||j7}qM||jjvr�z
t|j|�\}}Wnty�d}Ynw|d	kr�|�|||j��|
�|�n|
�|�|sO||�}||
�}||jv�rt	d
||�ddlm}m}|||�d�}|dk�rt	d
�dS|t||�}t	d||�t|�||
�|f�St||�}|du�r�|\}}}}t	d|||�tj}|D].\}}}t|||||||�\}}||t|||�7}t|t ||��}|dk�rcn�q6t!|�}|dk�rtt	d�dSt	d|�t!t"|��}|�#|��s�|||�9}|�|||�}t|t$��s�|�|||�}ddlm%}t|�||
�|f||	�||
�||
d�df�SdS)a�
    Compute the inverse laplace transform
    $\int_{c+i\infty}^{c-i\infty} f(x) e^{tx}\, dx$,
    for real c larger than the real part of all singularities of ``f``.

    Note that ``t`` is always assumed real and positive.

    Return None if the integral does not exist or could not be evaluated.

    Examples
    ========

    >>> from sympy.abc import x, t
    >>> from sympy.integrals.meijerint import meijerint_inversion
    >>> meijerint_inversion(1/x, x, t)
    Heaviside(t)
    r)rr	rqrrrrTrKzLaplace-invertingzBut expression is not analytic.Nr\z.Expression consists of constant and exp shift:)r�r�Fz3but shift is nonreal, cannot be a Laplace transformz1Result is a delta function, possibly conditional:r.r/z"Result before branch substitution:)�InverseLaplaceTransform)&r�rr	rqrrrrr�r0r�rr��is_Mulr�r:r��popr�r�rLr�r�r�r�r�rrr�r�r�rr�r�rr;rr6)r3rGrrr	rqrrrr��t_�shiftr:r�exponentialsrRrr]r~r�r�rTr<r�rSr�r�r�r(r6r4r4r5�meijerint_inversions� 




�
�
�



�

��r<)Fr�)lr��typingrr�
sympy.corerrrr�sympy.core.exprtoolsr�sympy.core.functionr	r
r�sympy.core.addr�sympy.core.mulrrMr�sympy.core.cacher�sympy.core.symbolrr�sympy.simplifyrrr�sympy.simplify.furrrrr�'sympy.functions.special.delta_functionsrr�&sympy.functions.elementary.exponentialr�$sympy.functions.elementary.piecewiserr �%sympy.functions.elementary.hyperbolicr!r"r"r#r$�sympy.functions.special.hyperr&�sympy.utilities.iterablesr'r(�sympy.utilities.miscr)r0�sympy.utilitiesr*r+r.r��sympy.utilities.timeutilsr��timeitrKr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr!r%r,r2rEr^r�r�r�r�r�r�r�r�r�rrrr&rr)r�r�r<r4r4r4r5�<module>s�	["!$(	k

t
J5y

%[
!F

Youez - 2016 - github.com/yon3zu
LinuXploit