o
    *ήcHe                    @   s6  d Z ddlmZmZ ddlmZ ddlmZmZm	Z	 ddl
mZ ddlmZmZmZmZ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mZmZmZm Z m!Z! dd
l"m#Z#m$Z$ ddl%m&Z&m'Z'm(Z( ddl)m*Z* ddl+m,Z,m-Z- ddl.m/Z/m0Z0m1Z1m2Z2m3Z3 ddl4m5Z5m6Z6m7Z7 ddl8m9Z9m:Z:m;Z;m<Z<m=Z= ddl>m?Z? ddl@mAZAmBZBmCZC ddlDmEZEmFZF ddlGmHZHmIZImJZJmKZKmLZL ddlMmNZNmOZOmPZPmQZQ ddlRmSZSmTZT ddlUmVZVmWZWmXZX ddlYmZZZm[Z[m\Z\ ddl]m^Z^ ddl_m`Z`maZa ddlbmcZc ddldmeZemfZfmgZgmhZhmiZi ddljmkZk ddllmmZmmnZn ddlompZp dd lqmrZrmsZs dd!ltmuZu dd"lvmwZwmxZx dd#lymzZzm{Z{m|Z| dd$l}m~Z~ dd%lmZ G d&d' d'eZG d(d) d)eZd*d+ Zd,d- Zed.Zd/d0 Zeed1fd2d3ZG d4d5 d5eZd6d7 Zd8d9 ZG d:d; d;eZd<d= Zed1dd>d?Zd@aG dAdB dBeZdCdD ZdEdF ZdGdH ZeddIdJZdKdL ZdMdN ZdOdP ZddQdRZddSdTZddUdVZddWdXZddYdZZdd[d\ZG d]d^ d^eZdd_d`Zed1ddadbZG dcdd ddeZddedfZdgdh Zed1ddidjZG dkdl dleZG dmdn dneZdodp ZG dqdr dreZdsdt Zed1ddudvZG dwdx dxeZG dydz dzeZd{d| ZG d}d~ d~eZdd ZG dd deZdd ZG dd deZdd Zed1dddZG dd deZG dd deZdd ZG dd deZdd Zd@S )z Integral Transforms     )reducewraps)repeat)SpiI)Add)	AppliedUndef	count_ops
Derivativeexpandexpand_complex
expand_mulFunctionLambdaWildFunction)Mul)igcdilcm)
_canonicalGeGtLt
UnequalityEq)default_sort_keyordered)DummysymbolsWild)postorder_traversal)	factorialrf)reargAbs
polar_liftperiodic_argument)explog	exp_polar)coshcothsinhtanhasinh)ceiling)MaxMinsqrt)	Piecewisepiecewise_fold)coscotsintanatan)besselibesseljbesselkbessely)
DiracDelta	Heaviside)erferfcEi)digammagamma
lowergamma)meijerg)	integrateIntegral)_dummy)to_cnf	conjuncts	disjunctsOrAnd)
MatrixBase)_lin_eq2dictPolyNonlinearError)roots)factorPoly)together)CRootOfRootSum)sympy_deprecation_warningSymPyDeprecationWarningignore_warnings)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	transformra   msg	__class__ A/tmp/pip-target-vg8gfxp4/lib/python/sympy/integrals/transforms.pyr`   @   s   

zIntegralTransformError.__init__)__name__
__module____qualname____doc__r`   __classcell__rg   rg   re   rh   r^   2   s    r^   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rb   rg   rg   rh   ra   ]      
zIntegralTransform.functionc                 C   ro   )z; The dependent variable of the function to be transformed.    rp   rr   rg   rg   rh   function_variableb   rs   z#IntegralTransform.function_variablec                 C   ro   )z% The independent transform variable.    rp   rr   rg   rg   rh   transform_variableg   rs   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.
        )ra   free_symbolsunionrw   ru   rr   rg   rg   rh   rx   l   s   zIntegralTransform.free_symbolsc                 K      t NNotImplementedErrorrb   fxshintsrg   rg   rh   _compute_transformu      z$IntegralTransform._compute_transformc                 C   rz   r{   r|   rb   r   r   r   rg   rg   rh   _as_integralx   r   zIntegralTransform._as_integralc                 C   s$   t | }|dkrt| jjd d|S )NF )rO   r^   rf   name)rb   extracondrg   rg   rh   _collapse_extra{   s   z!IntegralTransform._collapse_extrac                    s|   d }t  fdd jtD  }|r0z j j j jfi |}W n ty/   d }Y nw  j}|js:t	|}||fS )Nc                 3   s    | ]	}|  jV  qd S r{   )hasru   .0funcrr   rg   rh   	<genexpr>   s    z2IntegralTransform._try_directly.<locals>.<genexpr>)
anyra   atomsr	   r   ru   rw   r^   is_Addr   )rb   r   Ttry_directlyfnrg   rr   rh   _try_directly   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|rt|gt| W S ||fW S  ty   Y nw |rt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 )rt   Nrg   )rf   listrq   doitr   r   r   rb   rg   rh   
<listcomp>   s    .z*IntegralTransform.doit.<locals>.<listcomp>r   rv   rt   rg   )popr   r   rq   
isinstancetupleappendlenr   r   r   r\   r^   rf   _namera   as_coeff_mulru   r   r   )rb   r   r   r   r   r   resr   ressr   coeffrestrg   r   rh   r      sR   


&zIntegralTransform.doitc                 C   s   |  | j| j| jS r{   )r   ra   ru   rw   rr   rg   rg   rh   as_integral   s   zIntegralTransform.as_integralc                 O   s   | j S r{   )r   )rb   rq   kwargsrg   rg   rh   _eval_rewrite_as_Integral      z+IntegralTransform._eval_rewrite_as_IntegralN)ri   rj   rk   rl   propertyra   ru   rw   rx   r   r   r   r   r   r   r   rg   rg   rg   rh   rn   F   s$    



G
rn   c                 C   s4   |rddl m} ddlm} ||t| ddS | S )Nr   r   )	powdenestT)polar)sympy.simplifyr   sympy.simplify.powsimpr   r5   )exprr   r   r   rg   rg   rh   	_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   rg   )r   rq   r   r   r   rg   rh   wrapper   s   z0_noconds_.<locals>.make_wrapper.<locals>.wrapper)r   )r   r   defaultr   rh   make_wrapper   s   z_noconds_.<locals>.make_wrapperrg   )r   r   rg   r   rh   	_noconds_   s   r   Fc                 C   s   t | |tjtjfS r{   )rH   r   ZeroInfinity)r   r   rg   rg   rh   _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-transformrt   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rt||}q|	tjur|	|krt|	|}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   rg   rg   rh   <lambda>3  s    z:_mellin_transform.<locals>.process_conds.<locals>.<lambda>z==z!=)sympy.solvers.inequalitiesr   r   NegativeInfinityr   truerL   rK   r   rM   replacer#   subsis_Relationalrel_opr   ltsr1   gtsr2   rO   rN   )r   r   abauxcondsr   ca_b_aux_dd_solnr   rg   rh   process_conds#  sP   




z(_mellin_transform.<locals>.process_condsc                       g | ]} |qS rg   rg   r   r   r   rg   rh   r   J      z%_mellin_transform.<locals>.<listcomp>c                 S      g | ]
}|d  dkr|qS )rv   Frg   r   rg   rg   rh   r   K      c                 S   s   | d | d  t | d fS )Nr   rt   rv   r
   r   rg   rg   rh   r   L  r   z#_mellin_transform.<locals>.<lambda>keyno convergence found)rJ   r   rI   r   r   r   r   r   r   is_Piecewiser^   rq   rM   sort)r   r   s_
integratorr   Fr   r   r   r   r   rg   )r   r   rh   _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 r{   )r   r~   rg   rg   rh   r   a  r   z"MellinTransform._compute_transformc                 C   s    t |||d   |tjtjfS Nrt   )rI   r   r   r   r   rg   rg   rh   r   d  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   rt   TFr   zno combined convergence.)r1   r2   rO   r^   )	rb   r   r   r   r   sasbr   r   rg   rg   rh   r   g  s   

(zMellinTransform._collapse_extraN)ri   rj   rk   rl   r   r   r   r   rg   rg   rg   rh   r   U  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
    Nrg   )r   r   )r   r   r   r   rg   rg   rh   mellin_transformv  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   rt   )r   r   r0   r   rE   )m_nr   r   r   mnrrg   rg   rh   _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)ri   rj   rk   rl   rg   rg   rg   rh   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std
ddttdd |D t j }|krt|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||\}}sd| }||| g7 }||| g7 }ng%r#t&}|' dkr|( d }t)|}t||' krt*+|}||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 }nttra|jd \}}rY|dkrE|| | dksU|dk rY|| | dkrYt.d|||fg7 }nttrjd }rt|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rt$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   rx   r  )r   is_numer)r   r   rg   rh   left  s    z_rewrite_gamma.<locals>.leftr   rt   c                 S   s   g | ]}|j rt|n|qS rg   )is_extended_realr%   r   rg   rg   rh   r   B  s    z"_rewrite_gamma.<locals>.<listcomp>c                    s   g | ]}|  qS rg   rg   r   )common_coefficientrg   rh   r   H  r   c                 s   s    | ]}|j V  qd S r{   )is_Rationalr   rg   rg   rh   r   I  s    z!_rewrite_gamma.<locals>.<genexpr>GammaNzNonrational multiplierc                 S      g | ]}t |jqS rg   )r   qr   rg   rg   rh   r   L  s    c                 S   r  rg   )r   pr   rg   rg   rh   r   S      TFc                    s   t d d|  S )NInverse MellinzUnrecognised form '%s'.)r^   )factr   rg   rh   	exceptionk     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. rt   )is_polynomialrU   degree
all_coeffs)r$   r
  )r  r  r   rg   rh   
linear_argv  s   

z"_rewrite_gamma.<locals>.linear_argc                    s   g | ]}|  fqS rg   rg   r   )r  r   rg   rh   r     s    r   z Gammas partially over the strip.)evaluaterv   za is not an integerr   )6r   r   rE   r   rq   r   as_independentr   r8   r6   r9   r7   r   Oner  allr  r^   r   r   r   r   r   as_numer_denomr   	make_argsr   zipr   r   is_Powr   r(   baser*   
is_Integerr%   r  rU   r  LTrS   rW   	all_rootsr  NegativeOner}   r   	TypeErrorrangeHalfr   r   r   )-r   r   r   r   r  s_multipliersgr$   r   _r   s_multiplierfacexponentnumerdenomrq   facsdfacsnumer_gammasdenom_gammasexponentialsugammaslgammasufacsr  r  exp_r   r
  rsr   gamma1gamma2fac_anapbmbqgammasplusminusnewanewckrg   )r   r   r  r  r   r  r  r   rh   _rewrite_gamma  sZ  ?







$










 
&

 
h

&&

rD  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rt|jdkrt
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)r   G
as_meijergr   stripr   rg   rh   r     s
    
z-_inverse_mellin_transform.<locals>.<listcomp>c                 S      g | ]}|d  qS )rt   rg   r   r
  rg   rg   rh   r     r   c                 S   rK  )r   rg   rL  rg   rg   rh   r     r   )gensr   rt   )hyperexpandr  zCould not calculate integral   Fzdoes not converger   ) rJ   rewriterE   rT   r   r   r   rq   r   r   r@   r   rO   rD  r^   rG   
ValueErrorr   rN  r}   r   r   r%   r$   argumentdeltar   rN   r;  r=  r#   nu)r   r   x_rJ  rI  r&  r   r   r   r   r   Cer)  rG  hrN  r   rg   rH  rh   rF    s`   
$*
rF  Nc                   @   H   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 r{   )rZ  _none_sentinelrn   __new__)clsr   r   r   r   r   optsrg   rg   rh   r]  M  s
   zInverseMellinTransform.__new__c                 C   s:   | j d | j d }}|tju rd }|tju rd }||fS )NrO     )rq   rZ  r\  )rb   r   r   rg   rg   rh   fundamental_stripT  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 )Nr   Tr  zComponent %s not recognised.)r   _allowedr(   rE   r8   r6   r9   r7   r+   r-   r.   r,   r!   r"   r    is_Functionr   r   r^   ra  rF  )rb   r   r   r   r   r   rJ  rg   rg   rh   r   ]  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 Nrv   )rf   _crI   r   ImaginaryUnitr   Pi)rb   r   r   r   r   rg   rg   rh   r   m  s    
z#InverseMellinTransform._as_integralN)ri   rj   rk   rl   r   r   r\  re  r]  r   ra  r   r   rg   rg   rg   rh   rZ  ?  s    	
rZ  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   rt   Nrg   )rZ  r   )r   r   r   rJ  r   rg   rg   rh   inverse_mellin_transforms  s   $5rh  c                    s   fdd fddfddfdd}d	d
 }ddl m} || } || t} || tfdd} || t|} t| S )a  
    Naively simplify some conditions occurring in ``expr``, given that `\operatorname{Re}(s) > a`.

    Examples
    ========

    >>> from sympy.integrals.transforms import _simplifyconds as simp
    >>> from sympy.abc import x
    >>> from sympy import sympify as S
    >>> simp(abs(x**2) < 1, x, 1)
    False
    >>> simp(abs(x**2) < 1, x, 2)
    False
    >>> simp(abs(x**2) < 1, x, 0)
    Abs(x**2) < 1
    >>> simp(abs(1/x**2) < 1, x, 1)
    True
    >>> simp(S(1) < abs(x), x, 1)
    True
    >>> simp(S(1) < abs(1/x), x, 1)
    False

    >>> from sympy import Ne
    >>> simp(Ne(1, x**3), x, 1)
    True
    >>> simp(Ne(1, x**3), x, 2)
    True
    >>> simp(Ne(1, x**3), x, 0)
    Ne(1, x**3)
    c                    s&   |  krdS | j r| j kr| jS d S r   )r  r  r(   )exr   rg   rh   power  s
   z_simplifyconds.<locals>.powerc                    s   |  r| rdS t| tr| jd } t|tr |jd }|  r.d| d|  S |}|du r8dS z,|dkrLt| t | kdkrLW dS |dk r_t| t | kdkrbW dS W dS W dS  tyn   Y dS w )z_ Return True only if |ex1| > |ex2|, False only if |ex1| < |ex2|.
            Else return None. Nr   rt   TF)r   r   r%   rq   r"  )ex1ex2r   )r   biggerrj  r   rg   rh   rm    s(   




  z_simplifyconds.<locals>.biggerc                    sH   | j st| tr|j st|ts| |k S  | |}|dur | S | |k S )z simplify x < y N)is_positiver   r%   )r   yr   rm  rg   rh   replie  s   
z_simplifyconds.<locals>.repliec                    s     | |}|dv rdS t | |S )NTFT)r   )r   ro  r   rp  rg   rh   replue  s   

z_simplifyconds.<locals>.repluec                 W   s   | dv rt | S | j| S )Nrr  )boolr   )ri  rq   rg   rg   rh   repl  s   
z_simplifyconds.<locals>.replr   )collect_absc                    s
    || S r{   rg   )r   ro  )rq  rg   rh   r        
 z _simplifyconds.<locals>.<lambda>)sympy.simplify.radsimprv  r   r   r   r   )r   r   r   rs  ru  rv  rg   )r   rm  rj  rq  r   rh   _simplifyconds  s    
ry  c                 C   s   t | | tS )zs
    Expand an expression involving DiractDelta to get it as a linear
    combination of DiracDelta functions.
    )rQ   r   r?   r   rg   rg   rh   expand_dirac_delta  s   r{  c                    s*  t dtdgd}g }g }zt\}}W n ty$   tddw | D ]4\}	}
|	t| }|rF||
	d||   q)|	j
d 	djrVtdd||	|
  q)ttt  t|g|R   tjtjft| }|tst|	|tjtjfS |jstdd|j
d \}}|trtdd	fd
dfddt|D }dd |D }|sdd |D }tt|}dd  |j fddd |stdd|d \}}fdd}|rt||}t||}t|	|||t||fS )z The backend function for Laplace transforms.

    This backend assumes that the frontend has already split sums
    such that `f` is to an addition anymore.
    r   r   excludeLaplacez'could not expand DiracDelta expressionsr   znot implemented yet.r   r   c                    s|  ddl m} tj}tj}tt| } tdtgd\}}}}}}	}
|t	t
| |  |k |t	t
| |  |kt	t| | | ||k t	t| | | ||kt	tt| | | ||k t	tt| | | ||kf}| D ]5}tj}g }t|D ]}|jr|jjv r|j}|jrt|ttfr|j}|D ]}||  r nq rψ | jrψ |  |  td krt |   dk }||t|t	t
|
  | t	| |	   dk   s|t|t	t| |
 ||  t	| |	  dk   s0||tt	tt| |
 || t	| |	   dk   rLt fdd||||	|
fD rLt | k}|tdd	 t}|jrp|jd
v sp| sp| sv||g7 }q||}|jr|jd
v r||g7 }q|j!krt"ddt#|j!|}q|tjurt$||}q{t%|t&| }q{||jr|j'fS |fS )z7 Turn ``conds`` into a strip and auxiliary conditions. r   r   zp q w1 w2 w3 w4 w5r^  r}  rv   c                 3   s    | ]} | j V  qd S r{   )rn  )r   wildr   rg   rh   r   _      z<_laplace_transform.<locals>.process_conds.<locals>.<genexpr>c                 S   s   |    d S r   )r   r   r   rg   rg   rh   r   b  s    z;_laplace_transform.<locals>.process_conds.<locals>.<lambda>r   r~  zconvergence not in half-plane?)(r   r   r   r   r   rL   rK   r   r   r%   r$   r'   r&   r   rM   r   rhsrx   reversedr   r   r   reversedsignmatchrn  r   r#   r6   r  r   r   r   r   r   r^   r2   r1   rO   rN   	canonical)r   r   r   r   r
  r	  w1w2w3w4w5patternsr   r   r   r   patr   r   )r   r   r   r  rh   r   9  s     

":4"(


z)_laplace_transform.<locals>.process_condsc                    r   rg   rg   r   r   rg   rh   r   x  r   z&_laplace_transform.<locals>.<listcomp>c                 S   s*   g | ]}|d  dkr|d t jur|qS )rt   Fr   )r   r   r   rg   rg   rh   r   y  s   * c                 S   r   )rt   Frg   r   rg   rg   rh   r   {  r   c                 S   s   | dv rdS |   S )Nrr  r   r   rz  rg   rg   rh   cnt~  s   z_laplace_transform.<locals>.cntc                    s   | d   | d fS Nr   rt   rg   r   )r  rg   rh   r     r  z$_laplace_transform.<locals>.<lambda>r   r   c                    s   |   S r{   )r   rz  )r   r   rg   rh   sbs     z_laplace_transform.<locals>.sbs)r   r   r{  rR   r^   itemsr  r?   r   r   rq   is_zeror   rH   r(   r   r   r   r   rI   r   r   r   r   rM   r   r   r   ry  r   )r   r   r   r   r   	deltazerodeltanonzerointegratable	deltadict
dirac_funcdirac_coeffr
  r   r   r   conds2r   r  rg   )r  r   r   r   r   r   rh   _laplace_transform  sh    

?$r  c                    sP   | j }t| j}t| jdkr| S  fdd|D }|jr$||  S || S )a  
    This is an internal helper function that traverses through the epression
    tree of `f(t)` and collects arguments. The purpose of it is that
    anything like `f(w*t-1*t-c)` will be written as `f((w-1)*t-c)` such that
    it can match `f(a*t+b)`.
    r   c                    s   g | ]}t | qS rg   _laplace_deep_collect)r   r$   r   rg   rh   r     r  z)_laplace_deep_collect.<locals>.<listcomp>)r   r   rq   r   r   collect)r   r   r   rq   rg   r  rh   r    s   
r  c           	   	      s  t d gd}t d gd}t d gd}t d gd}t d gd} fdd}g ||| tjtj|ft|  | t| | | t| tt|d	k|d	kt|d	k |d	ktj|ft|  | td	tt|d	k |d	kt|d	k|d	ktj|fd
d
| tjtj|ft	|  | t| | | | t|d	k|d	ktj|ft	|  | d
t| | |  | t|d	k |d	k tj|ft	|  | d
| t|d	k|d	ktj|ft	|  | d	t|d	k |d	ktj|f d
|d  tjtj|fd
|  |  t| | |  t
| | |  | |d	ktj|fd
t|  |  t|t | t|| |  tt|| |  | |d	ktj|ft  |  tt| tt| t||  tt||   tjtj|f|  | td d  d|td
 d   dt| | td
d   t|| |  tt|| |  |  |d	ktj|f td
d   | d  t| td
d  t|td
d   t||  tt||   tjtj|fd
|t   d   t|td
d   t||  tt||  tjtj|f | t|d
 ||d
   |dktj|f|  | | t|d
 || | t| | |  ||d
   | t|dk|d	ktj|f |  |  || t|d
  t| ||  |dktj|ft|  | t| ||  tj||f t|  |  t| || d  tj||f | t|   t|d
 || |d
   |dk||ft|  d  ttd | t|d d |  t|td|   |d	ktj|f t|  d   d
d|  dtt d| tdd   | t|td|    tjtj|ft|   dt||  td
dt||   |d	ktj|ft t|    td
d tt|d   d
dt||    tdt||   |d	ktj|ft|   t  tt| tdt||   |d	ktj|ft|    t   tt| tdt||   |d	ktj|f | t|    d|| |d
 d   t|d
 dt||   |d	ktj|ftdt|   |d tt| |td d   t||  tt||   tjtj|ftdt|   t  t| td
d  t||  tt||  tjtj|ft|  ||d |d   tjt||ft|  d d|d  |d d|d  |d    tjtd| |ft|    t|| ||  d tj||f | t|   t|d
 d || | d
  || | d
    |dkt||ftdt|   tt| | t| t||  tjtj|ft tdt|    ttd
d  |td d   |d |  t||  tt||  |td
d  |d   tjtj|ftdt|   t  ttd
d  |td
 d   t||  tt||  tjtj|ftt|  d t  ttd
d  d |td
 d   t|| d
  tjtj|ft|  ||d |d   tjt||ft|  d |d d|d   |d d|d  |d    tjtd| |f | t|   t|d
 d || | d
  || | d
    |dkt||ftdt|   d
| tt| | t| t||  tt||   tjtj|ft tdt|    ttd
d  |td d   |d |  t||  tjtj|ftdt|   t  ttd
d  |td
 d   t||  tjtj|ftt|  d t  ttd
d  d |td
 d   t|| d
  tjtj|ft|  t|| tj  | |d	ktj|ftd
|   t||  | t
| |  tjtj|ft|  | t|t|| | | | t
| |   | | |d	ktj|ft t  tt|  td| tj  tjtj|f | t  t|d
 || d
   t|d
 t|  |dktj|ft|  d t|| tj d td d  | |d	ktj|ft|   t  t|| tj  ||  tj| |ft|  ||d |d   tjtj|ftt|  ||d |d   tt| d |  |d	ktj|ft|    t|| tjtj|ft|  d   td
d|d  |d   d tjtj|ft|  d  d  |td| |  |td
d|d  |d    d  tjtj|ftdt|   tt| | t| t| |  |d	ktj|ftdt|     ttt||  |d	ktj|ft|  ||d |d   tjtj|ft|  d |d d|d   |d d|d    | tjtj|ft tdt|    ttd |td d   |d|   t| |  |d	ktj|ftdt|   t  tt| t| |  |d	ktj|ft|  t|   d| | | |d || d   |d || d   tjtj|ft|  t|   ||d |d  |d   |d || d   |d || d   tjtj|ft|  t|   ||d |d  |d   |d || d   |d || d   tjtj|ft|  t|   ||| d |d   tj||ft|  t|   || || d |d   tj||ft|  t|d d| d  t|d|   | |d	ktj|ftt|  t|t||  | |d	ktj|ft|  tt|   t|t| ||  |d	k||ftt|  d d
tt||   | |d	ktj|ftt|  t|| t| t||  | |d	ktj|ft|  tt|   d
|t||   |d	ktj|ftt|  d tt||  | |d	ktj|ft||  || t|d |d  |t|d |d   |   t|d	k|dktj|f | t||   d| tt t|tj  ||  |d |d  | tj   tt|d	k|tj kt||tj|f | t||   d|d
  tt t|tdd   ||  | |d |d  | tdd    tt|d	k|dkt||d
 tj|ftd	dt|   t| | | |d	ktj|f | t|dt|    ||d  || d
   t| |  tt|d	k|dkt||tj tj|ftd	|t d |    t|| |t|d |d    t|d |d   |d	ktj|ft||  || t|d |d  |t|d |d   |   t|d	k|dkt||f | t||   d| tt t|tj  ||  |d |d  | tj   tt|d	k|tj kt||t||f | t||   d|d
  tt t|tdd   ||  | |d |d  | tdd    tt|d	k|dkt||d
 t||f | t|dt|    ||d  || d
   t||  tt|d	k|dkt||tj tj|ftd	|  dt t ||  t|d |d   |d	ktj|ftd	|  t|t|d |d   t|d |d   |d	kt||f}|S )z
    This is an internal helper function that returns the table of Laplace
    transfrom rules in terms of the time variable `t` and the frequency
    variable `s`.  It is used by `_laplace_apply_rules`.
    r   r|  r   r   tauomegac                    s
   t |  S r{   r  r  r  rg   rh   r     rw  z&_laplace_build_rules.<locals>.<lambda>r   rt   rv   rO  r   g      ?r`        )!r   r   r   r   r?   r(   r%   rN   rO   r@   rC   r3   r   rB   rE   rF   r=   r-   r)   rA   r+   
EulerGammarD   r8   r,   r:   r6   r<   r$  r   r;   r>   r/   )	r   r   r   r   r   r  r  dcolaplace_transform_rulesrg   r  rh   _laplace_build_rules  s  **
!

%(*6.2
2X6B
:.
>B6F"JNR
X6\B
`$dBhlp0t@
x.

| &    	2  "
  `
  <
  4
  
  !.  %2  ):
  -8
  1,
  54
  
9  =
  A4  F
  K,  O$  S
  
W
  [&  a

  e
  i6
  m$  q  
u
  y*
   6        	6
    B
    B
            
*    !    %
    )    -"    1    5    96    =@&    AT&    E    I&(    M6    Q6    U@(    YT(    ]$(    a&    e.    ir  c                 K   s    | dd }|r| ||fS | S )z
    Internal helper function that will return `(f, a, c)` unless `**hints`
    contains `noconds=True`, in which case it will only return `f`.
    r   F)get)r   r   r   r   r   rg   rg   rh   _laplace_cr  s   
r  c                    s  | dd}td gd}tddd}| j dd	\}}	|	|}
|
r|
| jd
  }||  }|r|| d
krtd td| |
|f  td || dkr|dkrvt fdd|
| 	t
D sv|t|
|   ||d S |t|
|   |fi | S t|
|   |||  fd|i|}z|\}}}|||  | ||fW S  ty   |||  |  Y S w dS )a  
    This internal helper function tries to apply the time-scaling rule of the
    Laplace transform and returns `None` if it cannot do it.

    Time-scaling means the following: if $F(s)$ is the Laplace transform of,
    $f(t)$, then, for any $a>0$, the Laplace transform of $f(at)$ will be
    $\frac1a F(\frac{s}{a})$. This scaling will also affect the transform's
    convergence plane.
    r   Tr   r|  r&  rt   nargsFas_Addr   _laplace_apply_rules match:      f:    %s ( %s, %s )z1      rule: amplitude and time scaling (1.1, 1.2)c                 3   s    | ]}|  V  qd S r{   )r   r   r  rg   rh   r   8  r  z*_laplace_rule_timescale.<locals>.<genexpr>r   r   N)r   r   r   r  r  rq   r  r]   r   r   r	   r  r   LaplaceTransform_laplace_apply_rulesr"  )r   r   r   r   r   r   r   r&  rC  r   ma1r$   ma2Lr   r
  r   rg   r  rh   _laplace_rule_timescale!  s@   

"
r  c                 K   s\  | dd td|gd}td|gd}td}tddd	}| j|d
d\}	}
|
t|| }|r|| || }|| jd ||| }|r|| dkr|r|| || krtd td| |||f  td t	|| 
|||fd|i|}z|\}}}|	t||  |  | ||fW S  ty   |	t||  |  |  Y S w dS )z
    This internal helper function tries to transform a product containing the
    `Heaviside` function and returns `None` if it cannot do it.
    r   Tr   r|  r   ro  r&  rt   r  Fr  r   r  z      f:    %s ( %s, %s, %s )z      rule: time shift (1.3)r   N)r   r   r   r  r  r@   rq   r  r]   r  r   r(   r"  )r   r   r   r   r   r   r   ro  r&  rC  r   r  r  ma3r  r   r
  r   rg   rg   rh   _laplace_rule_heavisideH  s,   $"
"r  c                 K   s   | dd td|gd}td}td}| j|dd\}}	|	t|| }
|
ru|
| ||| }|rutd	 td
| |
|f  td t|
| ||||  fd|i|}z|\}}}||||  |fW S  tyt   | Y S w dS )z
    This internal helper function tries to transform a product containing the
    `exp` function and returns `None` if it cannot do it.
    r   Tr   r|  ro  zFr  r  r  z#      rule: multiply with exp (1.5)r   N)	r   r   r  r  r(   r  r]   r  r"  )r   r   r   r   r   r   ro  r  rC  r   r  r  r  r   r
  r   rg   rg   rh   _laplace_rule_expd  s(   $
r  c                 K   s:  | dd}td|gd}td}td}| j|dd\}	}
t|d	d
dd
ft|dd
d
d
ft|dt dtft|dd
d
tfg}|D ]}|\}}}}}|
|| }|r|| 	||| }|rt
d t
d| ||f  t
d|j|f  t|| ||fd|i|}z:|\}}}|d
krt|| }nd}|||||||   |||||||       d || |fW   S  ty   |dkr|dkr|||||||   |||||||       d  Y   S |||||||   |||||||      d  Y   S w qCdS )z
    This internal helper function tries to transform a product containing a
    trigonometric function (`sin`, `cos`, `sinh`, `cosh`, ) and returns
    `None` if it cannot do it.
    r   Tr   r|  ro  r  Fr  z1.6rt   r   z1.7z1.81.9r  r  z!      rule: multiply with %s (%s)r   r   rv   N)r   r   r  r-   r+   r8   r   r6   r  r  r]   r   r  r%   r   r   r"  )r   r   r   r   r   r   r   ro  r  rC  r   	trigrulestrigrulefmrT  s1s2sdr  r  r  r   r
  r   cp_shiftrg   rg   rh   _laplace_rule_trig~  sZ    "

r  c                 K   sL  | dd td|gd}td}td|gd}tddd	}| |t|||f }	|	r|	| jd
 |kr|	| jrtd td| f  td g }
t|	| D ]1}|d
krc|	| 	|
|d
}nt|	| 	|||f
|d
}|
||	| | d  |  qQ||	|  t|	| 	|||fd|i| }|	| |t|
   S dS )z
    This internal helper function tries to transform an expression containing
    a derivative of an undefined function and returns `None` if it cannot
    do it.
    r   Tr   r|  ro  r   r&  rt   r  r   r        f:    %sz(      rule: time derivative (1.11, 1.12)r   N)r   r   r   r  r   rq   
is_integerr]   r#  r   r   r   r  r   )r   r   r   r   r   r   ro  r   r&  r  r   rC  r   rg   rg   rh   _laplace_rule_diff  s*      $r  c              	   K   s6  | j |dd\}}t||}|D ]a\}}	}
}}|||}|rqtd td|f  td||	f  z0td|
f  |
|}td|
|f  |dkrbt||	| ||tjfi |W   S W q typ   td	 Y qw q| 	t
ryd
S tttttg}|D ]}|| ||fd|i|}|d
ur|  S qd
S )aM  
    Helper function for the class LaplaceTransform.

    This function does a Laplace transform based on rules and, after
    applying the rules, hands the rest over to `_laplace_transform`, which
    will attempt to integrate.

    If it is called with `doit=False`, then it will instead return
    `LaplaceTransform` objects.
    Fr  r  r  z      rule: %s o---o %sz      try   %sz      check %s -> %sTz#_laplace_apply_rules did not match.Nr   )r  r  r  r]   xreplacer  r   r   	Exceptionr   r?   r  r  r  r  r  )r   r   r   r   r   rC  r   simple_rulest_doms_domcheckplaneprepmar   
prog_rulesp_ruler  rg   rg   rh   r    sD   


r  c                   @   s4   e Zd ZdZdZdd Zdd Zdd Zd	d
 ZdS )r  z
    Class representing unevaluated Laplace transforms.

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

    For how to compute Laplace transforms, see the :func:`laplace_transform`
    docstring.
    r~  c                 K   s`   t |||fi |}|d u r.|dd}td|f  td|f  t|||fd|i|S |S )Nr   Tz0_laplace_apply_rules could not match function %sz    hints: %s)r  r   r]   r  )rb   r   r   r   r   r  r   rg   rg   rh   r     s   z#LaplaceTransform._compute_transformc                 C   s"   t |t| |  |tjtjfS r{   )rI   r(   r   r   r   )rb   r   r   r   rg   rg   rh   r     s   "zLaplaceTransform._as_integralc                 C   sV   g }g }|D ]\}}| | | | qt| }t| }|dkr'tdd d||fS )NFr~  zNo combined convergence.)r   rO   r1   r^   )rb   r   r   planesr  r   rg   rg   rh   r     s   
z LaplaceTransform._collapse_extrac                 K   sx   | j }td|f  | j}| j}d }|js8t|}z| j|||fi |}W ||fS  ty7   d }Y ||fS w ||fS )Nz----> _try_directly: %s)ra   r]   ru   rw   r   r   r   r^   )rb   r   r   t_r   r  rg   rg   rh   r     s   zLaplaceTransform._try_directlyN)	ri   rj   rk   rl   r   r   r   r   r   rg   rg   rg   rh   r    s    	
r  c                    s  t d| f  t| trzt| drz dd }|rE|rEtdddd tt |  fd	d
W  d   S 1 s?w   Y  n5 fdd| D }|rnt	| \}}}	t
| g | j|R  }
|
t| t|	 fS t
| g | j|R  S t| jdi  S )ak	  
    Compute the Laplace Transform `F(s)` of `f(t)`,

    .. math :: F(s) = \int_{0^{-}}^\infty e^{-st} f(t) \mathrm{d}t.

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

    For all sensible functions, this converges absolutely in a
    half-plane

    .. math :: a < \operatorname{Re}(s)

    This function returns ``(F, a, cond)`` where ``F`` is the Laplace
    transform of ``f``, `a` is the half-plane of convergence, and `cond` are
    auxiliary convergence conditions.

    The implementation is rule-based, and if you are interested in which
    rules are applied, and whether integration is attemped, you can switch
    debug information on by setting ``sympy.SYMPY_DEBUG=True``.

    The lower bound is `0-`, meaning that this bound should be approached
    from the lower side. This is only necessary if distributions are involved.
    At present, it is only done if `f(t)` contains ``DiracDelta``, in which
    case the Laplace transform is computed implicitly as

    .. math :: F(s) = \lim_{\tau\to 0^{-}} \int_{\tau}^\infty e^{-st} f(t) \mathrm{d}t

    by applying rules.

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

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

    .. deprecated:: 1.9
        Legacy behavior for matrices where ``laplace_transform`` with
        ``noconds=False`` (the default) returns a Matrix whose elements are
        tuples. The behavior of ``laplace_transform`` for matrices will change
        in a future release of SymPy to return a tuple of the transformed
        Matrix and the convergence conditions for the matrix as a whole. Use
        ``legacy_matrix=False`` to enable the new behavior.

    Examples
    ========

    >>> from sympy import DiracDelta, exp, laplace_transform
    >>> from sympy.abc import t, s, a
    >>> laplace_transform(t**4, t, s)
    (24/s**5, 0, True)
    >>> laplace_transform(t**a, t, s)
    (gamma(a + 1)/(s*s**a), 0, re(a) > -1)
    >>> laplace_transform(DiracDelta(t)-a*exp(-a*t),t,s)
    (s/(a + s), Max(0, -a), True)

    See Also
    ========

    inverse_laplace_transform, mellin_transform, fourier_transform
    hankel_transform, inverse_hankel_transform

    z$
***** laplace_transform(%s, %s, %s)	applyfuncr   Fz
Calling laplace_transform() on a Matrix with noconds=False (the default) is
deprecated. Either noconds=True or use legacy_matrix=False to get the new
behavior.
                r  z#deprecated-laplace-transform-matrix)deprecated_since_versionactive_deprecations_targetc                    s   t | fi  S r{   laplace_transform)fijr   r   r   rg   rh   r     r   z#laplace_transform.<locals>.<lambda>Nc                    s    g | ]}t |fi  qS rg   r  )r   r  r  rg   rh   r     s     z%laplace_transform.<locals>.<listcomp>rg   )r]   r   rP   hasattrr  rY   r[   rZ   r  r  typeshaper1   rO   r  r   )r   r   r   legacy_matrixr   r   elements_transelementsavals
conditions	f_laplacerg   r  rh   r  .  s&   B
"r  c                    s  ddl m}m  tddd fdd}| r| } | jr<tfdd	| jD  }t	|
|dfS zt| t d
tjfddd\}}W n ty[   d
}Y nw |d
u r|| }|d
u rptd|d|jr|jd \}}|trtd|dntj}|t|}|jr|
||fS tdtjffdd	}	|t|	}dd }
|t|
}t	|
||fS )z6 The backend function for inverse Laplace transforms. r   )meijerint_inversion_get_coeff_expr   Tr   c                     s   t | dkr
t|  S | d jd j} |\}}| d jd }| d jd }tdt| |  | t| dt|  |  S )z3 Simplify a piecewise expression from hyperexpand. rO  rv   r   rt   )r   r4   rq   rR  r@   r%   )rq   r$   r   r*  e1e2)r  r   rg   rh   pw_simp  s   z+_inverse_laplace_transform.<locals>.pw_simpc                    s   g | ]
}t | qS rg   )_inverse_laplace_transform)r   X)r  r   r   r   rg   rh   r     s    z._inverse_laplace_transform.<locals>.<listcomp>NF)r   r   Inverse Laplacer   z(inversion integral of unrecognised form.uc                    s|   |  t  }| rt| |S ddlm} ||dk}|jkr1t|j}t | |S t|j}t |  |S )Nr   r   )	r   r(   r   r@   r   r   r   r)   r   )r$   H0r   r   relrC  )r   r  rg   rh   simp_heaviside  s   




z2_inverse_laplace_transform.<locals>.simp_heavisidec                 S   s   t t| S r{   )r   r(   )r$   rg   rg   rh   simp_exp  r  z,_inverse_laplace_transform.<locals>.simp_exp)sympy.integrals.meijerintr  r  r   is_rational_functionapartr   r   rq   r   r   rh  r(   r   r   r^   r   r   rI   r   r   r4   r$  r@   )r   r   r  r  r   r  r  r   r   r  r  rg   )r  r  r   r   r   r  rh   r    sL   


r  c                   @   rY  )InverseLaplaceTransformz
    Class representing unevaluated inverse Laplace transforms.

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

    For how to compute inverse Laplace transforms, see the
    :func:`inverse_laplace_transform` docstring.
    r  r[  r   c                 K   s(   |d u rt j}tj| ||||fi |S r{   )r  r\  rn   r]  )r^  r   r   r   r  r_  rg   rg   rh   r]    s   zInverseLaplaceTransform.__new__c                 C   s   | j d }|tju rd }|S NrO  )rq   r  r\  )rb   r  rg   rg   rh   fundamental_plane  s   

z)InverseLaplaceTransform.fundamental_planec                 K   s   t |||| jfi |S r{   )r  r  )rb   r   r   r   r   rg   rg   rh   r     s   z*InverseLaplaceTransform._compute_transformc                 C   sL   | j j}tt|| | ||tjtj  |tjtj  fdtj tj  S rd  )rf   re  rI   r(   r   rf  r   rg  )rb   r   r   r   r   rg   rg   rh   r     s    z$InverseLaplaceTransform._as_integralN)ri   rj   rk   rl   r   r   r\  re  r]  r   r  r   r   rg   rg   rg   rh   r    s    	
r  c                    sF   t | trt| dr|  fddS t| jdi  S )a  
    Compute the inverse Laplace transform of `F(s)`, defined as

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

    for `c` so large that `F(s)` has no singularites in the
    half-plane `\operatorname{Re}(s) > c-\epsilon`.

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

    The plane can be specified by
    argument ``plane``, but will be inferred if passed as None.

    Under certain regularity conditions, this recovers `f(t)` from its
    Laplace Transform `F(s)`, for non-negative `t`, and vice
    versa.

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

    Note that this function will always assume `t` to be real,
    regardless of the SymPy assumption on `t`.

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

    Examples
    ========

    >>> from sympy import inverse_laplace_transform, exp, Symbol
    >>> from sympy.abc import s, t
    >>> a = Symbol('a', positive=True)
    >>> inverse_laplace_transform(exp(-a*s)/s, s, t)
    Heaviside(-a + t)

    See Also
    ========

    laplace_transform, _fast_inverse_laplace
    hankel_transform, inverse_hankel_transform
    r  c                    s   t | fi  S r{   )inverse_laplace_transform)Fijr   r  r   r   rg   rh   r   0  r  z+inverse_laplace_transform.<locals>.<lambda>Nrg   )r   rP   r  r  r  r   )r   r   r   r  r   rg   r  rh   r    s   +r  c                    sl   t dtgd\fdd  fdd fdd	fd	d
 fdd | S )zEFast inverse Laplace transform of rational function including RootSumza, b, nr  c                    sN   |  s| S | jr | S | jr| S | jr| S t| tr%| S tr{   )r   r   is_Mulr  r   rX   r}   rW  )_ilt_add_ilt_mul_ilt_pow_ilt_rootsumr   rg   rh   _ilt8  s   

z#_fast_inverse_laplace.<locals>._iltc                    s   | j t | j S r{   )r   maprq   r  r  rg   rh   r  F  s   z'_fast_inverse_laplace.<locals>._ilt_addc                    s$   |  \}}|jrt| | S r{   )r  r  r}   )rW  r   r   )r  r   rg   rh   r  I  s   z'_fast_inverse_laplace.<locals>._ilt_mulc                    s   |      }|d urM| |  | }}}|jr>|dk r>| d  t||    ||  t|   S |dkrMt||   | S tr  )r  r  r(   rE   r}   )rW  r  nmamr<  )r   r   r   r   r   rg   rh   r  O  s   4z'_fast_inverse_laplace.<locals>._ilt_powc                    s,   | j j}| j j\}t| jt|t |S r{   )funr   	variablesrX   polyr   rV   )rW  r   variabler  rg   rh   r   Y  s   
z+_fast_inverse_laplace.<locals>._ilt_rootsum)r   r   )rW  r   r   rg   )
r  r  r  r  r   r   r   r   r   r   rh   _fast_inverse_laplace4  s   
r
  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   )rH   r(   r   rf  r   r   r   rI   r   r   NaNr^   r   rq   )
r   r   rC  r   r   r   r   r   
integral_fr   rg   rg   rh   _fourier_transforme  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r}   rf   rr   rg   rg   rh   r        zFourierTypeTransform.ac                 C   r  Nz,Class %s must implement b(self) but does notr  rr   rg   rg   rh   r     r  zFourierTypeTransform.bc                 K   s&   t ||||  |  | jjfi |S r{   )r  r   r   rf   r   rb   r   r   rC  r   rg   rg   rh   r     s   z'FourierTypeTransform._compute_transformc                 C   s>   |   }|  }t|| t|tj | |  |tjtjfS r{   )r   r   rI   r(   r   rf  r   r   )rb   r   r   rC  r   r   rg   rg   rh   r     s   .z!FourierTypeTransform._as_integralNri   rj   rk   rl   r   r   r   r   rg   rg   rg   rh   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.
    Fourierc                 C      dS r   rg   rr   rg   rg   rh   r     r   zFourierTransform.ac                 C   
   dt j S )Nr  r   rg  rr   rg   rg   rh   r        
zFourierTransform.bNri   rj   rk   rl   r   r   r   rg   rg   rg   rh   r    
    	r  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
    Nrg   )r  r   r   r   rC  r   rg   rg   rh   fourier_transform     'r!  c                   @   r  )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   r  r   rg   rr   rg   rg   rh   r     r   zInverseFourierTransform.ac                 C   r  rd  r  rr   rg   rg   rh   r     r  zInverseFourierTransform.bNr  rg   rg   rg   rh   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
    Nrg   )r#  r   r   rC  r   r   rg   rg   rh   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   )rH   r   r   r   r   rI   r   r   r   r^   rq   )
r   r   rC  r   r   Kr   r   r   r   rg   rg   rh   _sine_cosine_transform	  s   (


r'  c                   @   r  )SineCosineTypeTransformzK
    Base class for sine and cosine transforms.
    Specify cls._kern.
    c                 C   r  r  r  rr   rg   rg   rh   r   7	  r  zSineCosineTypeTransform.ac                 C   r  r  r  rr   rg   rg   rh   r   ;	  r  zSineCosineTypeTransform.bc                 K   s,   t ||||  |  | jj| jjfi |S r{   )r'  r   r   rf   _kernr   r  rg   rg   rh   r   @	  s   z*SineCosineTypeTransform._compute_transformc                 C   s@   |   }|  }| jj}t|| ||| |  |tjtjfS r{   )r   r   rf   r)  rI   r   r   r   )rb   r   r   rC  r   r   r&  rg   rg   rh   r   F	  s   (z$SineCosineTypeTransform._as_integralNr  rg   rg   rg   rh   r(  1	  s    r(  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.
    Sinec                 C      t dt t S rd  r3   r   rr   rg   rg   rh   r   Z	  r  zSineTransform.ac                 C      t jS r{   r   r  rr   rg   rg   rh   r   ]	  r   zSineTransform.bN	ri   rj   rk   rl   r   r8   r)  r   r   rg   rg   rg   rh   r+  M	      	r+  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
    Nrg   )r+  r   r   rg   rg   rh   sine_transforma	     $r3  c                   @   r*  )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   r-  rd  r.  rr   rg   rg   rh   r   	  r  zInverseSineTransform.ac                 C   r/  r{   r0  rr   rg   rg   rh   r   	  r   zInverseSineTransform.bNr1  rg   rg   rg   rh   r5  	  r2  r5  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
    Nrg   )r5  r   r$  rg   rg   rh   inverse_sine_transform	  s   %r6  c                   @   r*  )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.
    Cosinec                 C   r-  rd  r.  rr   rg   rg   rh   r   	  r  zCosineTransform.ac                 C   r/  r{   r0  rr   rg   rg   rh   r   	  r   zCosineTransform.bN	ri   rj   rk   rl   r   r6   r)  r   r   rg   rg   rg   rh   r7  	  r2  r7  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
    Nrg   )r7  r   r   rg   rg   rh   cosine_transform	  r4  r:  c                   @   r*  )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   r-  rd  r.  rr   rg   rg   rh   r   
  r  zInverseCosineTransform.ac                 C   r/  r{   r0  rr   rg   rg   rh   r   
  r   zInverseCosineTransform.bNr9  rg   rg   rg   rh   r;  	  r2  r;  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
    Nrg   )r;  r   r$  rg   rg   rh   inverse_cosine_transform
  r4  r<  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   )rH   r<   r   r   r   r   rI   r   r   r   r^   rq   )r   r   rC  rT  r   r   r   r   rg   rg   rh   _hankel_transform>
  s   &

r=  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 r  )r   ra   ru   rw   rq   )rb   r   rg   rg   rh   r   Y
  s   zHankelTypeTransform.doitc                 K   s   t ||||| jfi |S r{   )r=  r   )rb   r   r   rC  rT  r   rg   rg   rh   r   `
  s   z&HankelTypeTransform._compute_transformc                 C   s&   t |t|||  | |tjtjfS r{   )rI   r<   r   r   r   )rb   r   r   rC  rT  rg   rg   rh   r   c
  s   &z HankelTypeTransform._as_integralc                 C   s   |  | j| j| j| jd S r  )r   ra   ru   rw   rq   rr   rg   rg   rh   r   f
  s
   zHankelTypeTransform.as_integralN)	ri   rj   rk   rl   r   r   r   r   r   rg   rg   rg   rh   r>  T
  s    r>  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.
    HankelNri   rj   rk   rl   r   rg   rg   rg   rh   r@  n
      	r@  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
    Nrg   )r@  r   )r   r   rC  rT  r   rg   rg   rh   hankel_transform{
     .rE  c                   @   r?  )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 HankelNrB  rg   rg   rg   rh   rG  
  rC  rG  c                 K   rD  )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
    Nrg   )rG  r   )r   rC  r   rT  r   rg   rg   rh   inverse_hankel_transform
  rF  rH  )F)Tr{   )rl   	functoolsr   r   	itertoolsr   
sympy.corer   r   r   sympy.core.addr   sympy.core.functionr	   r
   r   r   r   r   r   r   r   sympy.core.mulr   sympy.core.numbersr   r   sympy.core.relationalr   r   r   r   r   r   sympy.core.sortingr   r   sympy.core.symbolr   r   r   sympy.core.traversalr    (sympy.functions.combinatorial.factorialsr!   r"   $sympy.functions.elementary.complexesr#   r$   r%   r&   r'   &sympy.functions.elementary.exponentialr(   r)   r*   %sympy.functions.elementary.hyperbolicr+   r,   r-   r.   r/   #sympy.functions.elementary.integersr0   (sympy.functions.elementary.miscellaneousr1   r2   r3   $sympy.functions.elementary.piecewiser4   r5   (sympy.functions.elementary.trigonometricr6   r7   r8   r9   r:   sympy.functions.special.besselr;   r<   r=   r>   'sympy.functions.special.delta_functionsr?   r@   'sympy.functions.special.error_functionsrA   rB   rC   'sympy.functions.special.gamma_functionsrD   rE   rF   sympy.functions.special.hyperrG   sympy.integralsrH   rI   r  rJ   sympy.logic.boolalgrK   rL   rM   rN   rO   sympy.matrices.matricesrP   sympy.polys.matrices.linsolverQ   rR   sympy.polys.polyrootsrS   sympy.polys.polytoolsrT   rU   sympy.polys.rationaltoolsrV   sympy.polys.rootoftoolsrW   rX   sympy.utilities.exceptionsrY   rZ   r[   sympy.utilities.iterablesr\   sympy.utilities.miscr]   r}   r^   rn   r   r   _nocondsr   r   r   r   r   rQ  r  rD  rF  rb  rZ  rh  ry  r{  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r
  r  r  r  r!  r#  r%  r'  r(  r+  r3  r5  r6  r7  r:  r;  r<  r=  r>  r@  rE  rG  rH  rg   rg   rg   rh   <module>   s    ,  D!,-  -:4<X  w

'


5
)
5bP
#01*.'('+1