o
    )ôj&Ê  ã                   @   sè  d Z ddlmZmZ ddlmZ ddlmZmZ ddl	m
Z
 ddlmZmZmZmZmZ ddlmZ ddlmZmZ dd	lmZ dd
lmZ ddlmZ ddlmZmZ ddlm Z m!Z!m"Z" ddl#m$Z$m%Z% ddl&m'Z'm(Z(m)Z)m*Z* ddl+m,Z, ddl-m.Z.m/Z/m0Z0 ddl1m2Z2 ddl3m4Z4m5Z5m6Z6m7Z7 ddl8m9Z9 ddl:m;Z; ddl<m=Z= ddl>m?Z? ddl@mAZAmBZB ddlCmDZD ddlEmFZFmGZGmHZHmIZImJZJ ddlKmLZL ddlMmNZNmOZO ddlPmQZQ ddlRmSZS ddlTmUZU G d d!„ d!eVƒZWG d"d#„ d#eƒZXd$d%„ ZYd&d'„ ZZeZd(ƒZ[d)d*„ Z\e[e\d+fd,d-„ƒZ]G d.d/„ d/eXƒZ^d0d1„ Z_d2d3„ Z`G d4d5„ d5eaƒZbd6d7„ ZceZd+ƒdkd8d9„ƒZdd:aeG d;d<„ d<eXƒZfd=d>„ ZgeZd+ƒdld?d@„ƒZhG dAdB„ dBeXƒZiG dCdD„ dDeiƒZjdEdF„ ZkG dGdH„ dHeiƒZldIdJ„ ZmeZd+ƒdldKdL„ƒZnG dMdN„ dNeXƒZoG dOdP„ dPeoƒZpdQdR„ ZqG dSdT„ dTeoƒZrdUdV„ ZsG dWdX„ dXeoƒZtdYdZ„ ZuG d[d\„ d\eoƒZvd]d^„ ZweZd+ƒdld_d`„ƒZxG dadb„ dbeXƒZyG dcdd„ ddeyƒZzdedf„ Z{G dgdh„ dheyƒZ|didj„ Z}dd:l~m  m€Z� e�j‚Z‚e�jƒZƒe�j„Z„e�j…Z…e�j†Z†e�j‡Z‡d:S )mz Integral Transforms é    )ÚreduceÚwraps)Úrepeat)ÚSÚpi)ÚAdd)ÚAppliedUndefÚ	count_opsÚexpandÚ
expand_mulÚFunction)ÚMul)ÚigcdÚilcm)Údefault_sort_key)ÚDummy)Úpostorder_traversal)Ú	factorialÚrf)ÚreÚargÚAbs)ÚexpÚ	exp_polar)ÚcoshÚcothÚsinhÚtanh)Úceiling)ÚMaxÚMinÚsqrt)Úpiecewise_fold)ÚcosÚcotÚsinÚtan)Úbesselj)Ú	Heaviside)Úgamma)Úmeijerg)Ú	integrateÚIntegral)Ú_dummy)Úto_cnfÚ	conjunctsÚ	disjunctsÚOrÚAnd)Úroots)ÚfactorÚPoly)ÚCRootOf)Úiterable)Údebugc                       s    e Zd ZdZ‡ fdd„Z‡  ZS )ÚIntegralTransformErroraš  
    Exception raised in relation to problems computing transforms.

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

    This class is mostly used internally; if integrals cannot be computed
    objects representing unevaluated transforms are usually returned.

    The hint ``needeval=True`` can be used to disable returning transform
    objects, and instead raise this exception if an integral cannot be
    computed.
    c                    s   t ƒ  d||f ¡ || _d S )Nz'%s Transform could not be computed: %s.)ÚsuperÚ__init__Úfunction)ÚselfÚ	transformr<   Úmsg©Ú	__class__© úk/var/www/html/academy/tools/voices/clone/sv-venv/lib/python3.10/site-packages/sympy/integrals/transforms.pyr;   6   s   
ÿ
zIntegralTransformError.__init__)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r;   Ú__classcell__rB   rB   r@   rC   r9   (   s    r9   c                   @   s|   e Zd ZdZedd„ ƒZedd„ ƒZedd„ ƒZedd	„ ƒZd
d„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zedd„ ƒZdd„ ZdS )ÚIntegralTransforma}  
    Base class for integral transforms.

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

    This class represents unevaluated transforms.

    To implement a concrete transform, derive from this class and implement
    the ``_compute_transform(f, x, s, **hints)`` and ``_as_integral(f, x, s)``
    functions. If the transform cannot be computed, raise :obj:`IntegralTransformError`.

    Also set ``cls._name``. For instance,

    >>> from sympy import LaplaceTransform
    >>> LaplaceTransform._name
    'Laplace'

    Implement ``self._collapse_extra`` if your function returns more than just a
    number and possibly a convergence condition.
    c                 C   ó
   | j d S )z! The function to be transformed. r   ©Úargs©r=   rB   rB   rC   r<   S   ó   
zIntegralTransform.functionc                 C   rJ   )z; The dependent variable of the function to be transformed. é   rK   rM   rB   rB   rC   Úfunction_variableX   rN   z#IntegralTransform.function_variablec                 C   rJ   )z% The independent transform variable. é   rK   rM   rB   rB   rC   Útransform_variable]   rN   z$IntegralTransform.transform_variablec                 C   s   | j j | jh¡| jh S )zj
        This method returns the symbols that will exist when the transform
        is evaluated.
        )r<   Úfree_symbolsÚunionrR   rP   rM   rB   rB   rC   rS   b   s   ÿzIntegralTransform.free_symbolsc                 K   ó   t ‚©N©ÚNotImplementedError©r=   ÚfÚxÚsÚhintsrB   rB   rC   Ú_compute_transformk   ó   z$IntegralTransform._compute_transformc                 C   rU   rV   rW   ©r=   rZ   r[   r\   rB   rB   rC   Ú_as_integraln   r_   zIntegralTransform._as_integralc                 C   s$   t |Ž }|dkrt| jjd dƒ‚|S )NFÚ )r2   r9   rA   Úname)r=   ÚextraÚcondrB   rB   rC   Ú_collapse_extraq   s   z!IntegralTransform._collapse_extrac                    s„   d }t ‡ fdd„ˆ j t¡D ƒƒ }|r4zˆ jˆ jˆ jˆ jfi |¤Ž}W n ty3   tdƒ d }Y nw ˆ j}|j	s>t
|ƒ}||fS )Nc                 3   s   � | ]	}|  ˆ j¡V  qd S rV   )ÚhasrP   )Ú.0ÚfuncrM   rB   rC   Ú	<genexpr>y   s   € ÿz2IntegralTransform._try_directly.<locals>.<genexpr>z6[IT _try ] Caught IntegralTransformError, returns None)Úanyr<   Úatomsr   r^   rP   rR   r9   r8   Úis_Addr   )r=   r]   ÚTZtry_directlyÚfnrB   rM   rC   Ú_try_directlyw   s&   

ÿÿ
ÿþzIntegralTransform._try_directlyc                    s€  ˆ   dd¡}ˆ   dd¡}|ˆ d< ˆjdi ˆ ¤Ž\}}|dur |S |jrš|ˆ d< ‡ ‡fdd„|jD ƒ}g }g }|D ].}	t|	tƒsB|	g}	| |	d ¡ t|	ƒd	krW| |	d
 ¡ q8t|	ƒd	krf||	d
d… g7 }q8|dkrrt|Ž  	¡ }nt|Ž }|sz|S zˆ 
|¡}t|ƒrŒ|ft|ƒ W S ||fW S  ty™   Y nw |r¥tˆjjˆjdƒ‚| ˆj¡\}
}|
ˆjt|Ž gtˆjd
d… ƒ Ž  S )aÍ  
        Try to evaluate the transform in closed form.

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

        This general function handles linearity, but apart from that leaves
        pretty much everything to _compute_transform.

        Standard hints are the following:

        - ``simplify``: whether or not to simplify the result
        - ``noconds``: if True, do not return convergence conditions
        - ``needeval``: if True, raise IntegralTransformError instead of
                        returning IntegralTransform objects

        The default values of these hints depend on the concrete transform,
        usually the default is
        ``(simplify, noconds, needeval) = (True, False, False)``.
        ÚneedevalFÚsimplifyTNc                    s6   g | ]}ˆj |gtˆjd d… ƒ Ž jdi ˆ ¤Ž‘qS )rO   NrB   )rA   ÚlistrL   Údoit©rh   r[   ©r]   r=   rB   rC   Ú
<listcomp>¨   s    .ÿz*IntegralTransform.doit.<locals>.<listcomp>r   rQ   rO   rB   )Úpoprp   rm   rL   Ú
isinstanceÚtupleÚappendÚlenr   rr   rf   r7   r9   rA   Ú_namer<   Úas_coeff_mulrP   r   rs   )r=   r]   rq   rr   ro   rn   Úresrd   Úressr[   ÚcoeffÚrestrB   rv   rC   rt   ˆ   sR   ÿ
€

ÿÿ&zIntegralTransform.doitc                 C   s   |   | j| j| j¡S rV   )ra   r<   rP   rR   rM   rB   rB   rC   Úas_integralÏ   s   ÿzIntegralTransform.as_integralc                 O   s   | j S rV   )rƒ   )r=   rL   ÚkwargsrB   rB   rC   Ú_eval_rewrite_as_IntegralÔ   ó   z+IntegralTransform._eval_rewrite_as_IntegralN)rD   rE   rF   rG   Úpropertyr<   rP   rR   rS   r^   ra   rf   rp   rt   rƒ   r…   rB   rB   rB   rC   rI   <   s$    



G
rI   c                 C   s4   |rddl m} ddlm} ||t| ƒdd�ƒS | S )Nr   )rr   )Ú	powdenestT)Úpolar)Úsympy.simplifyrr   Úsympy.simplify.powsimprˆ   r"   )Úexprrt   rr   rˆ   rB   rB   rC   Ú	_simplifyØ   s
   r�   c                    s   ‡ fdd„}|S )aV  
    This is a decorator generator for dropping convergence conditions.

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

    Suppose you define a function ``transform(*args)`` which returns a tuple of
    the form ``(result, cond1, cond2, ...)``.

    Decorating it ``@_noconds_(default)`` will add a new keyword argument
    ``noconds`` to it. If ``noconds=True``, the return value will be altered to
    be only ``result``, whereas if ``noconds=False`` the return value will not
    be altered.

    The default value of the ``noconds`` keyword will be ``default`` (i.e. the
    argument of this function).
    c                    s   t ˆ ƒˆdœ‡ fdd„
ƒ}|S )N©Únocondsc                    s   ˆ |i |¤Ž}| r|d S |S ©Nr   rB   )r�   rL   r„   r   ©ri   rB   rC   Úwrapperó   s   z0_noconds_.<locals>.make_wrapper.<locals>.wrapper)r   )ri   r’   ©Údefaultr‘   rC   Úmake_wrapperò   s   z_noconds_.<locals>.make_wrapperrB   )r”   r•   rB   r“   rC   Ú	_noconds_à   s   r–   Fc                 C   s   t | |tjtjfƒS rV   )r+   r   ÚZeroÚInfinity)rZ   r[   rB   rB   rC   Ú_default_integrator  ó   r™   Tc                    sþ   t dd| ƒ‰||ˆd  |  |ƒ}| t¡s't| ˆ|¡|ƒtjtjftjfS |j	s0t
d| dƒ‚|jd \}}| t¡rBt
d| dƒ‚‡fdd	„‰ ‡ fd
d„t|ƒD ƒ}dd„ |D ƒ}|jdd„ d� |sjt
d| dƒ‚|d \}}	}
t| ˆ|¡|ƒ||	f|
fS )z0 Backend function to compute Mellin transforms. r\   zmellin-transformrO   ÚMellinúcould not compute integralr   úintegral in unexpected formc                    sH  ddl m} tj}tj}tj}tt| ƒƒ}tddd�}|D ]�}tj}tj}	g }
t	|ƒD ]M}| 
tdd„ ¡ tˆ ƒ|¡}|jrM|jdv sM| ˆ ¡sM| |¡sS|
|g7 }
q+|||ƒ}|jr`|jdv rf|
|g7 }
q+|j|krrt|j|	ƒ}	q+t|j|ƒ}q+|tjurˆ||krˆt||ƒ}q|	tjur—|	|kr—t|	|ƒ}qt|t|
Ž ƒ}q|||fS )	zN
        Turn ``cond`` into a strip (a, b), and auxiliary conditions.
        r   )Ú_solve_inequalityÚtT)Úrealc                 S   s   |   ¡ d S r�   )Úas_real_imag©r[   rB   rB   rC   Ú<lambda>)  s    z:_mellin_transform.<locals>.process_conds.<locals>.<lambda>)z==z!=)Úsympy.solvers.inequalitiesrž   r   ÚNegativeInfinityr˜   Útruer/   r.   r   r0   Úreplacer   ÚsubsÚis_RelationalÚrel_oprg   Últsr   Úgtsr    r2   r1   )re   rž   ÚaÚbÚauxÚcondsrŸ   ÚcÚa_Úb_Zaux_ÚdÚd_Úsoln)r\   rB   rC   Úprocess_conds  sL   ÿÿ
ÿÿ





z(_mellin_transform.<locals>.process_condsc                    s   g | ]}ˆ |ƒ‘qS rB   rB   ©rh   r±   )r·   rB   rC   rw   @  ó    z%_mellin_transform.<locals>.<listcomp>c                 S   s   g | ]
}|d  dkr|‘qS )rQ   FrB   ru   rB   rB   rC   rw   A  ó    c                 S   s   | d | d  t | d ƒfS )Nr   rO   rQ   )r	   r¢   rB   rB   rC   r£   B  rº   z#_mellin_transform.<locals>.<lambda>©Úkeyzno convergence found)r-   rg   r,   r�   r¨   r   r¥   r˜   r¦   Úis_Piecewiser9   rL   r0   Úsort)rZ   r[   Ús_Ú
integratorrr   ÚFre   r°   r­   r®   r¯   rB   )r·   r\   rC   Ú_mellin_transform  s&   
"
ÿ'rÂ   c                   @   s,   e Zd ZdZdZdd„ Zdd„ Zdd„ Zd	S )
ÚMellinTransformzâ
    Class representing unevaluated Mellin transforms.

    For usage of this class, see the :class:`IntegralTransform` docstring.

    For how to compute Mellin transforms, see the :func:`mellin_transform`
    docstring.
    r›   c                 K   s   t |||fi |¤ŽS rV   )rÂ   rY   rB   rB   rC   r^   W  rš   z"MellinTransform._compute_transformc                 C   s    t |||d   |tjtjfƒS ©NrO   )r,   r   r—   r˜   r`   rB   rB   rC   ra   Z  s    zMellinTransform._as_integralc           	      C   sŒ   g }g }g }|D ]\\}}}||g7 }||g7 }||g7 }qt |Ž t|Ž ft|Ž f}|d d |d d kdks>|d dkrDtdd dƒ‚|S )Nr   rO   TFr›   zno combined convergence.)r   r    r2   r9   )	r=   rd   r­   r®   re   ÚsaÚsbr±   r   rB   rB   rC   rf   ]  s   

(ÿzMellinTransform._collapse_extraN)rD   rE   rF   rG   r}   r^   ra   rf   rB   rB   rB   rC   rÃ   K  s    	rÃ   c                 K   ó   t | ||ƒjdi |¤ŽS )a  
    Compute the Mellin transform `F(s)` of `f(x)`,

    .. math :: F(s) = \int_0^\infty x^{s-1} f(x) \mathrm{d}x.

    For all "sensible" functions, this converges absolutely in a strip
      `a < \operatorname{Re}(s) < b`.

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

    The Mellin transform is related via change of variables to the Fourier
    transform, and also to the (bilateral) Laplace transform.

    This function returns ``(F, (a, b), cond)``
    where ``F`` is the Mellin transform of ``f``, ``(a, b)`` is the fundamental strip
    (as above), and ``cond`` are auxiliary convergence conditions.

    If the integral cannot be computed in closed form, this function returns
    an unevaluated :class:`MellinTransform` object.

    For a description of possible hints, refer to the docstring of
    :func:`sympy.integrals.transforms.IntegralTransform.doit`. If ``noconds=False``,
    then only `F` will be returned (i.e. not ``cond``, and also not the strip
    ``(a, b)``).

    Examples
    ========

    >>> from sympy import mellin_transform, exp
    >>> from sympy.abc import x, s
    >>> mellin_transform(exp(-x), x, s)
    (gamma(s), (0, oo), True)

    See Also
    ========

    inverse_mellin_transform, laplace_transform, fourier_transform
    hankel_transform, inverse_hankel_transform
    NrB   )rÃ   rt   )rZ   r[   r\   r]   rB   rB   rC   Úmellin_transforml  s   )rÈ   c                 C   sp   | \}}t |t ƒ}t |t ƒ}t| | | ¡ d  ƒ}t|| | | ƒtd| | ||  ƒd| t fS )aˆ  
    Re-write the sine function ``sin(m*s + n)`` as gamma functions, compatible
    with the strip (a, b).

    Return ``(gamma1, gamma2, fac)`` so that ``f == fac/(gamma1 * gamma2)``.

    Examples
    ========

    >>> from sympy.integrals.transforms import _rewrite_sin
    >>> from sympy import pi, S
    >>> from sympy.abc import s
    >>> _rewrite_sin((pi, 0), s, 0, 1)
    (gamma(s), gamma(1 - s), pi)
    >>> _rewrite_sin((pi, 0), s, 1, 0)
    (gamma(s - 1), gamma(2 - s), -pi)
    >>> _rewrite_sin((pi, 0), s, -1, 0)
    (gamma(s + 1), gamma(-s), -pi)
    >>> _rewrite_sin((pi, pi/2), s, S(1)/2, S(3)/2)
    (gamma(s - 1/2), gamma(3/2 - s), -pi)
    >>> _rewrite_sin((pi, pi), s, 0, 1)
    (gamma(s), gamma(1 - s), -pi)
    >>> _rewrite_sin((2*pi, 0), s, 0, S(1)/2)
    (gamma(2*s), gamma(1 - 2*s), pi)
    >>> _rewrite_sin((2*pi, 0), s, S(1)/2, 1)
    (gamma(2*s - 1), gamma(2 - 2*s), -pi)
    r   rO   éÿÿÿÿ)r   r   r   r¡   r)   )Zm_nr\   r­   r®   ÚmÚnÚrrB   rB   rC   Ú_rewrite_sin˜  s
   %6rÍ   c                   @   s   e Zd ZdZdS )ÚMellinTransformStripErrorzF
    Exception raised by _rewrite_gamma. Mainly for internal use.
    N)rD   rE   rF   rG   rB   rB   rB   rC   rÎ   Å  s    rÎ   c           -         sÆ  t ||gƒ\‰ ‰‡ ‡fdd„}g }ˆ t¡D ]#}| ˆ¡sq|jd }|jr-| ˆ¡d }| ˆ¡\}}	||g7 }qˆ tt	t
t¡D ]%}| ˆ¡sJqB|jd }|jrY| ˆ¡d }| ˆ¡\}}	||t g7 }qBdd„ |D ƒ}t j‰|D ]	}
|
js}|
‰ nqt‡fdd„|D ƒ}tdd	„ |D ƒƒr“ˆjs™td
ddƒ‚ˆttdd„ |D ƒt jƒ }|ˆkrÀt|ƒdkr´ˆ}nˆttdd„ |D ƒƒ }ˆ ˆˆ| ¡‰t j| }t j| }ˆ durÚˆ |9 ‰ ˆdurâˆ|9 ‰ˆ ¡ \}}t |¡}t |¡}tt|tdƒƒƒtt|tdƒƒƒ }g }g }g }g }g }‡fdd„‰|�r| ¡ \‰‰ˆ�r(||}}|}n||}}|}‡‡‡fdd„}ˆ ˆ¡�sD|ˆg7 }�nÁˆj�sNtˆt ƒ�r¢ˆj�rYˆj!}ˆj }nt"dƒ}ˆj }|j#�r{ˆ}|dk �rn| }|||fgt$|ƒ 7 }�q| ˆ¡�sž||ƒ\}}ˆ�sŽd| }||| g7 }||| g7 }�ngˆˆƒ‚ˆ %ˆ¡�r#t&ˆˆƒ}| '¡ dk�rà| (¡ d }t)|ˆƒ}t|ƒ| '¡ k�rÍt* +|¡}||g7 }|‡‡fdd„|D ƒ7 }�q| ,¡ \}}||g7 }||  }||ˆƒ�r|t j| d fg7 }|t j| fg7 }nú|dg7 }|t j-|d fg7 }|t j-|fg7 }nâtˆtƒ�ra|ˆjd ƒ\}}ˆ�rY|dk�rE|| | ˆƒdk�sU|dk �rY|| | ˆƒdk�rYt.dƒ‚|||fg7 }n¤tˆtƒ�r ˆjd }ˆ�r‚t|t ƒtd|t  ƒt} }!}"nt/||ƒˆˆ ˆƒ\} }!}"|| ˆ f|!ˆ fg7 }||"g7 }netˆt
ƒ�rÃˆjd }|t|dd�ˆfttd | dd�ˆ fg7 }nBtˆt	ƒ�rÞˆjd }|ttd | dd�ˆfg7 }n'tˆtƒ�rˆjd }|ttd | dd�ˆft|dd�ˆ fg7 }nˆˆƒ‚|�s|t|Ž t|Ž  9 }g g g g f\}#}$}%}&||#|%df||&|$dffD ]“\}'}(})‰|'�rº|' ¡ \}}|dk�r¥|dk�r¥t$t |ƒƒ}|| }*|| }+|j#�sWt0dƒ‚t1|ƒD ]},|'|*|+|,|  fg7 }'�q[ˆ�rˆ|dt d| d  ||t j2   9 }||| g7 }n|dt d| d  ||t j2    }|||  g7 }�q.|dk�r²|( 3d| ¡ n|) 3|¡ |'�s1�q(t|Ž }|#j4t5d� |$j4t5d� |%j4t5d� |&j4t5d� |#|$f|%|&f|||fS )aØ  
    Try to rewrite the product f(s) as a product of gamma functions,
    so that the inverse Mellin transform of f can be expressed as a meijer
    G function.

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

    Return (an, ap), (bm, bq), arg, exp, fac such that
    G((an, ap), (bm, bq), arg/z**exp)*fac is the inverse Mellin transform of f(s).

    Raises IntegralTransformError or MellinTransformStripError on failure.

    It is asserted that f has no poles in the fundamental strip designated by
    (a, b). One of a and b is allowed to be None. The fundamental strip is
    important, because it determines the inversion contour.

    This function can handle exponentials, linear factors, trigonometric
    functions.

    This is a helper function for inverse_mellin_transform that will not
    attempt any transformations on f.

    Examples
    ========

    >>> from sympy.integrals.transforms import _rewrite_gamma
    >>> from sympy.abc import s
    >>> from sympy import oo
    >>> _rewrite_gamma(s*(s+3)*(s-1), s, -oo, oo)
    (([], [-3, 0, 1]), ([-2, 1, 2], []), 1, 1, -1)
    >>> _rewrite_gamma((s-1)**2, s, -oo, oo)
    (([], [1, 1]), ([2, 2], []), 1, 1, 1)

    Importance of the fundamental strip:

    >>> _rewrite_gamma(1/s, s, 0, oo)
    (([1], []), ([], [0]), 1, 1, 1)
    >>> _rewrite_gamma(1/s, s, None, oo)
    (([1], []), ([], [0]), 1, 1, 1)
    >>> _rewrite_gamma(1/s, s, 0, None)
    (([1], []), ([], [0]), 1, 1, 1)
    >>> _rewrite_gamma(1/s, s, -oo, 0)
    (([], [1]), ([0], []), 1, 1, -1)
    >>> _rewrite_gamma(1/s, s, None, 0)
    (([], [1]), ([0], []), 1, 1, -1)
    >>> _rewrite_gamma(1/s, s, -oo, None)
    (([], [1]), ([0], []), 1, 1, -1)

    >>> _rewrite_gamma(2**(-s+3), s, -oo, oo)
    (([], []), ([], []), 1/2, 1, 8)
    c                    sˆ   t t| ƒƒ} ˆ du rˆtju rdS ˆ du r| ˆk S ˆdu r!| ˆ kS | ˆkdkr)dS | ˆ kdkr1dS |r5dS ˆ js>ˆjs>| jr@dS tdƒ‚)zU
        Decide whether pole at c lies to the left of the fundamental strip.
        NTFzPole inside critical strip?)r
   r   r   r˜   rS   rÎ   )r±   Úis_numer)r²   r³   rB   rC   Úleft  s    z_rewrite_gamma.<locals>.leftr   rO   c                 S   s   g | ]}|j rt|ƒn|‘qS rB   )Úis_extended_realr   ru   rB   rB   rC   rw   8  s    z"_rewrite_gamma.<locals>.<listcomp>c                    s   g | ]}|ˆ  ‘qS rB   rB   ru   )Úcommon_coefficientrB   rC   rw   >  r¹   c                 s   s   � | ]}|j V  qd S rV   )Úis_Rationalru   rB   rB   rC   rj   ?  s   € z!_rewrite_gamma.<locals>.<genexpr>ÚGammaNzNonrational multiplierc                 S   ó   g | ]}t |jƒ‘qS rB   )r   Úqru   rB   rB   rC   rw   B  s    ÿc                 S   rÕ   rB   )r   Úpru   rB   rB   rC   rw   I  s    TFc                    s   t dˆ d|  ƒS )NúInverse MellinzUnrecognised form '%s'.)r9   )Úfact)rZ   rB   rC   Ú	exceptiona  ó   z!_rewrite_gamma.<locals>.exceptionc                    s8   |   ˆ¡s	ˆ ˆƒ‚t| ˆƒ}| ¡ dkrˆ ˆƒ‚| ¡ S )z7 Test if arg is of form a*s+b, raise exception if not. rO   )Úis_polynomialr5   ÚdegreeÚ
all_coeffs)r   r×   )rÚ   rÙ   r\   rB   rC   Ú
linear_argl  s   

z"_rewrite_gamma.<locals>.linear_argc                    s   g | ]}ˆ| ˆ f‘qS rB   rB   r¸   )rÏ   r\   rB   rC   rw   š  s    rÉ   z Gammas partially over the strip.)ÚevaluaterQ   za is not an integerr»   )6r   rl   r)   rg   rL   rm   Úas_independentr~   r%   r#   r&   r$   r   ÚOnerÓ   ÚallrÑ   r9   r   r   r|   r   r¨   Úas_numer_denomr   Ú	make_argsrs   Úzipr   rx   Úis_Powry   r   Úbaser   Ú
is_Integerr   rÜ   r5   rÝ   ÚLTr3   r6   Ú	all_rootsrÞ   ÚNegativeOnerX   rÍ   Ú	TypeErrorÚrangeÚHalfr{   r¾   r   )-rZ   r\   r­   r®   rÐ   Zs_multipliersÚgr   r�   Ú_r[   Zs_multiplierÚfacÚexponentÚnumerÚdenomrL   ÚfacsZdfacsZnumer_gammasZdenom_gammasÚexponentialsZugammasZlgammasZufacsrß   rè   Úexp_re   r×   Úrsr±   Zgamma1Zgamma2Úfac_ÚanÚapÚbmÚbqZgammasÚplusÚminusÚnewaZnewcÚkrB   )r²   r³   rÒ   rÚ   rZ   rÙ   rÏ   r\   rC   Ú_rewrite_gammaÌ  sT  ?



þÿÿÿÿ



$










  ÿ
&
ÿ
 
ÿšh

ÿ&&

ë€r  c              	      sB  t dd| dd�‰|  t¡} t| ƒt| ƒt| ƒfD �]}|jrT‡ ‡‡‡fdd„|jD ƒ}dd„ |D ƒ}dd„ |D ƒ}t|Ž }ˆ sHt|| 	t
¡d	�}| ˆ|¡t|Ž f  S zt|ˆˆd
 ˆd ƒ\}	}
}}}W n	 tyo   Y qw zt|	|
|ˆ|  ƒ}W n	 ty…   Y qw ˆ r‹|}nDzd
dlm} ||ƒ}W n ty¤   td| dƒ‚w |jrÏt|jƒdkrÏt
ˆt|ƒ ƒ|jd
 jd
  t
t|ƒˆ ƒ|jd jd
   }tt|jƒƒ|jt k g}|ttt|jƒt|jƒkd
t|jƒd kƒtt|jƒƒ|jt kƒg7 }t|Ž }|dk�rtd| dƒ‚||  ˆ|¡|f  S td| dƒ‚)zs A helper for the real inverse_mellin_transform function, this one here
        assumes x to be real and positive. rŸ   zinverse-mellin-transformT)Úpositivec              
      s    g | ]}t |ˆˆˆˆ d d�‘qS )FrŽ   )Ú_inverse_mellin_transform)rh   ÚG©Ú
as_meijergr\   Ústripr[   rB   rC   rw     s
    þ
ÿz-_inverse_mellin_transform.<locals>.<listcomp>c                 S   ó   g | ]}|d  ‘qS )rO   rB   ©rh   r×   rB   rB   rC   rw     r¹   c                 S   r
  )r   rB   r  rB   rB   rC   rw     r¹   )Úgensr   rO   )ÚhyperexpandrØ   zCould not calculate integralé   Fzdoes not convergerb   ) r-   Úrewriter)   r4   r   r
   rm   rL   r   rl   r(   r¨   r2   r  r9   r*   Ú
ValueErrorrŠ   r  rX   r½   r|   r   r   ÚargumentÚdeltar   r1   rü   rþ   r   Únu)rÁ   r\   Úx_r	  r  rð   r€   r°   r   r­   r®   ÚCÚerò   r  Úhr  re   rB   r  rC   r  ÷  s`   
þ$ÿÿÿÿÿ*ÿ
ÿr  Nc                   @   sH   e Zd ZdZdZedƒZedƒZdd„ Ze	dd„ ƒZ
d	d
„ Zdd„ ZdS )ÚInverseMellinTransformzú
    Class representing unevaluated inverse Mellin transforms.

    For usage of this class, see the :class:`IntegralTransform` docstring.

    For how to compute inverse Mellin transforms, see the
    :func:`inverse_mellin_transform` docstring.
    rØ   ÚNoner±   c                 K   s8   |d u rt j}|d u rt j}tj| |||||fi |¤ŽS rV   )r  Ú_none_sentinelrI   Ú__new__)ÚclsrÁ   r\   r[   r­   r®   ÚoptsrB   rB   rC   r  C  s
   zInverseMellinTransform.__new__c                 C   s:   | j d | j d }}|tju rd }|tju rd }||fS )Nr  é   )rL   r  r  )r=   r­   r®   rB   rB   rC   Úfundamental_stripJ  s   

z(InverseMellinTransform.fundamental_stripc                 K   s„   |  dd¡ td u rtttttttt	t
ttthat|ƒD ]}|jr3| |¡r3|jtvr3td|d| ƒ‚q| j}t||||fi |¤ŽS )Nrr   TrØ   zComponent %s not recognised.)rx   Ú_allowedr   r)   r%   r#   r&   r$   r   r   r   r   r   r   r   Úis_Functionrg   ri   r9   r  r  )r=   rÁ   r\   r[   r]   rZ   r	  rB   rB   rC   r^   S  s   þÿ€z)InverseMellinTransform._compute_transformc                 C   sJ   | j j}t|||   ||tjtj  |tjtj  fƒdtj tj  S ©NrQ   )rA   Ú_cr,   r   ÚImaginaryUnitr˜   ÚPi)r=   rÁ   r\   r[   r±   rB   rB   rC   ra   c  s    
ÿÿz#InverseMellinTransform._as_integralN)rD   rE   rF   rG   r}   r   r  r#  r  r‡   r  r^   ra   rB   rB   rB   rC   r  5  s    	
r  c                 K   s$   t | |||d |d ƒjdi |¤ŽS )a"  
    Compute the inverse Mellin transform of `F(s)` over the fundamental
    strip given by ``strip=(a, b)``.

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

    This can be defined as

    .. math:: f(x) = \frac{1}{2\pi i} \int_{c - i\infty}^{c + i\infty} x^{-s} F(s) \mathrm{d}s,

    for any `c` in the fundamental strip. Under certain regularity
    conditions on `F` and/or `f`,
    this recovers `f` from its Mellin transform `F`
    (and vice versa), for positive real `x`.

    One of `a` or `b` may be passed as ``None``; a suitable `c` will be
    inferred.

    If the integral cannot be computed in closed form, this function returns
    an unevaluated :class:`InverseMellinTransform` object.

    Note that this function will assume x to be positive and real, regardless
    of the SymPy assumptions!

    For a description of possible hints, refer to the docstring of
    :func:`sympy.integrals.transforms.IntegralTransform.doit`.

    Examples
    ========

    >>> from sympy import inverse_mellin_transform, oo, gamma
    >>> from sympy.abc import x, s
    >>> inverse_mellin_transform(gamma(s), s, x, (0, oo))
    exp(-x)

    The fundamental strip matters:

    >>> f = 1/(s**2 - 1)
    >>> inverse_mellin_transform(f, s, x, (-oo, -1))
    x*(1 - 1/x**2)*Heaviside(x - 1)/2
    >>> inverse_mellin_transform(f, s, x, (-1, 1))
    -x*Heaviside(1 - x)/2 - Heaviside(x - 1)/(2*x)
    >>> inverse_mellin_transform(f, s, x, (1, oo))
    (1/2 - x**2/2)*Heaviside(1 - x)/x

    See Also
    ========

    mellin_transform
    hankel_transform, inverse_hankel_transform
    r   rO   NrB   )r  rt   )rÁ   r\   r[   r	  r]   rB   rB   rC   Úinverse_mellin_transformi  s   $5r&  c           
      C   sÊ   t ||  t|tj | | ƒ |tjtjfƒ}| t¡s$t||ƒtj	fS t | |tjtjfƒ}|tjtjtj
fv s=| t¡rCt|| dƒ‚|jsLt|| dƒ‚|jd \}}	| t¡r^t|| dƒ‚t||ƒ|	fS )zñ
    Compute a general Fourier-type transform

    .. math::

        F(k) = a \int_{-\infty}^{\infty} e^{bixk} f(x)\, dx.

    For suitable choice of *a* and *b*, this reduces to the standard Fourier
    and inverse Fourier transforms.
    z$function not integrable on real axisrœ   r   r�   )r+   r   r   r$  r¥   r˜   rg   r,   r�   r¦   ÚNaNr9   r½   rL   )
rZ   r[   r  r­   r®   rc   rr   rÁ   Z
integral_fre   rB   rB   rC   Ú_fourier_transform¥  s   .

r(  c                   @   ó0   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
S )ÚFourierTypeTransformz# Base class for Fourier transforms.c                 C   ó   t d| j ƒ‚©Nz,Class %s must implement a(self) but does not©rX   rA   rM   rB   rB   rC   r­   Ç  ó   ÿzFourierTypeTransform.ac                 C   r+  ©Nz,Class %s must implement b(self) but does notr-  rM   rB   rB   rC   r®   Ë  r.  zFourierTypeTransform.bc                 K   s&   t ||||  ¡ |  ¡ | jjfi |¤ŽS rV   )r(  r­   r®   rA   r}   ©r=   rZ   r[   r  r]   rB   rB   rC   r^   Ï  s   þþz'FourierTypeTransform._compute_transformc                 C   s>   |   ¡ }|  ¡ }t|| t|tj | | ƒ |tjtjfƒS rV   )r­   r®   r,   r   r   r$  r¥   r˜   )r=   rZ   r[   r  r­   r®   rB   rB   rC   ra   Ô  s   .z!FourierTypeTransform._as_integralN©rD   rE   rF   rG   r­   r®   r^   ra   rB   rB   rB   rC   r*  Ä  s    r*  c                   @   ó$   e Zd ZdZdZdd„ Zdd„ ZdS )ÚFourierTransformzå
    Class representing unevaluated Fourier transforms.

    For usage of this class, see the :class:`IntegralTransform` docstring.

    For how to compute Fourier transforms, see the :func:`fourier_transform`
    docstring.
    ZFourierc                 C   ó   dS rÄ   rB   rM   rB   rB   rC   r­   æ  r_   zFourierTransform.ac                 C   ó
   dt j S )Néþÿÿÿ©r   r%  rM   rB   rB   rC   r®   é  ó   
zFourierTransform.bN©rD   rE   rF   rG   r}   r­   r®   rB   rB   rB   rC   r3  Ú  ó
    	r3  c                 K   rÇ   )a’  
    Compute the unitary, ordinary-frequency Fourier transform of ``f``, defined
    as

    .. math:: F(k) = \int_{-\infty}^\infty f(x) e^{-2\pi i x k} \mathrm{d} x.

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

    If the transform cannot be computed in closed form, this
    function returns an unevaluated :class:`FourierTransform` object.

    For other Fourier transform conventions, see the function
    :func:`sympy.integrals.transforms._fourier_transform`.

    For a description of possible hints, refer to the docstring of
    :func:`sympy.integrals.transforms.IntegralTransform.doit`.
    Note that for this transform, by default ``noconds=True``.

    Examples
    ========

    >>> from sympy import fourier_transform, exp
    >>> from sympy.abc import x, k
    >>> fourier_transform(exp(-x**2), x, k)
    sqrt(pi)*exp(-pi**2*k**2)
    >>> fourier_transform(exp(-x**2), x, k, noconds=False)
    (sqrt(pi)*exp(-pi**2*k**2), True)

    See Also
    ========

    inverse_fourier_transform
    sine_transform, inverse_sine_transform
    cosine_transform, inverse_cosine_transform
    hankel_transform, inverse_hankel_transform
    mellin_transform, laplace_transform
    NrB   )r3  rt   ©rZ   r[   r  r]   rB   rB   rC   Úfourier_transformí  ó   'r<  c                   @   r2  )ÚInverseFourierTransformzý
    Class representing unevaluated inverse Fourier transforms.

    For usage of this class, see the :class:`IntegralTransform` docstring.

    For how to compute inverse Fourier transforms, see the
    :func:`inverse_fourier_transform` docstring.
    zInverse Fourierc                 C   r4  rÄ   rB   rM   rB   rB   rC   r­   #  r_   zInverseFourierTransform.ac                 C   r5  r"  r7  rM   rB   rB   rC   r®   &  r8  zInverseFourierTransform.bNr9  rB   rB   rB   rC   r>    r:  r>  c                 K   rÇ   )a¶  
    Compute the unitary, ordinary-frequency inverse Fourier transform of `F`,
    defined as

    .. math:: f(x) = \int_{-\infty}^\infty F(k) e^{2\pi i x k} \mathrm{d} k.

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

    If the transform cannot be computed in closed form, this
    function returns an unevaluated :class:`InverseFourierTransform` object.

    For other Fourier transform conventions, see the function
    :func:`sympy.integrals.transforms._fourier_transform`.

    For a description of possible hints, refer to the docstring of
    :func:`sympy.integrals.transforms.IntegralTransform.doit`.
    Note that for this transform, by default ``noconds=True``.

    Examples
    ========

    >>> from sympy import inverse_fourier_transform, exp, sqrt, pi
    >>> from sympy.abc import x, k
    >>> inverse_fourier_transform(sqrt(pi)*exp(-(pi*k)**2), k, x)
    exp(-x**2)
    >>> inverse_fourier_transform(sqrt(pi)*exp(-(pi*k)**2), k, x, noconds=False)
    (exp(-x**2), True)

    See Also
    ========

    fourier_transform
    sine_transform, inverse_sine_transform
    cosine_transform, inverse_cosine_transform
    hankel_transform, inverse_hankel_transform
    mellin_transform, laplace_transform
    NrB   )r>  rt   ©rÁ   r  r[   r]   rB   rB   rC   Úinverse_fourier_transform*  r=  r@  c           
      C   s†   t ||  ||| | ƒ |tjtjfƒ}| t¡s!t||ƒtjfS |js*t	|| dƒ‚|j
d \}}	| t¡r<t	|| dƒ‚t||ƒ|	fS )a  
    Compute a general sine or cosine-type transform
        F(k) = a int_0^oo b*sin(x*k) f(x) dx.
        F(k) = a int_0^oo b*cos(x*k) f(x) dx.

    For suitable choice of a and b, this reduces to the standard sine/cosine
    and inverse sine/cosine transforms.
    rœ   r   r�   )r+   r   r—   r˜   rg   r,   r�   r¦   r½   r9   rL   )
rZ   r[   r  r­   r®   ÚKrc   rr   rÁ   re   rB   rB   rC   Ú_sine_cosine_transformX  s   (


rB  c                   @   r)  )ÚSineCosineTypeTransformzK
    Base class for sine and cosine transforms.
    Specify cls._kern.
    c                 C   r+  r,  r-  rM   rB   rB   rC   r­   w  r.  zSineCosineTypeTransform.ac                 C   r+  r/  r-  rM   rB   rB   rC   r®   {  r.  zSineCosineTypeTransform.bc                 K   s,   t ||||  ¡ |  ¡ | jj| jjfi |¤ŽS rV   )rB  r­   r®   rA   Ú_kernr}   r0  rB   rB   rC   r^   €  s   ýýz*SineCosineTypeTransform._compute_transformc                 C   s@   |   ¡ }|  ¡ }| jj}t|| ||| | ƒ |tjtjfƒS rV   )r­   r®   rA   rD  r,   r   r—   r˜   )r=   rZ   r[   r  r­   r®   rA  rB   rB   rC   ra   †  s   (z$SineCosineTypeTransform._as_integralNr1  rB   rB   rB   rC   rC  q  s    rC  c                   @   ó(   e Zd ZdZdZeZdd„ Zdd„ ZdS )ÚSineTransformzÜ
    Class representing unevaluated sine transforms.

    For usage of this class, see the :class:`IntegralTransform` docstring.

    For how to compute sine transforms, see the :func:`sine_transform`
    docstring.
    ZSinec                 C   ó   t dƒt tƒ S r"  ©r!   r   rM   rB   rB   rC   r­   š  rÛ   zSineTransform.ac                 C   ó   t jS rV   ©r   râ   rM   rB   rB   rC   r®   �  r†   zSineTransform.bN©	rD   rE   rF   rG   r}   r%   rD  r­   r®   rB   rB   rB   rC   rF  �  ó    	rF  c                 K   rÇ   )a1  
    Compute the unitary, ordinary-frequency sine transform of `f`, defined
    as

    .. math:: F(k) = \sqrt{\frac{2}{\pi}} \int_{0}^\infty f(x) \sin(2\pi x k) \mathrm{d} x.

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

    If the transform cannot be computed in closed form, this
    function returns an unevaluated :class:`SineTransform` object.

    For a description of possible hints, refer to the docstring of
    :func:`sympy.integrals.transforms.IntegralTransform.doit`.
    Note that for this transform, by default ``noconds=True``.

    Examples
    ========

    >>> from sympy import sine_transform, exp
    >>> from sympy.abc import x, k, a
    >>> sine_transform(x*exp(-a*x**2), x, k)
    sqrt(2)*k*exp(-k**2/(4*a))/(4*a**(3/2))
    >>> sine_transform(x**(-a), x, k)
    2**(1/2 - a)*k**(a - 1)*gamma(1 - a/2)/gamma(a/2 + 1/2)

    See Also
    ========

    fourier_transform, inverse_fourier_transform
    inverse_sine_transform
    cosine_transform, inverse_cosine_transform
    hankel_transform, inverse_hankel_transform
    mellin_transform, laplace_transform
    NrB   )rF  rt   r;  rB   rB   rC   Úsine_transform¡  ó   $rM  c                   @   rE  )ÚInverseSineTransformzô
    Class representing unevaluated inverse sine transforms.

    For usage of this class, see the :class:`IntegralTransform` docstring.

    For how to compute inverse sine transforms, see the
    :func:`inverse_sine_transform` docstring.
    zInverse Sinec                 C   rG  r"  rH  rM   rB   rB   rC   r­   Õ  rÛ   zInverseSineTransform.ac                 C   rI  rV   rJ  rM   rB   rB   rC   r®   Ø  r†   zInverseSineTransform.bNrK  rB   rB   rB   rC   rO  È  rL  rO  c                 K   rÇ   )am  
    Compute the unitary, ordinary-frequency inverse sine transform of `F`,
    defined as

    .. math:: f(x) = \sqrt{\frac{2}{\pi}} \int_{0}^\infty F(k) \sin(2\pi x k) \mathrm{d} k.

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

    If the transform cannot be computed in closed form, this
    function returns an unevaluated :class:`InverseSineTransform` object.

    For a description of possible hints, refer to the docstring of
    :func:`sympy.integrals.transforms.IntegralTransform.doit`.
    Note that for this transform, by default ``noconds=True``.

    Examples
    ========

    >>> from sympy import inverse_sine_transform, exp, sqrt, gamma
    >>> from sympy.abc import x, k, a
    >>> inverse_sine_transform(2**((1-2*a)/2)*k**(a - 1)*
    ...     gamma(-a/2 + 1)/gamma((a+1)/2), k, x)
    x**(-a)
    >>> inverse_sine_transform(sqrt(2)*k*exp(-k**2/(4*a))/(4*sqrt(a)**3), k, x)
    x*exp(-a*x**2)

    See Also
    ========

    fourier_transform, inverse_fourier_transform
    sine_transform
    cosine_transform, inverse_cosine_transform
    hankel_transform, inverse_hankel_transform
    mellin_transform, laplace_transform
    NrB   )rO  rt   r?  rB   rB   rC   Úinverse_sine_transformÜ  s   %rP  c                   @   rE  )ÚCosineTransformzâ
    Class representing unevaluated cosine transforms.

    For usage of this class, see the :class:`IntegralTransform` docstring.

    For how to compute cosine transforms, see the :func:`cosine_transform`
    docstring.
    ZCosinec                 C   rG  r"  rH  rM   rB   rB   rC   r­     rÛ   zCosineTransform.ac                 C   rI  rV   rJ  rM   rB   rB   rC   r®     r†   zCosineTransform.bN©	rD   rE   rF   rG   r}   r#   rD  r­   r®   rB   rB   rB   rC   rQ    rL  rQ  c                 K   rÇ   )a:  
    Compute the unitary, ordinary-frequency cosine transform of `f`, defined
    as

    .. math:: F(k) = \sqrt{\frac{2}{\pi}} \int_{0}^\infty f(x) \cos(2\pi x k) \mathrm{d} x.

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

    If the transform cannot be computed in closed form, this
    function returns an unevaluated :class:`CosineTransform` object.

    For a description of possible hints, refer to the docstring of
    :func:`sympy.integrals.transforms.IntegralTransform.doit`.
    Note that for this transform, by default ``noconds=True``.

    Examples
    ========

    >>> from sympy import cosine_transform, exp, sqrt, cos
    >>> from sympy.abc import x, k, a
    >>> cosine_transform(exp(-a*x), x, k)
    sqrt(2)*a/(sqrt(pi)*(a**2 + k**2))
    >>> cosine_transform(exp(-a*sqrt(x))*cos(a*sqrt(x)), x, k)
    a*exp(-a**2/(2*k))/(2*k**(3/2))

    See Also
    ========

    fourier_transform, inverse_fourier_transform,
    sine_transform, inverse_sine_transform
    inverse_cosine_transform
    hankel_transform, inverse_hankel_transform
    mellin_transform, laplace_transform
    NrB   )rQ  rt   r;  rB   rB   rC   Úcosine_transform  rN  rS  c                   @   rE  )ÚInverseCosineTransformzú
    Class representing unevaluated inverse cosine transforms.

    For usage of this class, see the :class:`IntegralTransform` docstring.

    For how to compute inverse cosine transforms, see the
    :func:`inverse_cosine_transform` docstring.
    zInverse Cosinec                 C   rG  r"  rH  rM   rB   rB   rC   r­   L  rÛ   zInverseCosineTransform.ac                 C   rI  rV   rJ  rM   rB   rB   rC   r®   O  r†   zInverseCosineTransform.bNrR  rB   rB   rB   rC   rT  ?  rL  rT  c                 K   rÇ   )a(  
    Compute the unitary, ordinary-frequency inverse cosine transform of `F`,
    defined as

    .. math:: f(x) = \sqrt{\frac{2}{\pi}} \int_{0}^\infty F(k) \cos(2\pi x k) \mathrm{d} k.

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

    If the transform cannot be computed in closed form, this
    function returns an unevaluated :class:`InverseCosineTransform` object.

    For a description of possible hints, refer to the docstring of
    :func:`sympy.integrals.transforms.IntegralTransform.doit`.
    Note that for this transform, by default ``noconds=True``.

    Examples
    ========

    >>> from sympy import inverse_cosine_transform, sqrt, pi
    >>> from sympy.abc import x, k, a
    >>> inverse_cosine_transform(sqrt(2)*a/(sqrt(pi)*(a**2 + k**2)), k, x)
    exp(-a*x)
    >>> inverse_cosine_transform(1/sqrt(k), k, x)
    1/sqrt(x)

    See Also
    ========

    fourier_transform, inverse_fourier_transform,
    sine_transform, inverse_sine_transform
    cosine_transform
    hankel_transform, inverse_hankel_transform
    mellin_transform, laplace_transform
    NrB   )rT  rt   r?  rB   rB   rC   Úinverse_cosine_transformS  rN  rU  c                 C   s„   t | t||| ƒ | |tjtjfƒ}| t¡s t||ƒtjfS |j	s)t
|| dƒ‚|jd \}}| t¡r;t
|| dƒ‚t||ƒ|fS )zv
    Compute a general Hankel transform

    .. math:: F_\nu(k) = \int_{0}^\infty f(r) J_\nu(k r) r \mathrm{d} r.
    rœ   r   r�   )r+   r'   r   r—   r˜   rg   r,   r�   r¦   r½   r9   rL   )rZ   rÌ   r  r  rc   rr   rÁ   re   rB   rB   rC   Ú_hankel_transform~  s   &

rV  c                   @   s4   e Zd ZdZdd„ Zdd„ Zdd„ Zedd	„ ƒZd
S )ÚHankelTypeTransformz+
    Base class for Hankel transforms.
    c                 K   s$   | j | j| j| j| jd fi |¤ŽS ©Nr  )r^   r<   rP   rR   rL   )r=   r]   rB   rB   rC   rt   ™  s   ýüzHankelTypeTransform.doitc                 K   s   t ||||| jfi |¤ŽS rV   )rV  r}   )r=   rZ   rÌ   r  r  r]   rB   rB   rC   r^      s   z&HankelTypeTransform._compute_transformc                 C   s&   t |t||| ƒ | |tjtjfƒS rV   )r,   r'   r   r—   r˜   )r=   rZ   rÌ   r  r  rB   rB   rC   ra   £  s   &z HankelTypeTransform._as_integralc                 C   s   |   | j| j| j| jd ¡S rX  )ra   r<   rP   rR   rL   rM   rB   rB   rC   rƒ   ¦  s
   ýzHankelTypeTransform.as_integralN)	rD   rE   rF   rG   rt   r^   ra   r‡   rƒ   rB   rB   rB   rC   rW  ”  s    rW  c                   @   ó   e Zd ZdZdZdS )ÚHankelTransformzâ
    Class representing unevaluated Hankel transforms.

    For usage of this class, see the :class:`IntegralTransform` docstring.

    For how to compute Hankel transforms, see the :func:`hankel_transform`
    docstring.
    ZHankelN©rD   rE   rF   rG   r}   rB   rB   rB   rC   rZ  ®  ó    	rZ  c                 K   ó   t | |||ƒjdi |¤ŽS )aÙ  
    Compute the Hankel transform of `f`, defined as

    .. math:: F_\nu(k) = \int_{0}^\infty f(r) J_\nu(k r) r \mathrm{d} r.

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

    If the transform cannot be computed in closed form, this
    function returns an unevaluated :class:`HankelTransform` object.

    For a description of possible hints, refer to the docstring of
    :func:`sympy.integrals.transforms.IntegralTransform.doit`.
    Note that for this transform, by default ``noconds=True``.

    Examples
    ========

    >>> from sympy import hankel_transform, inverse_hankel_transform
    >>> from sympy import exp
    >>> from sympy.abc import r, k, m, nu, a

    >>> ht = hankel_transform(1/r**m, r, k, nu)
    >>> ht
    2*k**(m - 2)*gamma(-m/2 + nu/2 + 1)/(2**m*gamma(m/2 + nu/2))

    >>> inverse_hankel_transform(ht, k, r, nu)
    r**(-m)

    >>> ht = hankel_transform(exp(-a*r), r, k, 0)
    >>> ht
    a/(k**3*(a**2/k**2 + 1)**(3/2))

    >>> inverse_hankel_transform(ht, k, r, 0)
    exp(-a*r)

    See Also
    ========

    fourier_transform, inverse_fourier_transform
    sine_transform, inverse_sine_transform
    cosine_transform, inverse_cosine_transform
    inverse_hankel_transform
    mellin_transform, laplace_transform
    NrB   )rZ  rt   )rZ   rÌ   r  r  r]   rB   rB   rC   Úhankel_transform»  ó   .r^  c                   @   rY  )ÚInverseHankelTransformzú
    Class representing unevaluated inverse Hankel transforms.

    For usage of this class, see the :class:`IntegralTransform` docstring.

    For how to compute inverse Hankel transforms, see the
    :func:`inverse_hankel_transform` docstring.
    zInverse HankelNr[  rB   rB   rB   rC   r`  ì  r\  r`  c                 K   r]  )aß  
    Compute the inverse Hankel transform of `F` defined as

    .. math:: f(r) = \int_{0}^\infty F_\nu(k) J_\nu(k r) k \mathrm{d} k.

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

    If the transform cannot be computed in closed form, this
    function returns an unevaluated :class:`InverseHankelTransform` object.

    For a description of possible hints, refer to the docstring of
    :func:`sympy.integrals.transforms.IntegralTransform.doit`.
    Note that for this transform, by default ``noconds=True``.

    Examples
    ========

    >>> from sympy import hankel_transform, inverse_hankel_transform
    >>> from sympy import exp
    >>> from sympy.abc import r, k, m, nu, a

    >>> ht = hankel_transform(1/r**m, r, k, nu)
    >>> ht
    2*k**(m - 2)*gamma(-m/2 + nu/2 + 1)/(2**m*gamma(m/2 + nu/2))

    >>> inverse_hankel_transform(ht, k, r, nu)
    r**(-m)

    >>> ht = hankel_transform(exp(-a*r), r, k, 0)
    >>> ht
    a/(k**3*(a**2/k**2 + 1)**(3/2))

    >>> inverse_hankel_transform(ht, k, r, 0)
    exp(-a*r)

    See Also
    ========

    fourier_transform, inverse_fourier_transform
    sine_transform, inverse_sine_transform
    cosine_transform, inverse_cosine_transform
    hankel_transform
    mellin_transform, laplace_transform
    NrB   )r`  rt   )rÁ   r  rÌ   r  r]   rB   rB   rC   Úinverse_hankel_transformù  r_  ra  )F)T)ˆrG   Ú	functoolsr   r   Ú	itertoolsr   Ú
sympy.corer   r   Úsympy.core.addr   Úsympy.core.functionr   r	   r
   r   r   Úsympy.core.mulr   Zsympy.core.intfuncr   r   Úsympy.core.sortingr   Úsympy.core.symbolr   Úsympy.core.traversalr   Ú(sympy.functions.combinatorial.factorialsr   r   Ú$sympy.functions.elementary.complexesr   r   r   Ú&sympy.functions.elementary.exponentialr   r   Ú%sympy.functions.elementary.hyperbolicr   r   r   r   Ú#sympy.functions.elementary.integersr   Ú(sympy.functions.elementary.miscellaneousr   r    r!   Ú$sympy.functions.elementary.piecewiser"   Ú(sympy.functions.elementary.trigonometricr#   r$   r%   r&   Úsympy.functions.special.besselr'   Ú'sympy.functions.special.delta_functionsr(   Ú'sympy.functions.special.gamma_functionsr)   Úsympy.functions.special.hyperr*   Úsympy.integralsr+   r,   Zsympy.integrals.meijerintr-   Úsympy.logic.boolalgr.   r/   r0   r1   r2   Úsympy.polys.polyrootsr3   Úsympy.polys.polytoolsr4   r5   Úsympy.polys.rootoftoolsr6   Úsympy.utilities.iterablesr7   Úsympy.utilities.miscr8   rX   r9   rI   r�   r–   Z_nocondsr™   rÂ   rÃ   rÈ   rÍ   r  rÎ   r  r  r   r  r&  r(  r*  r3  r<  r>  r@  rB  rC  rF  rM  rO  rP  rQ  rS  rT  rU  rV  rW  rZ  r^  r`  ra  Zsympy.integrals.laplaceÚ	integralsÚlaplaceZ_laplaceÚLaplaceTransformÚlaplace_transformÚlaplace_correspondenceÚlaplace_initial_condsÚInverseLaplaceTransformÚinverse_laplace_transformrB   rB   rB   rC   Ú<module>   s¨     D!,-  -:4<*.'('+16
