
    wg$                        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!eV      ZW G d" d#e      ZXd$ ZYd% ZZ eZd&      Z[d' Z\e[e\d(fd)       Z] G d* d+eX      Z^d, Z_d- Z` G d. d/ea      Zbd0 Zc eZd(      dWd1       Zdd2ae G d3 d4eX      Zfd5 Zg eZd(      dXd6       Zh G d7 d8eX      Zi G d9 d:ei      Zjd; Zk G d< d=ei      Zld> Zm eZd(      dXd?       Zn G d@ dAeX      Zo G dB dCeo      ZpdD Zq G dE dFeo      ZrdG Zs G dH dIeo      ZtdJ Zu G dK dLeo      ZvdM Zw eZd(      dXdN       Zx G dO dPeX      Zy G dQ dRey      ZzdS Z{ G dT dUey      Z|dV Z}dd2l~mc mZ ej                  Zej                  Zej                  Zej
                  Zej                  Zej                  Zy2)Yz 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                   "     e Zd ZdZ fdZ x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                 >    t         |   |d|d       || _        y )Nz" Transform could not be computed: .)super__init__function)self	transformr@   msg	__class__s       _/home/mcse/projects/flask/flask-venv/lib/python3.12/site-packages/sympy/integrals/transforms.pyr?   zIntegralTransformError.__init__6   s     9BCH	J     )__name__
__module____qualname____doc__r?   __classcell__)rD   s   @rE   r;   r;   (   s    ! !rF   r;   c                       e Zd ZdZed        Zed        Zed        Zed        Zd Z	d Z
d Zd	 Zd
 Zed        Zd Zy)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                      | j                   d   S )z! The function to be transformed. r   argsrA   s    rE   r@   zIntegralTransform.functionS        yy|rF   c                      | j                   d   S )z; The dependent variable of the function to be transformed.    rO   rQ   s    rE   function_variablez#IntegralTransform.function_variableX   rR   rF   c                      | j                   d   S )z% The independent transform variable.    rO   rQ   s    rE   transform_variablez$IntegralTransform.transform_variable]   rR   rF   c                 ~    | j                   j                  j                  | j                  h      | j                  hz
  S )zj
        This method returns the symbols that will exist when the transform
        is evaluated.
        )r@   free_symbolsunionrX   rU   rQ   s    rE   rZ   zIntegralTransform.free_symbolsb   s;     }}))//1H1H0IJ%%&' 	'rF   c                     t         NNotImplementedErrorrA   fxshintss        rE   _compute_transformz$IntegralTransform._compute_transformk       !!rF   c                     t         r]   r^   rA   ra   rb   rc   s       rE   _as_integralzIntegralTransform._as_integraln   rf   rF   c                 b    t        | }|dk(  r!t        | j                  j                  d d      |S )NF )r3   r;   rD   name)rA   extraconds      rE   _collapse_extraz!IntegralTransform._collapse_extraq   s0    E{5=()<)<dBGGrF   c                 ^    d }t         fd j                  j                  t              D               }|r4	   j                   j                   j
                   j                  fi |} j                  }|j                  st        |      }||fS # t        $ r t        d       d }Y ?w xY w)Nc              3   T   K   | ]  }|j                  j                         ! y wr]   )hasrU   ).0funcrA   s     rE   	<genexpr>z2IntegralTransform._try_directly.<locals>.<genexpr>y   s*      N#'  $xx(>(>? Ns   %(z6[IT _try ] Caught IntegralTransformError, returns None)anyr@   atomsr	   re   rU   rX   r;   r9   is_Addr   )rA   rd   Ttry_directlyfns   `    rE   _try_directlyzIntegralTransform._try_directlyw   s     N+/==+>+>|+LN N N+D++DMM**D,C,CNGLN ]]yyBB1u * NOs   3B B,+B,c                    |j                  dd      }|j                  dd      }||d<    | j                  d	i |\  }}||S |j                  r||d<   |j                  D cg c];  }  | j                  |gt        | j                  dd       z    j                  d	i |= }}g }g }	|D ]d  }t        |t              s|g}|	j                  |d          t        |      dk(  r|j                  |d          Mt        |      dkD  s\||dd gz  }f |dk(  rt        |	 j                         }nt        |	 }|s|S 	 | j                  |      }t        |      r|ft        |      z   S ||fS |r+t        | j                  j                   | j"                  d      |j%                  | j&                        \  }
}|
 | j                  t)        | gt        | j                  dd       z    z  S c c}w # t        $ r Y w xY w)
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simplifyTNrT   r   rW    )popr|   rx   rP   rD   listdoit
isinstancetupleappendlenr   r   ro   r8   r;   _namer@   as_coeff_mulrU   r   )rA   rd   r~   r   r{   ry   rb   resrm   resscoeffrests               rE   r   zIntegralTransform.doit   s   * 99Z/99Z.$j"""+U+A=H99 (E*GG% E>4>>QC$tyy}*=$=?DDMuM %C %ED 	%!!U+AAaD!q6Q;LL1&VaZaeW$E	% ~4j))+4j
,,U3E?6E%L00<' ($$dmmZA A ood&<&<=t^T^^sDzlT$))AB-5H&HJJJK%4 * s   #A G';*G, &G, ,	G87G8c                 d    | j                  | j                  | j                  | j                        S r]   )ri   r@   rU   rX   rQ   s    rE   as_integralzIntegralTransform.as_integral   s,      0F0F!%!8!8: 	:rF   c                     | j                   S r]   )r   )rA   rP   kwargss      rE   _eval_rewrite_as_Integralz+IntegralTransform._eval_rewrite_as_Integral   s    rF   N)rG   rH   rI   rJ   propertyr@   rU   rX   rZ   re   ri   ro   r|   r   r   r   r   rF   rE   rM   rM   <   s    ,       ' '"""EKN : : rF   rM   c                 T    |r%ddl m} ddlm}  | |t	        |       d            S | S )Nr   )r   )	powdenestT)polar)sympy.simplifyr   sympy.simplify.powsimpr   r#   )exprr   r   r   s       rE   	_simplifyr      s'    +4	."6dCDDKrF   c                       f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                 6     t               d fd
       }|S )Nnocondsc                 &     |i |}| r|d   S |S Nr   r   )r   rP   r   r   rt   s       rE   wrapperz0_noconds_.<locals>.make_wrapper.<locals>.wrapper   s#    ''C1vJrF   )r   )rt   r   defaults   ` rE   make_wrapperz_noconds_.<locals>.make_wrapper   s#    	t#* 	 
	
 rF   r   )r   r   s   ` rE   	_noconds_r      s    $ rF   Fc                 X    t        | |t        j                  t        j                  f      S r]   )r,   r   ZeroInfinity)ra   rb   s     rE   _default_integratorr     s    QAFFAJJ/00rF   Tc                    t        dd|        ||dz
  z  | z  |      }|j                  t              sKt        |j	                  |      |      t
        j                  t
        j                  ft
        j                  fS |j                  st        d| d      |j                  d   \  }}|j                  t              rt        d| d      fd}t        |      D cg c]
  } ||       }	}|	D cg c]  }|d	   d
k7  s| }	}|	j                  d        |	st        d| d      |	d   \  }
}}t        |j	                  |      |      |
|f|fS c c}w c c}w )z0 Backend function to compute Mellin transforms. rc   zmellin-transformrT   Mellincould not compute integralr   integral in unexpected formc                    ddl m} t        j                  }t        j                  }t        j
                  }t        t        |             }t        dd      }|D ]j  }t        j                  }t        j                  }	g }
t        |      D ]  }|j                  t        d       j                  t              |      }|j                  r0|j                  dv s"|j                        s|j                  |      s|
|gz  }
v |||      }|j                  r|j                  dv r|
|gz  }
|j                   |k(  rt#        |j$                  |	      }	t'        |j                   |      } |t        j                  ur||k7  rt#        ||      }4|	t        j                  ur|	|k7  rt'        |	|      }Yt)        |t+        |
       }m |||fS )zN
        Turn ``cond`` into a strip (a, b), and auxiliary conditions.
        r   )_solve_inequalitytT)realc                 (    | j                         d   S r   )as_real_imagrb   s    rE   <lambda>z:_mellin_transform.<locals>.process_conds.<locals>.<lambda>)  s    !.."21"5 rF   )z==z!=)sympy.solvers.inequalitiesr   r   NegativeInfinityr   truer0   r/   r   r1   replacer   subsis_Relationalrel_oprr   ltsr    gtsr!   r3   r2   )rn   r   abauxcondsr   ca_b_aux_dd_solnrc   s                 rE   process_condsz(_mellin_transform.<locals>.process_conds  s    	AJJff&,'#D! 	*AB##BDq\ +YY577;tBqE1~ HH,66!9BFF1IQCKD(Q/))|3QCKD88q=TXXr*BTXXr*B!+" #aAJ1---"'AJ#r4y)5	*6 !SyrF   rW   Fc                 4    | d   | d   z
  t        | d         fS )Nr   rT   rW   )r
   r   s    rE   r   z#_mellin_transform.<locals>.<lambda>B  s    adQqTk9QqT?; rF   keyzno convergence found)r.   rr   r-   r   r   r   r   r   r   is_Piecewiser;   rP   r1   sort)ra   rb   s_
integratorr   Frn   r   r   r   r   r   r   rc   s                @rE   _mellin_transformr     sO   
 	s&*A1q1u:>1%A55?21A4F4F

3SUVU[U[[[>>$Xq2NOOffQiGAtuuX$a68 	8%N (17!]17E7/11Q/E/	JJ;J<$Xq2HIIaIAq#QVVAr]H-1vs:: 8/s    E5EEc                   &    e Zd ZdZdZd Zd Zd Zy)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                     t        |||fi |S r]   )r   r`   s        rE   re   z"MellinTransform._compute_transformW  s     Aq2E22rF   c                 j    t        |||dz
  z  z  |t        j                  t        j                  f      S NrT   )r-   r   r   r   rh   s       rE   ri   zMellinTransform._as_integralZ  s*    !a!e*q!&&!**&=>>rF   c                     g }g }g }|D ]  \  \  }}}||gz  }||gz  }||gz  } t        | t        | ft        | f}|d   d   |d   d   k\  dk(  s|d   dk(  rt        dd d      |S )Nr   rT   TFr   zno combined convergence.)r    r!   r3   r;   )	rA   rm   r   r   rn   sasbr   r   s	            rE   ro   zMellinTransform._collapse_extra]  s      	KHRa"IA"IAQCKD	 AwQ #t*,F1IQ"t+s1v($ :< <
rF   N)rG   rH   rI   rJ   r   re   ri   ro   r   rF   rE   r   r   K  s     E3?rF   r   c                 <     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
    r   )r   r   )ra   rb   rc   rd   s       rE   mellin_transformr   l  s$    R )?1a#((1511rF   c                    | \  }}t        |t        z        }t        |t        z        }t        | |z  |j                         d   z
        }t	        ||z  |z   |z         t	        d|z
  |z
  ||z  z
        d|z  t        z  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   r   r   r*   )m_nrc   r   r   mnrs          rE   _rewrite_sinr     s    J DAq1R4A1R4A1q~~'**+A1q1uQUQY1_5QwrzAArF   c                       e Zd ZdZy)MellinTransformStripErrorzF
    Exception raised by _rewrite_gamma. Mainly for internal use.
    N)rG   rH   rI   rJ   r   rF   rE   r   r     s     	rF   r   c           
         /012 t        ||g      \  /0/0fd}g } j                  t              D ]_  }|j                        s|j                  d   }|j
                  r |j                        d   } |j                        \  }}	||gz  }a  j                  t        t        t        t              D ]f  }|j                        s|j                  d   }|j
                  r |j                        d   } |j                        \  }}	||t        z  gz  }h |D 
cg c]  }
|
j                  rt        |
      n|
 }}
t         j                  }|D ]  }
|
j                   r|
} n |D 
cg c]  }
|
|z  	 }}
t#        d |D              r|j                  st%        ddd      |t'        t(        |D 
cg c]  }
t        |
j*                         c}
t         j                        z  }||k(  rEt-        |      dk(  r|}n4|t'        t.        |D 
cg c]  }
t        |
j0                         c}
      z  } j3                  |z         t         j                  |z  }t         j                  |z  }//|z  /00|z  0 j5                         \  }}t7        j8                  |      }t7        j8                  |      }t;        t=        |t?        d                  t;        t=        |t?        d	                  z   }g }g }g }g }g } fd
1|r|jA                         \  2}|r||}}|}n||}}|}12fd}2j                        s|2gz  }n2jB                  stE        2tF              r2jB                  r2jH                  }2jF                  }ntK        d      }2jF                  }|jL                  r|}|dk  r| }|||fgt        |      z  z  }|j                        s& ||      \  }}|sd|z  }|||z  gz  }|||z  gz  }n 12      2jO                        r!tQ        2      }|jS                         dk7  rp|jU                         d   }tW        |      } t-        |       |jS                         k7  rtY        jZ                  |      } ||gz  }|| D !cg c]	  }!|!z
  |f c}!z  }|j]                         \  }}!||gz  }|!| z  }! ||!|      r3|t         j                  |! dz   fgz  }|t         j                  |! fgz  }n|dgz  }|t         j^                  |!dz   fgz  }|t         j^                  |!fgz  }ntE        2t              rY |2j                  d         \  }}|r5|dkD  r || |z  |      d	k(  s|dk  r || |z  |      dk(  rta        d      |||fgz  }nXtE        2t              rk2j                  d   }|r.t        |t        z        t        d|t        z  z
        t        }$}#}"ntc         ||      /0      \  }"}#}$||"| f|#| fgz  }||$gz  }ntE        2t              r<2j                  d   }|t        |d	      |ft        t        dz  |z
  d	      | fgz  }ntE        2t              r-2j                  d   }|t        t        dz  |z
  d	      |fgz  }nTtE        2t              r<2j                  d   }|t        t        dz  |z
  d	      |ft        |d	      | fgz  }n 12      |r|t7        | t7        | z  z  }g g g g f\  }%}&}'}(||%|'df||(|&d	ffD ]  \  })}*}+}|)s|)jA                         \  }}!|dk7  r|dk7  rt        t        |            }||z  },|!|z  }-|jL                  ste        d      tg        |      D ]  }.|)|,|-|.|z  z   fgz  }) |r6|dt        z  d|z
  dz  z  ||!t         jh                  z
  z  z  z  }|||z  gz  }n6|dt        z  d|z
  dz  z  ||!t         jh                  z
  z  z  z  }||| z  gz  }|dk(  r|*jk                  d|!z
         n|+jk                  |!       |)r t7        | }|%jm                  tn               |&jm                  tn               |'jm                  tn               |(jm                  tn               |%|&f|'|(f|||fS c c}
w c c}
w c c}
w c c}
w c c}!w )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                     t        t        |             } t        j                  u ry| k  S | k  S | k\  dk(  ry| k  dk(  ry|ryj                  sj                  s| j                  ry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   rZ   r   )r   is_numerr   r   s     rE   leftz_rewrite_gamma.<locals>.left  s    
 2a5M:"

*:r6M:7NGG??boo ((EFFrF   r   rT   c              3   4   K   | ]  }|j                     y wr]   )is_Rational)rs   rb   s     rE   ru   z!_rewrite_gamma.<locals>.<genexpr>?  s     5!5s   GammaNzNonrational multiplierTFc                 $    t        dd| z        S )NInverse MellinzUnrecognised form '%s'.)r;   )factra   s    rE   	exceptionz!_rewrite_gamma.<locals>.exceptiona  s    %&6;TW[;[\\rF   c                      | j                         s       t        |       }|j                         dk7  r       |j                         S )z7 Test if arg is of form a*s+b, raise exception if not. rT   )is_polynomialr6   degree
all_coeffs)r   pr   r   rc   s     rE   
linear_argz"_rewrite_gamma.<locals>.linear_argl  sK    $3$$Q'o%S!AxxzQo%<<>!rF   r   z Gammas partially over the strip.)evaluaterW   za is not an integerr   )8r   rw   r*   rr   rP   rx   as_independentr   r&   r$   r'   r%   r   is_extended_realr   Oner   allr;   r   r   qr   r   r   r   as_numer_denomr   	make_argsr   zipr   r   is_Powr   r   baser   
is_Integerr   r6   r   LTr4   r7   	all_rootsr   NegativeOner_   r   	TypeErrorrangeHalfr   r   r   )3ra   rc   r   r   r   s_multipliersgr   r   _rb   common_coefficients_multiplierfacexponentnumerdenomrP   facsdfacsnumer_gammasdenom_gammasexponentialsr   ugammaslgammasufacsr   r  exp_rn   r   rsr   gamma1gamma2fac_anapbmbqgammasplusminusnewanewckr   r   r   r   s3   ``                                             @@@@rE   _rewrite_gammar)    s	   ~ 1vYFBG4 MWWU^ !uuQxffQi::$#$$Q'*C#3##A&q% ! WWS#sC( $uuQxffQi::$#$$Q'*C#3##A&q%(#$ CPPQq11SVq8PMP }}!" 4AAaQ))AMA5}55//$Wd4LMM%fT6C4E12 56accF 4EFGee'M ML))}"-L-}=!qv=>?L 	
q!L.!A
%%
Cuu\!H	~
l	~
l ##%LE5MM% EMM% EE6$<()DUF5M1J,KKDDELLL]
h+\WGE+\WGE	" xx{dVOE[[JtS1{{yyxx |xx!8#8D$s4y00XXa[!$'1T6Dq	)q	!o%"T1AxxzQ q	1a[r7ahhj( **1-B% B7q!a%*77<<>DAqaSLE!GAAx QUUQBFO,,QUUQBK=("Q]]AE233Q]]A.//e$diil+DAqEtQBqD(3u<EtQBqD(3t;-:< <AxGc" 		!A',QrT{E!ad(OR'3JqM1b"'M$f(l+f(l-CDDDdVOEc"		!Ac!e,h7"Q$(U3\BD DDc"		!Ac"Q$(U3X>??Dc"		!Ac"Q$(U3X>!e,(l;= =D D/!M P 3:c5k!!C R^NBB+7R*F+7R*G*I  %eX::<DAqBw17!Iss||#$9::q 3AdQqSj122F3AbDQUAI.QZ@@C QTF*LAbDQUAI.QZ@@C Q!WI-LBwAE"Q+  : |
C GG G!GG G!GG G!GG G!8b"XsHc11y Q B4E >b 8s   ' b>4c<cccc                     t        dd| d      }| j                  t              } t        |       t	        |       t        |       fD ]a  }|j                  r|j                  D cg c]  }t        |||||d       }}|D 	cg c]  }	|	d   	 }
}	|D 	cg c]  }	|	d   	 }}	t        | }|s t        ||j                  t              	      }|j                  ||      t        |
 fc S 	 t        |||d   |d         \  }}}}}	 t!        |||||z  z        }|r|}n	 dd
lm}  ||      }|j*                  rt-        |j                        dk(  rit        |t/        |      z
        |j                  d   j                  d   z  t        t/        |      |z
        |j                  d   j                  d   z  z   }t/        t1        |j2                              |j4                  t6        z  k  g}|t        t9        t-        |j:                        t-        |j<                        k7  dt?        |j@                        dz   k\        t/        t1        |j2                              |j4                  t6        z  k(        gz  }t9        | }|dk(  rt        d| d      ||z  j                  ||      |fc S  t        d| d      c c}w c c}	w c c}	w # t        $ r Y w xY w# t"        $ r Y w xY w# t(        $ r t        d| d      w xY w)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)positiveFr   rT   r   )gens)hyperexpandr   zCould not calculate integral   zdoes not convergerk   )!r.   rewriter*   r5   r   r   rx   rP   _inverse_mellin_transformr   rw   r)   r   r3   r)  r;   r+   
ValueErrorr   r-  r_   r   r   r   r   argumentdeltar   r2   r   r"  r   nu)r   rc   x_strip
as_meijergrb   r
  Gr   r   r   r   r   r   Cer  hr-  rn   s                       rE   r0  r0    s    	s.DAA 	
		%AQiAq	2 /)88 VV% .aAuj6;= %D % $((aQqT(E("&'QAaD'D't*CSsyy';<88Ar?CK//	,Q58U1XFOAq!Q	1a1f%A AI6N
 ~~#aff+"2a#a&j)!&&)..*;;A
+AFF1INN1,==>
 C

O$qwwrz12 	RADD	SY.RX\0ABQZZ)QWWRZ79 : 	:4y5=( !%8: :#||Ar"D((_/)b !!11b
99]% )' & 		  		 ' I,$a)GI IIsB   #J7J<K(KKK&	KK	K#"K#&K=Nc                   V    e Zd ZdZdZ ed      Z ed      Zd Ze	d        Z
d Zd Zy	)
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                     |t         j                  }|t         j                  }t        j                  | |||||fi |S r]   )r=  _none_sentinelrM   __new__)clsr   rc   rb   r   r   optss          rE   rA  zInverseMellinTransform.__new__C  sB    9&55A9&55A ((aAq!DtDDrF   c                     | j                   d   | j                   d   }}|t        j                  u rd }|t        j                  u rd }||fS )Nr.     )rP   r=  r@  )rA   r   r   s      rE   fundamental_stripz(InverseMellinTransform.fundamental_stripJ  sL    yy|TYYq\1&555A&555A!trF   c                    |j                  dd       t        >t        t        t        t
        t        t        t        t        t        t        t        t        hat        |      D ]C  }|j                  s|j!                  |      s"|j"                  t        vs5t%        d|d|z         | j&                  }t)        ||||fi |S )Nr   Tr   zComponent %s not recognised.)r   _allowedr   r*   r&   r$   r'   r%   r   r   r   r   r   r   r   is_Functionrr   rt   r;   rF  r0  )rA   r   rc   rb   rd   ra   r6  s          rE   re   z)InverseMellinTransform._compute_transformS  s     			*d#UCc3dD$2H %Q' 	IA}}qaffH.D,-=q%Ca%GI I	I &&(Aq%A5AArF   c                 ,   | j                   j                  }t        ||| z  z  ||t        j                  t        j
                  z  z
  |t        j                  t        j
                  z  z   f      dt        j                  z  t        j                  z  z  S NrW   )rD   _cr-   r   ImaginaryUnitr   Pi)rA   r   rc   rb   r   s        rE   ri   z#InverseMellinTransform._as_integralc  sz    NN!qb'	Aq1??1::+E'Eq$%OOAJJ$>H? $@ ABCADD&BXZ 	ZrF   N)rG   rH   rI   rJ   r   r   r@  rL  rA  r   rF  re   ri   r   rF   rE   r=  r=  5  sF     E6]N	sBE  B ZrF   r=  c           	      L     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   r   )r=  r   )r   rc   rb   r6  rd   s        rE   inverse_mellin_transformrP  i  s2    j D!!Q58U1X>CCLeLLrF   c                    t        || z  t        |t        j                  z  |z  |z        z  |t        j                  t        j
                  f      }|j                  t              st        ||      t        j                  fS t        | |t        j                  t        j
                  f      }|t        j                  t        j
                  t        j                  fv s|j                  t              rt        || d      |j                  st        || d      |j                  d   \  }}	|j                  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   rM  r   r   rr   r-   r   r   NaNr;   r   rP   )
ra   rb   r(  r   r   rl   r   r   
integral_frn   s
             rE   _fourier_transformrT    s    	!A#c!AOO+A-a/001a6H6H!**2UVA55?H%qvv--1q!"4"4ajjABJa((!**aee<<
x@X$T1.TUU>>$T1.JKKffQiGAtuuX$T1.KLLQ!4''rF   c                   (    e Zd ZdZd Zd Zd Zd Zy)FourierTypeTransformz# Base class for Fourier transforms.c                 2    t        d| j                  z        Nz,Class %s must implement a(self) but does notr_   rD   rQ   s    rE   r   zFourierTypeTransform.a      !:T^^KM 	MrF   c                 2    t        d| j                  z        Nz,Class %s must implement b(self) but does notrY  rQ   s    rE   r   zFourierTypeTransform.b  rZ  rF   c                     t        |||| j                         | j                         | j                  j                  fi |S r]   )rT  r   r   rD   r   rA   ra   rb   r(  rd   s        rE   re   z'FourierTypeTransform._compute_transform  s>    !!Q"&&&(DFFH"&.."6"6A:?A 	ArF   c                     | j                         }| j                         }t        ||z  t        |t        j
                  z  |z  |z        z  |t        j                  t        j                  f      S r]   )r   r   r-   r   r   rM  r   r   )rA   ra   rb   r(  r   r   s         rE   ri   z!FourierTypeTransform._as_integral  sZ    FFHFFH!C!// 1! 3A 566A<N<NPQPZPZ8[\\rF   NrG   rH   rI   rJ   r   r   re   ri   r   rF   rE   rV  rV    s    -MMA
]rF   rV  c                        e Zd ZdZdZd Zd Zy)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                      yr   r   rQ   s    rE   r   zFourierTransform.a      rF   c                 (    dt         j                  z  S )Nr   rN  rQ   s    rE   r   zFourierTransform.b  s    !$$wrF   NrG   rH   rI   rJ   r   r   r   r   rF   rE   rb  rb    s     ErF   rb  c                 <     t        | ||      j                  di |S )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
    r   )rb  r   ra   rb   r(  rd   s       rE   fourier_transformrl    s%    N *Aq!$))2E22rF   c                        e Zd ZdZdZd Zd Zy)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                      yr   r   rQ   s    rE   r   zInverseFourierTransform.a#  re  rF   c                 (    dt         j                  z  S rK  rh  rQ   s    rE   r   zInverseFourierTransform.b&  s    vrF   Nri  r   rF   rE   rn  rn    s     ErF   rn  c                 <     t        | ||      j                  di |S )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
    r   )rn  r   r   r(  rb   rd   s       rE   inverse_fourier_transformrs  *  s%    N 1"1a+009599rF   c                    t        || z   |||z  |z        z  |t        j                  t        j                  f      }|j	                  t
              st        ||      t        j                  fS |j                  st        || d      |j                  d   \  }}	|j	                  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   rr   r-   r   r   r   r;   rP   )
ra   rb   r(  r   r   Krl   r   r   rn   s
             rE   _sine_cosine_transformrv  X  s     	!A#a!Ah,AFFAJJ 78A55?H%qvv-->>$T1.JKKffQiGAtuuX$T1.KLLQ!4''rF   c                   (    e Zd ZdZd Zd Zd Zd Zy)SineCosineTypeTransformzK
    Base class for sine and cosine transforms.
    Specify cls._kern.
    c                 2    t        d| j                  z        rX  rY  rQ   s    rE   r   zSineCosineTypeTransform.aw  rZ  rF   c                 2    t        d| j                  z        r\  rY  rQ   s    rE   r   zSineCosineTypeTransform.b{  rZ  rF   c           	          t        |||| j                         | j                         | j                  j                  | j                  j
                  fi |S r]   )rv  r   r   rD   _kernr   r^  s        rE   re   z*SineCosineTypeTransform._compute_transform  sN    %aA&*ffh&*nn&:&:&*nn&:&:E ?DE 	ErF   c                     | j                         }| j                         }| j                  j                  }t	        ||z   |||z  |z        z  |t
        j                  t
        j                  f      S r]   )r   r   rD   r|  r-   r   r   r   )rA   ra   rb   r(  r   r   ru  s          rE   ri   z$SineCosineTypeTransform._as_integral  sW    FFHFFHNN  !Aac!eHq!&&!**&=>>rF   Nr`  r   rF   rE   rx  rx  q  s    
MM
E?rF   rx  c                   $    e Zd ZdZdZeZd Zd Zy)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                 8    t        d      t        t              z  S rK  r"   r   rQ   s    rE   r   zSineTransform.a      AwtBxrF   c                 "    t         j                  S r]   r   r   rQ   s    rE   r   zSineTransform.b      uurF   N	rG   rH   rI   rJ   r   r&   r|  r   r   r   rF   rE   r  r    s     EE rF   r  c                 <     t        | ||      j                  di |S )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
    r   )r  r   rk  s       rE   sine_transformr    s$    H '=Aq!&&///rF   c                   $    e Zd ZdZdZeZd Zd Zy)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                 8    t        d      t        t              z  S rK  r  rQ   s    rE   r   zInverseSineTransform.a  r  rF   c                 "    t         j                  S r]   r  rQ   s    rE   r   zInverseSineTransform.b  r  rF   Nr  r   rF   rE   r  r    s     EE rF   r  c                 <     t        | ||      j                  di |S )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
    r   )r  r   rr  s       rE   inverse_sine_transformr    s%    J .1a(--666rF   c                   $    e Zd ZdZdZeZd Zd Zy)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                 8    t        d      t        t              z  S rK  r  rQ   s    rE   r   zCosineTransform.a  r  rF   c                 "    t         j                  S r]   r  rQ   s    rE   r   zCosineTransform.b  r  rF   N	rG   rH   rI   rJ   r   r$   r|  r   r   r   rF   rE   r  r    s     EE rF   r  c                 <     t        | ||      j                  di |S )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
    r   )r  r   rk  s       rE   cosine_transformr    s$    H )?1a#((1511rF   c                   $    e Zd ZdZdZeZd Zd Zy)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                 8    t        d      t        t              z  S rK  r  rQ   s    rE   r   zInverseCosineTransform.aL  r  rF   c                 "    t         j                  S r]   r  rQ   s    rE   r   zInverseCosineTransform.bO  r  rF   Nr  r   rF   rE   r  r  ?  s     EE rF   r  c                 <     t        | ||      j                  di |S )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
    r   )r  r   rr  s       rE   inverse_cosine_transformr  S  s%    H 0!!Q*//8%88rF   c                    t        | t        |||z        z  |z  |t        j                  t        j                  f      }|j                  t              st        ||      t        j                  fS |j                  st        || d      |j                  d   \  }}|j                  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   rr   r-   r   r   r   r;   rP   )ra   r   r(  r4  rl   r   r   rn   s           rE   _hankel_transformr  ~  s     	!GB!$$Q&AFFAJJ(?@A55?H%qvv-->>$T1.JKKffQiGAtuuX$T1.KLLQ!4''rF   c                   2    e Zd ZdZd Zd Zd Zed        Zy)HankelTypeTransformz+
    Base class for Hankel transforms.
    c                      | j                   | j                  | j                  | j                  | j                  d   fi |S Nr.  )re   r@   rU   rX   rP   )rA   rd   s     rE   r   zHankelTypeTransform.doit  sD    &t&&t}}'+'='='+'>'>'+yy|0 */	0 	0rF   c                 6    t        ||||| j                  fi |S r]   )r  r   )rA   ra   r   r(  r4  rd   s         rE   re   z&HankelTypeTransform._compute_transform  s     Aq"djjBEBBrF   c                 ~    t        |t        |||z        z  |z  |t        j                  t        j                  f      S r]   )r-   r(   r   r   r   )rA   ra   r   r(  r4  s        rE   ri   z HankelTypeTransform._as_integral  s3    '"ac**1,q!&&!**.EFFrF   c                     | j                  | j                  | j                  | j                  | j                  d         S r  )ri   r@   rU   rX   rP   rQ   s    rE   r   zHankelTypeTransform.as_integral  s8      !%!7!7!%!8!8!%1/ 	/rF   N)	rG   rH   rI   rJ   r   re   ri   r   r   r   rF   rE   r  r    s,    0CG / /rF   r  c                       e Zd ZdZdZy)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rG   rH   rI   rJ   r   r   rF   rE   r  r    s     ErF   r  c                 >     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
    r   )r  r   )ra   r   r(  r4  rd   s        rE   hankel_transformr    s&    \ -?1aB',,5u55rF   c                       e Zd ZdZdZy)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  r   rF   rE   r  r    s     ErF   r  c                 >     t        | |||      j                  di |S )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
    r   )r  r   )r   r(  r   r4  rd   s        rE   inverse_hankel_transformr    s'    \ 4!!Q2.33<e<<rF   )F)T)rJ   	functoolsr   r   	itertoolsr   
sympy.corer   r   sympy.core.addr   sympy.core.functionr	   r
   r   r   r   sympy.core.mulr   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-   sympy.integrals.meijerintr.   sympy.logic.boolalgr/   r0   r1   r2   r3   sympy.polys.polyrootsr4   sympy.polys.polytoolsr5   r6   sympy.polys.rootoftoolsr7   sympy.utilities.iterablesr8   sympy.utilities.miscr9   r_   r;   rM   r   r   _nocondsr   r   r   r   r   r1  r   r)  r0  rH  r=  rP  rT  rV  rb  rl  rn  rs  rv  rx  r  r  r  r  r  r  r  r  r  r  r  r  r  r  sympy.integrals.laplace	integralslaplace_laplaceLaplaceTransformlaplace_transformlaplace_correspondencelaplace_initial_condsInverseLaplaceTransforminverse_laplace_transformr   rF   rE   <module>r     s    #   ; ;  ) / # 4 B = = A H H 7 C C ? G G 2 = 9 1 / , E E ' . + . &!0 !(Y  Y x6 U1 
+> A; 
A;H' B)2X*BZ	
 	h2V	 48: 8:t 1Z. 1Zh5Mx 4( (<], ],+ &'3T2 &':\ 4( (0?/ ?8+ ($0N2 (%7P- ($2N4 ($9V 4( (*/+ /4
) 
.6b
0 
.=l + *,, .. !88  66 ":: $>> rF   