
    g$                     4   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 ej        Zej        Zej        Zej        Zej        Zej        Zd2S )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                 d    t                                          |d|d           || _        d S )Nz" Transform could not be computed: .)super__init__function)self	transformr@   msg	__class__s       V/var/www/html/ai-engine/env/lib/python3.11/site-packages/sympy/integrals/transforms.pyr?   zIntegralTransformError.__init__6   s=    9BCCCH	J 	J 	J     )__name__
__module____qualname____doc__r?   __classcell__)rD   s   @rE   r;   r;   (   sB         ! ! ! ! ! ! ! ! !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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                     | j         d         S )z! The function to be transformed. r   argsrA   s    rE   r@   zIntegralTransform.functionS        y|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        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   s3     })//1H0IJ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                 Z    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GrF   c                 D    d }t           fd j                            t                    D                        }|rB	   j         j         j         j        fi |}n!# t          $ r t          d           d }Y nw xY w j        }|j	        st          |          }||fS )Nc              3   L   K   | ]}|                     j                  V  d S r]   )hasrU   ).0funcrA   s     rE   	<genexpr>z2IntegralTransform._try_directly.<locals>.<genexpr>y   sN       N N#'  $xx(>?? N N N N N NrF   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 N N N+/=+>+>|+L+LN N N N N N 	+D+DM*D,CN NGLN N)   NOOO ]y 	 BB1us    A   A>=A>c           	                               dd          }                     dd          }|d<     j        d
i \  }}||S |j        r |d<    fd|j        D             }g }g }|D ]}	t	          |	t
                    s|	g}	|                    |	d                    t          |	          dk    r|                    |	d	                    dt          |	          dk    r||	d	d         gz  }|dk    rt          | 	                                }n	t          | }|s|S 	  
                    |          }t          |          r|ft          |          z   S ||fS # t          $ r Y nw xY w|r t           j        j         j        d          |                     j                  \  }
}|
  j        t%          | gt'           j        d	d                   z    z  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                 v    g | ]5}  j         |gt          j        d d                   z    j        di 6S )rT   N )rD   listrP   doit)rs   rb   rd   rA   s     rE   
<listcomp>z*IntegralTransform.doit.<locals>.<listcomp>   s_     % % % E>4>QC$ty}*=*=$=?DMMuMM % % %rF   r   rW   rT   r   )popr|   rx   rP   
isinstancetupleappendlenr   r   ro   r8   r;   rD   _namer@   as_coeff_mulrU   r   r   )rA   rd   r~   r   r{   ry   resrm   ressrb   coeffrests   ``          rE   r   zIntegralTransform.doit   sE   * 99Z//99Z..$j""++U++A=H9 	 (E*% % % % %G% % %CED 	% 	%!!U++ AAaD!!!q66Q;;LL1&&&&VVaZZaeW$E~~4j))++4j 
,,U33E?? (6E%LL00<')     	A($dmZA A A ood&<==t^T^sDzlT$)ABB-5H5H&HJJJs   %6E  E   
E-,E-c                 N    |                      | j        | j        | j                  S r]   )ri   r@   rU   rX   rQ   s    rE   as_integralzIntegralTransform.as_integral   s)      0F!%!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        ,   X   X   X ' ' X'" " "" " "    "EK EK EKN : : X:         rF   rM   c                 h    |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[     E++++++444444x		."6"6dCCCD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                 D     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   sA    	t#* 	 	 	 	 	 	 
	
 rF   r   )r   r   s   ` rE   	_noconds_r      s$    $     rF   Fc                 P    t          | |t          j        t          j        f          S r]   )r,   r   ZeroInfinity)ra   rb   s     rE   _default_integratorr     s    QAFAJ/000rF   Tc                    t          dd|            ||dz
  z  | z  |          }|                    t                    sGt          |                    |          |          t
          j        t
          j        ft
          j        fS |j	        st          d| d          |j        d         \  }}|                    t                    rt          d| d          fdfd	t          |          D             }d
 |D             }|                    d            |st          d| d          |d         \  }}	}
t          |                    |          |          ||	f|
fS )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 ]i}t          j        }t          j        }	g }
t          |          D ]}|
                    t          d                               t                    |          }|j        r3|j        dv s*|                              s|                    |          s|
|gz  }
 |||          }|j        r	|j        dv r|
|gz  }
|j        |k    rt#          |j        |	          }	t'          |j        |          }|t          j        ur||k    rt#          ||          },|	t          j        ur|	|k    rt'          |	|          }Rt)          |t+          |
           }k|||fS )zN
        Turn ``cond`` into a strip (a, b), and auxiliary conditions.
        r   )_solve_inequalitytT)realc                 6    |                                  d         S r   )as_real_imagrb   s    rE   <lambda>z:_mellin_transform.<locals>.process_conds.<locals>.<lambda>)  s    !.."2"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@@@@@Jf&,,''#D!!! 	* 	*AB#BDq\\ + +YY557 77;tBqEE1~~  H,,66!99 -,.FF1II -QCKD((Q//) |33QCKD8q==TXr**BBTXr**BB##aAJJ1---"''AJJ#r4y))!SyrF   c                 &    g | ]} |          S r   r   )rs   r   r   s     rE   r   z%_mellin_transform.<locals>.<listcomp>@  s#    777!]]1777rF   c                 *    g | ]}|d          dk    |S )rW   Fr   rs   rb   s     rE   r   z%_mellin_transform.<locals>.<listcomp>A  s!    ///11QrF   c                 N    | 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   rc   s              @@rE   _mellin_transformr     s   
 	s&**A
1q1u:>1%%A55?? \211A4F
3SUVU[[[> P$Xq2NOOOfQiGAtuuX 8$a68 8 	8% % % % %N 8777y777E/////E	JJ;;J<<< J$Xq2HIIIaIAq#QVVAr]]H--1vs::rF   c                   (    e Zd ZdZdZd Zd Z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                      t          |||fi |S r]   )r   r`   s        rE   re   z"MellinTransform._compute_transformW  s     Aq22E222rF   c                 b    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QCKDDAwQ #t*,F1IQ"t++s1v($ :< < <
rF   N)rG   rH   rI   rJ   r   re   ri   ro   r   rF   rE   r   r   K  sR          E3 3 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##(115111rF   c                 B   | \  }}t          |t          z            }t          |t          z            }t          | |z  |                                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5QwrzAArF   c                       e Zd ZdZdS )MellinTransformStripErrorzF
    Exception raised by _rewrite_gamma. Mainly for internal use.
    N)rG   rH   rI   rJ   r   rF   rE   r   r     s          	DrF   r   c           	      8   -./012 t          ||g          \  -.-.fd}g }                     t                    D ][}|                              s|j        d         }|j        r |j                  d         } |j                  \  }}	||gz  }\                     t          t          t          t                    D ]c}|                              s|j        d         }|j        r |j                  d         } |j                  \  }}	||t          z  gz  }dd |D             }t           j        /|D ]}
|
j        s|
/ n/fd|D             }t          d |D                       r/j        st#          ddd	          /t%          t&          d
 |D             t           j                  z  }|/k    r8t)          |          dk    r/}n"/t%          t*          d |D                       z  }                     |z             t           j        |z  }t           j        |z  }--|z  -..|z  .                                 \  }}t1          j        |          }t1          j        |          }t5          t7          |t9          d                              t5          t7          |t9          d                              z   }g }g }g }g }g } fd0|r[|                                \  122r||}}|}n||}}|}01fd}1                              s|1gz  }n1j        st?          1t@                    r1j        r1j!        }1j         }ntE          d          }1j         }|j#        r$2}|dk     r| }|||fgtI          |          z  z  }|                              s) ||          \  }}2sd|z  }|||z  gz  }|||z  gz  }n] 01          1%                              r.tM          1          }|'                                dk    r}|(                                d         }tS          |          }t)          |          |'                                k    rtU          j+        |          }||gz  }|2fd|D             z  }|,                                \  }}||gz  }|| z  } ||2          r+|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  }nt?          1t                    rh |1j        d                   \  }}2rC|dk    r || |z  2          dk    s|dk     r# || |z  2          dk    rt]          d          |||fgz  }nt?          1t                    r|1j        d         }2r9t          |t          z            t          d|t          z  z
            t          }"}!} nt_           ||          -.          \  } }!}"|| 2 f|!2 fgz  }||"gz  }n t?          1t                    rC1j        d         }|t          |d          2ft          t          dz  |z
  d          2 fgz  }nt?          1t                    r01j        d         }|t          t          dz  |z
  d          2fgz  }nct?          1t                    rC1j        d         }|t          t          dz  |z
  d          2ft          |d          2 fgz  }n 01          |[|t1          | t1          | z  z  }g g g g f\  }#}$}%}&||#|%df||&|$dffD ]*\  }'}(})2|'r|'                                \  }}|dk    r|dk    rtI          t          |                    }||z  }*||z  }+|j#        sta          d          tc          |          D ]},|'|*|+|,|z  z   fgz  }'2r3|dt          z  d|z
  dz  z  ||t           j2        z
  z  z  z  }|||z  gz  }n3|dt          z  d|z
  dz  z  ||t           j2        z
  z  z  z  }||| z  gz  }|dk    r|(3                    d|z
             n|)3                    |           |',t1          | }|#4                    tj                     |$4                    tj                     |%4                    tj                     |&4                    tj                     |#|$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                    t          t          |                     } t          j        u rdS | k     S | k    S | k    dk    rdS | k    dk    rdS |rd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   rZ   r   )r   is_numerr   r   s     rE   leftz_rewrite_gamma.<locals>.left  s    
 2a55MM:"
**4:r6M:7NG5G4 	4? 	bo 	 	4 ((EFFFrF   r   rT   c                 >    g | ]}|j         rt          |          n|S r   )is_extended_realr   r   s     rE   r   z"_rewrite_gamma.<locals>.<listcomp>8  s*    PPPQq18SVVVqPPPrF   c                     g | ]}|z  S r   r   )rs   rb   common_coefficients     rE   r   z"_rewrite_gamma.<locals>.<listcomp>>  s    AAAaQ))AAArF   c              3   $   K   | ]}|j         V  d S r]   )is_Rationalr   s     rE   ru   z!_rewrite_gamma.<locals>.<genexpr>?  s$      55!555555rF   GammaNzNonrational multiplierc                 6    g | ]}t          |j                  S r   )r   qr   s     rE   r   z"_rewrite_gamma.<locals>.<listcomp>B  s6     4E 4E 4E12 56acFF 4E 4E 4ErF   c                 6    g | ]}t          |j                  S r   )r   pr   s     rE   r   z"_rewrite_gamma.<locals>.<listcomp>I  s     ===!qvv===rF   TFc                 ,    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          |           }|                                dk    r           |                                S )z7 Test if arg is of form a*s+b, raise exception if not. rT   )is_polynomialr6   degree
all_coeffs)r   r   r   r   rc   s     rE   
linear_argz"_rewrite_gamma.<locals>.linear_argl  s`    $3$Q'' &ioo%S!AxxzzQioo%<<>>!rF   c                     g | ]	}|z
  f
S r   r   )rs   r   r   rc   s     rE   r   z"_rewrite_gamma.<locals>.<listcomp>  s"    777q!a%*777rF   r   z Gammas partially over the strip.)evaluaterW   za is not an integerr   )6r   rw   r*   rr   rP   rx   as_independentr   r&   r$   r'   r%   r   Oner   allr   r;   r   r   r   r   r   as_numer_denomr   	make_argsr   zipr   r   is_Powr   r   baser   
is_Integerr   r   r6   r   LTr4   r7   	all_rootsr  NegativeOner_   r   	TypeErrorrangeHalfr   r   r   )3ra   rc   r   r   r   s_multipliersgr   r   _rb   s_multiplierfacexponentnumerdenomrP   facsdfacsnumer_gammasdenom_gammasexponentialsugammaslgammasufacsr  r  exp_rn   r   rsr   gamma1gamma2fac_anapbmbqgammasplusminusnewanewckr   r   r   r   r   r   s3   ``                                           @@@@@@rE   _rewrite_gammar3    s
   ~ 1vYYFBG G G G G G4 MWWU^^ ! !uuQxx 	fQi: 	+$#$Q''*C#3#A&&q% WWS#sC(( $ $uuQxx 	fQi: 	+$#$Q''*C#3#A&&q%(#PP-PPPM  } 	!"E	 BAAA=AAAM55}55555 N/N$Wd4LMMM%fT 4E 4E6C4E 4E 4EFGe'M 'M ML)))}""-LL-==}===>>?L 	
q!L.!!A
%
Cu\!H	~
l	~
l ##%%LE5M%  EM%  EE6$<<(())DUF5MM1J1J,K,KKDDELLL] ] ] ] ]
 f"h 	+\WGEE+\WGE	" 	" 	" 	" 	" 	" 	" xx{{ S	"dVOEE[ P	"JtS11 P	"{  yx ||x &!88#8D$s4yy00XXa[[ &!z$''1 "T6Dq	)q	!ioo%"" :	"T1AxxzzQ q	1a[[r77ahhjj(( *1--B% 77777B7777<<>>DAqaSLE!GAtAx   0QUQBFO,,QUQBK=("Q]AE233Q]A.//e$$ "	":dil++DAq <EEttQBqD(33u<<EEttQBqD(33t;;-:< < <AxGGc"" 	" 	!A N',QrT{{E!ad(OOR'3JJqMM1b"'M'M$f(l+f(l-CDDDdVOEEc"" 	"	!Ac!e,,,h7"Q$(U333\BD DDDc"" 	"	!Ac"Q$(U333X>??DDc"" 	"	!Ac"Q$(U333X>!e,,,(l;= =DD )D//!M  f"P 3:c5k!!C R^NBB+7R*F+7R*G*I    %eX 	 ::<<DAqBww177!IIss| ;#$9:::q 3 3AdQqSj122FF .AbDQUAI.QZ@@C QTF*LLAbDQUAI.QZ@@C Q!WI-LBwwAE""""Q+  	 6 |
C GG G!!!GG G!!!GG G!!!GG G!!!8b"XsHc11rF   c                 J   t          dd| d          |                     t                    } t          |           t	          |           t          |           fD ]}|j        rfd|j        D             }d |D             }d |D             }t          | }s)t          ||	                    t                              }|                    |          t          | fc S 	 t          |d	         d
                   \  }	}
}}}n# t          $ r Y w xY w	 t          |	|
||z  z            }n# t           $ r Y w xY wr|}n	 d	dlm}  ||          }n# t&          $ r t          d| d          w xY w|j        rt+          |j                  dk    rqt          t-          |          z
            |j        d	         j        d	         z  t          t-          |          z
            |j        d
         j        d	         z  z   }t-          t/          |j                            |j        t4          z  k     g}|t          t7          t+          |j                  t+          |j                  k    d	t=          |j                  d
z   k              t-          t/          |j                            |j        t4          z  k              gz  }t7          | }|dk    rt          d| d          ||z                      |          |fc 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           
      :    g | ]}t          |d           S )Fr   )_inverse_mellin_transform)rs   G
as_meijergrc   striprb   s     rE   r   z-_inverse_mellin_transform.<locals>.<listcomp>  sE     % % % .aAuj6;= = = % % %rF   c                     g | ]
}|d          S )rT   r   rs   r   s     rE   r   z-_inverse_mellin_transform.<locals>.<listcomp>  s    (((aQqT(((rF   c                     g | ]
}|d          S )r   r   r<  s     rE   r   z-_inverse_mellin_transform.<locals>.<listcomp>  s    '''QAaD'''rF   )gensr   rT   )hyperexpandr   zCould not calculate integral   Fzdoes not convergerk   ) r.   rewriter*   r5   r   r   rx   rP   r   rw   r)   r   r3   r3  r;   r+   
ValueErrorr   r?  r_   r   r   r   r   argumentdeltar   r2   r*  r,  r   nu)r   rc   x_r:  r9  r  r   r   r   r   r   Cer  r8  hr?  rn   rb   s    ` ``             @rE   r7  r7    sz    	s.DAAAA 	
		%AQiiAq		2 /) /)8 
	0% % % % % % %V% % %D )(4(((E''$'''Dt*C =Ssyy';';<<<88Ar??CK////	,Q58U1XFFOAq!Q% 	 	 	H		1a1f%%AA 	 	 	H	 	>AAI666666KNN& I I I,$a)GI I II ~ >#af++"2"2a#a&&j))!&).*;;A
++AF1IN1,==>
 C
OO$$qwrz12 	RAD		SYY.RXX\0ABBQZ))QWRZ79 9 : 	:4y5==( !%8: : :#||Ar""D((((
 !11b
9
99s0   ,$D
DD"D::
EEE""E>Nc                   j    e Zd ZdZdZ ed          Z ed          Zd Ze	d             Z
d Z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                 h    |t           j        }|t           j        }t          j        | |||||fi |S r]   )rK  _none_sentinelrM   __new__)clsr   rc   rb   r   r   optss          rE   rO  zInverseMellinTransform.__new__C  s?    9&5A9&5A (aAq!DDtDDDrF   c                 ~    | j         d         | j         d         }}|t          j        u rd }|t          j        u rd }||fS )Nr@     )rP   rK  rN  )rA   r   r   s      rE   fundamental_stripz(InverseMellinTransform.fundamental_stripJ  sH    y|TYq\1&555A&555A!trF   c                    |                     dd           t          Jt          t          t          t
          t          t          t          t          t          t          t          t          hat          |          D ]@}|j        r7|                    |          r"|j        t          vrt%          d|d|z            A| 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;   rT  r7  )rA   r   rc   rb   rd   ra   r:  s          rE   re   z)InverseMellinTransform._compute_transformS  s     			*d###UCc3dD$2H %Q'' 	I 	IA} Iq IafH.D.D,-=q%Ca%GI I I&(Aq%AA5A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  so    N!qb'	Aq1?1:+E'Eq$%OAJ$>H? $@ A ABCAD&BXZ 	ZrF   N)rG   rH   rI   rJ   r   r   rN  rZ  rO  r   rT  re   ri   r   rF   rE   rK  rK  5  s          EU6]]N	sBE E E   XB B B Z Z Z Z ZrF   rK  c           	      V     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   )rK  r   )r   rc   rb   r:  rd   s        rE   inverse_mellin_transformr^  i  s8    j D!!Q58U1X>>CLLeLLLrF   c                    t          || z  t          |t          j        z  |z  |z            z  |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                    rt          || d          |j        st          || d          |j        d         \  }}	|                    t                    rt          || d          t          ||          |	fS )z
    Compute a general Fourier-type transform

    .. math::

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

    For suitable choice of *a* and *b*, this reduces to the standard Fourier
    and inverse Fourier transforms.
    z$function not integrable on real axisr   r   r   )r,   r   r   r[  r   r   rr   r-   r   r   NaNr;   r   rP   )
ra   rb   r2  r   r   rl   r   r   
integral_frn   s
             rE   _fourier_transformrb    s*    	!A#c!AO+A-a/0001a6H!*2UVVA55?? .H%%qv--1q!"4ajABBJa(!*ae<<<
x@X@X<$T1.TUUU> L$T1.JKKKfQiGAtuuX M$T1.KLLLQ!!4''rF   c                   *    e Zd ZdZd Zd Zd Zd ZdS )FourierTypeTransformz# Base class for Fourier transforms.c                 0    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 	MrF   c                 0    t          d| j        z            Nz,Class %s must implement b(self) but does notrg  rQ   s    rE   r   zFourierTypeTransform.b  rh  rF   c                     t          ||||                                 |                                 | j        j        fi |S r]   )rb  r   r   rD   r   rA   ra   rb   r2  rd   s        rE   re   z'FourierTypeTransform._compute_transform  sI    !!Q"&&&((DFFHH"&."6A A:?A A 	ArF   c                     |                                  }|                                 }t          ||z  t          |t          j        z  |z  |z            z  |t          j        t          j        f          S r]   )r   r   r-   r   r   r[  r   r   )rA   ra   rb   r2  r   r   s         rE   ri   z!FourierTypeTransform._as_integral  s\    FFHHFFHH!C!/ 1! 3A 5666A<NPQPZ8[\\\rF   NrG   rH   rI   rJ   r   r   re   ri   r   rF   rE   rd  rd    sd        --M M MM M MA A A
] ] ] ] ]rF   rd  c                   "    e Zd ZdZdZd Z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                     dS r   r   rQ   s    rE   r   zFourierTransform.a      qrF   c                      dt           j        z  S )Nr   r\  rQ   s    rE   r   zFourierTransform.b  s    !$wrF   NrG   rH   rI   rJ   r   r   r   r   rF   rE   rp  rp    sC          E      rF   rp  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   )rp  r   ra   rb   r2  rd   s       rE   fourier_transformrz    s+    N *Aq!$$)22E222rF   c                   "    e Zd ZdZdZd Zd ZdS )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                     dS r   r   rQ   s    rE   r   zInverseFourierTransform.a#  rs  rF   c                      dt           j        z  S rY  rv  rQ   s    rE   r   zInverseFourierTransform.b&  s    vrF   Nrw  r   rF   rE   r|  r|    sC          E      rF   r|  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   )r|  r   r   r2  rb   rd   s       rE   inverse_fourier_transformr  *  s+    N 1"1a++0995999rF   c                    t          || z   |||z  |z            z  |t          j        t          j        f          }|                    t
                    st          ||          t          j        fS |j        st          || d          |j
        d         \  }}	|                    t
                    rt          || d          t          ||          |	fS )a  
    Compute a general sine or cosine-type transform
        F(k) = a int_0^oo b*sin(x*k) f(x) dx.
        F(k) = a int_0^oo b*cos(x*k) f(x) dx.

    For suitable choice of a and b, this reduces to the standard sine/cosine
    and inverse sine/cosine transforms.
    r   r   r   )r,   r   r   r   rr   r-   r   r   r   r;   rP   )
ra   rb   r2  r   r   Krl   r   r   rn   s
             rE   _sine_cosine_transformr  X  s     	!A#aa!Ahh,AFAJ 788A55?? .H%%qv--> L$T1.JKKKfQiGAtuuX M$T1.KLLLQ!!4''rF   c                   *    e Zd ZdZd Zd Zd Zd ZdS )SineCosineTypeTransformzK
    Base class for sine and cosine transforms.
    Specify cls._kern.
    c                 0    t          d| j        z            rf  rg  rQ   s    rE   r   zSineCosineTypeTransform.aw  rh  rF   c                 0    t          d| j        z            rj  rg  rQ   s    rE   r   zSineCosineTypeTransform.b{  rh  rF   c           	          t          ||||                                 |                                 | j        j        | j        j        fi |S r]   )r  r   r   rD   _kernr   rl  s        rE   re   z*SineCosineTypeTransform._compute_transform  sT    %aA&*ffhh&*n&:&*n&:E E ?DE E 	ErF   c                     |                                  }|                                 }| 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   r2  r   r   r  s          rE   ri   z$SineCosineTypeTransform._as_integral  sY    FFHHFFHHN !AAac!eHHq!&!*&=>>>rF   Nrn  r   rF   rE   r  r  q  sc         
M M MM M M
E E E? ? ? ? ?rF   r  c                   &    e Zd ZdZdZeZd Z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                 J    t          d          t          t                    z  S rY  r"   r   rQ   s    rE   r   zSineTransform.a      AwwtBxxrF   c                     t           j        S r]   r   r  rQ   s    rE   r   zSineTransform.b  	    urF   N	rG   rH   rI   rJ   r   r&   r  r   r   r   rF   rE   r  r    sH          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   ry  s       rE   sine_transformr    s*    H '=Aq!!&/////rF   c                   &    e Zd ZdZdZeZd Zd ZdS )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                 J    t          d          t          t                    z  S rY  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    sH          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   r  s       rE   inverse_sine_transformr    s+    J .1a((-66666rF   c                   &    e Zd ZdZdZeZd Zd ZdS )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                 J    t          d          t          t                    z  S rY  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    sH          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   ry  s       rE   cosine_transformr    s*    H )?1a##(115111rF   c                   &    e Zd ZdZdZeZd Zd ZdS )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                 J    t          d          t          t                    z  S rY  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  ?  sH          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   r  s       rE   inverse_cosine_transformr  S  s+    H 0!!Q**/88%888rF   c                    t          | t          |||z            z  |z  |t          j        t          j        f          }|                    t                    st          ||          t          j        fS |j	        st          || d          |j        d         \  }}|                    t                    rt          || d          t          ||          |fS )zv
    Compute a general Hankel transform

    .. math:: F_\nu(k) = \int_{0}^\infty f(r) J_\nu(k r) r \mathrm{d} r.
    r   r   r   )r,   r(   r   r   r   rr   r-   r   r   r   r;   rP   )ra   r   r2  rE  rl   r   r   rn   s           rE   _hankel_transformr  ~  s     	!GB!$$$Q&AFAJ(?@@A55?? .H%%qv--> L$T1.JKKKfQiGAtuuX M$T1.KLLLQ!!4''rF   c                   :    e Zd ZdZd Zd Zd Zed             ZdS )HankelTypeTransformz+
    Base class for Hankel transforms.
    c                 X     | j         | j        | j        | j        | j        d         fi |S Nr@  )re   r@   rU   rX   rP   )rA   rd   s     rE   r   zHankelTypeTransform.doit  sA    &t&t}'+'='+'>'+y|0 0 */	0 0 	0rF   c                 .    t          ||||| j        fi |S r]   )r  r   )rA   ra   r   r2  rE  rd   s         rE   re   z&HankelTypeTransform._compute_transform  s"     Aq"djBBEBBBrF   c                 ~    t          |t          |||z            z  |z  |t          j        t          j        f          S r]   )r-   r(   r   r   r   )rA   ra   r   r2  rE  s        rE   ri   z HankelTypeTransform._as_integral  s5    '"ac***1,q!&!*.EFFFrF   c                 f    |                      | j        | j        | j        | j        d                   S r  )ri   r@   rU   rX   rP   rQ   s    rE   r   zHankelTypeTransform.as_integral  s3      !%!7!%!8!%1/ / 	/rF   N)	rG   rH   rI   rJ   r   re   ri   r   r   r   rF   rE   r  r    sl         0 0 0C C CG G G / / X/ / /rF   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rG   rH   rI   rJ   r   r   rF   rE   r  r    s          EEErF   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   r2  rE  rd   s        rE   hankel_transformr    s,    \ -?1aB'',55u555rF   c                       e Zd ZdZdZdS )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          EEErF   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   r2  r   rE  rd   s        rE   inverse_hankel_transformr    s-    \ 4!!Q2..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   rB  r   r3  r7  rV  rK  r^  rb  rd  rp  rz  r|  r  r  r  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 4 4 4 4 4 B B B B B B B B = = = = = = = = = = A A A A A A A A H H H H H H H H H H H H 7 7 7 7 7 7 C C C C C C C C C C ? ? ? ? ? ? G G G G G G G G G G G G 2 2 2 2 2 2 = = = = = = 9 9 9 9 9 9 1 1 1 1 1 1 / / / / / / / / , , , , , , E E E E E E E E E E E E E E ' ' ' ' ' ' . . . . . . . . + + + + + + . . . . . . & & & & & &! ! ! ! !0 ! ! !(Y  Y  Y  Y  Y  Y  Y  Y x    6 9U1 1 1 
+> A; A; A; 
A;H    '   B)2 )2 )2X*B *B *BZ	 	 	 	 	
 	 	 	h2 h2 h2V	 48: 8: 8: 8:t 1Z 1Z 1Z 1Z 1Z. 1Z 1Z 1Zh5M 5M 5Mx 4( ( ( (<] ] ] ] ], ] ] ],    +   &'3 '3 '3T    2   &': ': ':\ 4( ( ( (0? ? ? ? ?/ ? ? ?8    +   ($0 $0 $0N    2   (%7 %7 %7P    -   ($2 $2 $2N    4   ($9 $9 $9V 4( ( ( (*/ / / / /+ / / /4
 
 
 
 
) 
 
 
.6 .6 .6b
 
 
 
 
0 
 
 
.= .= .=l + * * * * * * * *, . !8  6 ": $>   rF   