
    EdHe                    p   d Z ddlmZmZ ddlmZ ddlmZmZm	Z	 ddl
mZ ddlmZmZmZmZmZmZmZmZmZ ddlmZ ddlmZmZ dd	lmZmZmZmZm Z m!Z! dd
l"m#Z#m$Z$ ddl%m&Z&m'Z'm(Z( ddl)m*Z* ddl+m,Z,m-Z- ddl.m/Z/m0Z0m1Z1m2Z2m3Z3 ddl4m5Z5m6Z6m7Z7 ddl8m9Z9m:Z:m;Z;m<Z<m=Z= ddl>m?Z? ddl@mAZAmBZBmCZC ddlDmEZEmFZF ddlGmHZHmIZImJZJmKZKmLZL ddlMmNZNmOZOmPZPmQZQ ddlRmSZSmTZT ddlUmVZVmWZWmXZX ddlYmZZZm[Z[m\Z\ ddl]m^Z^ ddl_m`Z`maZa ddlbmcZc ddldmeZemfZfmgZgmhZhmiZi ddljmkZk ddllmmZmmnZn ddlompZp dd lqmrZrmsZs dd!ltmuZu dd"lvmwZwmxZx dd#lymzZzm{Z{m|Z| dd$l}m~Z~ dd%lmZ  G d& d'e          Z G d( d)e          Zd* Zd+ Z ed,          Zd- Zeed.fd/            Z G d0 d1e          Zd2 Zd3 Z G d4 d5e          Zd6 Z ed.          dqd7            Zd8a G d9 d:e          Zd; Zd< Zd= Zedrd>            Zd? Zd@ ZdA ZdrdBZdrdCZdrdDZdrdEZdrdFZdrdGZ G dH dIe          ZdrdJZ ed.          drdK            Z G dL dMe          ZdsdNZdO Z ed.          drdP            Z G dQ dRe          Z G dS dTe          ZdU Z G dV dWe          ZdX Z ed.          drdY            Z G dZ d[e          Z G d\ d]e          Zd^ Z G d_ d`e          Zda Z G db dce          Zdd Z G de dfe          Zdg Z ed.          drdh            Z G di dje          Z G dk dle          Zdm Z G dn doe          Zdp Zd8S )tz Integral Transforms     )reducewraps)repeat)SpiI)Add)	AppliedUndef	count_ops
Derivativeexpandexpand_complex
expand_mulFunctionLambdaWildFunction)Mul)igcdilcm)
_canonicalGeGtLt
UnequalityEq)default_sort_keyordered)DummysymbolsWild)postorder_traversal)	factorialrf)reargAbs
polar_liftperiodic_argument)explog	exp_polar)coshcothsinhtanhasinh)ceiling)MaxMinsqrt)	Piecewisepiecewise_fold)coscotsintanatan)besselibesseljbesselkbessely)
DiracDelta	Heaviside)erferfcEi)digammagamma
lowergamma)meijerg)	integrateIntegral)_dummy)to_cnf	conjuncts	disjunctsOrAnd)
MatrixBase)_lin_eq2dictPolyNonlinearError)roots)factorPoly)together)CRootOfRootSum)sympy_deprecation_warningSymPyDeprecationWarningignore_warnings)iterable)debugc                   "     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	transformre   msg	__class__s       :lib/python3.11/site-packages/sympy/integrals/transforms.pyrd   zIntegralTransformError.__init__@   s=    9BCCCH	J 	J 	J     )__name__
__module____qualname____doc__rd   __classcell__)ri   s   @rj   r`   r`   2   sB         ! ! ! ! ! ! ! ! !rk   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rf   s    rj   re   zIntegralTransform.function]        y|rk   c                     | j         d         S )z; The dependent variable of the function to be transformed.    rt   rv   s    rj   function_variablez#IntegralTransform.function_variableb   rw   rk   c                     | j         d         S )z% The independent transform variable.    rt   rv   s    rj   transform_variablez$IntegralTransform.transform_variableg   rw   rk   c                 ^    | j         j                            | j        h          | j        hz
  S )zj
        This method returns the symbols that will exist when the transform
        is evaluated.
        )re   free_symbolsunionr}   rz   rv   s    rj   r   zIntegralTransform.free_symbolsl   s3     })//1H0IJJ%&' 	'rk   c                     t           NNotImplementedErrorrf   fxshintss        rj   _compute_transformz$IntegralTransform._compute_transformu       !!rk   c                     t           r   r   rf   r   r   r   s       rj   _as_integralzIntegralTransform._as_integralx   r   rk   c                 Z    t          | }|dk    rt          | j        j        d d          |S )NF )rP   r`   ri   name)rf   extraconds      rj   _collapse_extraz!IntegralTransform._collapse_extra{   s4    E{5= 	H()<dBGGGrk   c                 &    d }t           fd j                            t                    D                        }|r3	   j         j         j         j        fi |}n# t          $ r d }Y nw xY w j        }|j        st          |          }||fS )Nc              3   L   K   | ]}|                     j                  V  d S r   )hasrz   ).0funcrf   s     rj   	<genexpr>z2IntegralTransform._try_directly.<locals>.<genexpr>   sN       N N#'  $xx(>?? N N N N N Nrk   )
anyre   atomsr
   r   rz   r}   r`   is_Addr   )rf   r   Ttry_directlyfns   `    rj   _try_directlyzIntegralTransform._try_directly   s     N N N N+/=+>+>|+L+LN N N N N N 	+D+DM*D,CN NGLN N)    ]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 t          |g          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 )ry   N )ri   listru   doit)r   r   r   rf   s     rj   
<listcomp>z*IntegralTransform.doit.<locals>.<listcomp>   s_     % % % E>4>QC$ty}*=*=$=?DMMuMM % % %rk   r   r|   ry   r   )popr   r   ru   
isinstancetupleappendlenr	   r   r   r]   r`   ri   _namere   as_coeff_mulrz   r   r   )rf   r   r   r   r   r   resr   ressr   coeffrests   ``          rj   r   zIntegralTransform.doit   sW   * 99Z//99Z..$j""++U++A 	H9 	 (E*% % % % %G% % %CED 	% 	%!!U++ AAaD!!!q66Q; %LL1&&&&VVaZ %aeW$E~ !4j))++4j 
,,U33E?? ( #<<%,,66<')     	A($dmZA A A ood&<==t^T^sDzlT$)ABB-5H5H&HJJJs   %AE- )E- -
E:9E:c                 N    |                      | j        | j        | j                  S r   )r   re   rz   r}   rv   s    rj   as_integralzIntegralTransform.as_integral   s)      0F!%!8: : 	:rk   c                     | j         S r   )r   )rf   ru   kwargss      rj   _eval_rewrite_as_Integralz+IntegralTransform._eval_rewrite_as_Integral   s    rk   N)rl   rm   rn   ro   propertyre   rz   r}   r   r   r   r   r   r   r   r   r   rk   rj   rr   rr   F   s        ,   X   X   X ' ' X'" " "" " "    "EK EK EKN : : X:         rk   rr   c                 h    |r/ddl m} ddlm}  | |t	          |           d                    S | S )Nr   r   )	powdenestT)polar)sympy.simplifyr   sympy.simplify.powsimpr   r6   )exprr   r   r   s       rj   	_simplifyr      s[     E++++++444444x		."6"6dCCCDDDKrk   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   ru   r   r   r   s       rj   wrapperz0_noconds_.<locals>.make_wrapper.<locals>.wrapper   s-    $'''C 1vJrk   )r   )r   r   defaults   ` rj   make_wrapperz_noconds_.<locals>.make_wrapper   sA    	t#* 	 	 	 	 	 	 
	
 rk   r   )r   r   s   ` rj   	_noconds_r      s$    $     rk   Fc                 P    t          | |t          j        t          j        f          S r   )rI   r   ZeroInfinity)r   r   s     rj   _default_integratorr     s    QAFAJ/000rk   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. r   zmellin-transformry   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r   s    rj   <lambda>z:_mellin_transform.<locals>.process_conds.<locals>.<lambda>3  s    !.."2"21"5 rk   z==z!=)sympy.solvers.inequalitiesr   r   NegativeInfinityr   truerM   rL   r   rN   replacer$   subsis_Relationalrel_opr   ltsr2   gtsr3   rP   rO   )r   r   abauxcondsr   ca_b_aux_dd_solnr   s                 rj   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QCKD8q= +TXr**BBTXr**BB# *a *AJJ1-- *"' *AJJ#r4y))!Syrk   c                 &    g | ]} |          S r   r   r   r   r   s     rj   r   z%_mellin_transform.<locals>.<listcomp>J  #    777!]]1777rk   c                 *    g | ]}|d          dk    |S )r|   Fr   r   r   s     rj   r   z%_mellin_transform.<locals>.<listcomp>K  s%    ///11/Q///rk   c                 N    | d         | d         z
  t          | d                   fS )Nr   ry   r|   r   r   s    rj   r   z#_mellin_transform.<locals>.<lambda>L  s!    adQqTk9QqT??; rk   keyno convergence found)rK   r   rJ   r   r   r   r   r   r   is_Piecewiser`   ru   rN   sort)r   r   s_
integratorr   Fr   r   r   r   r   r   r   s              @@rj   _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::rk   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        rj   r   z"MellinTransform._compute_transforma  s     Aq22E222rk   c                 b    t          |||dz
  z  z  |t          j        t          j        f          S Nry   )rJ   r   r   r   r   s       rj   r   zMellinTransform._as_integrald  s)    !a!e*q!&!*&=>>>rk   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   ry   TFr   zno combined convergence.)r2   r3   rP   r`   )	rf   r   r   r   r   sasbr   r   s	            rj   r   zMellinTransform._collapse_extrag  s      	 	KHRa"IA"IAQCKDDAwQ #t*,F1IQ"t+ 	<s1v 	<($ :< < <
rk   N)rl   rm   rn   ro   r   r   r   r   r   rk   rj   r  r  U  sR          E3 3 3? ? ?    rk   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   )r   r   r   r   s       rj   mellin_transformr  v  s*    R )?1a##(115111rk   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   ry   )r   r   r1   r   rF   )m_nr   r   r   mnrs          rj   _rewrite_sinr    s    J DAq1R4A1R4A1q~~''**++A1q1uQUQY1_55QwrzAArk   c                       e Zd ZdZdS )MellinTransformStripErrorzF
    Exception raised by _rewrite_gamma. Mainly for internal use.
    N)rl   rm   rn   ro   r   rk   rj   r  r    s          	Drk   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   r   r  )r   is_numerr   r   s     rj   leftz_rewrite_gamma.<locals>.left  s    
 2a55MM 	"
* 	4 	r6M 	7NG 	5G 	4 	4? 	bo 	 	4 ((EFFFrk   r   ry   c                 >    g | ]}|j         rt          |          n|S r   )is_extended_realr&   r   s     rj   r   z"_rewrite_gamma.<locals>.<listcomp>B  s*    PPPQq18SVVVqPPPrk   c                     g | ]}|z  S r   r   )r   r   common_coefficients     rj   r   z"_rewrite_gamma.<locals>.<listcomp>H  s    AAAaQ))AAArk   c              3   $   K   | ]}|j         V  d S r   )is_Rationalr   s     rj   r   z!_rewrite_gamma.<locals>.<genexpr>I  s$      55!555555rk   GammaNzNonrational multiplierc                 6    g | ]}t          |j                  S r   )r   qr   s     rj   r   z"_rewrite_gamma.<locals>.<listcomp>L  s6     4E 4E 4E12 56acFF 4E 4E 4Erk   c                 6    g | ]}t          |j                  S r   )r   pr   s     rj   r   z"_rewrite_gamma.<locals>.<listcomp>S  s     ===!qvv===rk   TFc                 ,    t          dd| z            S )NInverse MellinzUnrecognised form '%s'.)r`   )factr   s    rj   	exceptionz!_rewrite_gamma.<locals>.exceptionk  s    %&6;TW[;[\\\rk   c                      | j                   s           t          |           }|                                dk    r           |                                S )z7 Test if arg is of form a*s+b, raise exception if not. ry   )is_polynomialrV   degree
all_coeffs)r%   r&  r*  r)  r   s     rj   
linear_argz"_rewrite_gamma.<locals>.linear_argv  sc    $3$Q'' &ioo%S!AxxzzQ &ioo%<<>>!rk   c                     g | ]	}|z
  f
S r   r   )r   r   r  r   s     rj   r   z"_rewrite_gamma.<locals>.<listcomp>  s"    777q!a%*777rk   r  z Gammas partially over the strip.)evaluater|   za is not an integerr   )6r   r   rF   r   ru   r   as_independentr   r9   r7   r:   r8   r   Oner!  allr  r`   r   r   r   r   r   as_numer_denomr   	make_argsr   zipr   r   is_Powr   r)   baser+   
is_Integerr&   r,  rV   r-  LTrT   rX   	all_rootsr.  NegativeOner   r  	TypeErrorrangeHalfr   r   r   )3r   r   r   r   r  s_multipliersgr%   r   _r   s_multiplierfacexponentnumerdenomru   facsdfacsnumer_gammasdenom_gammasexponentialsugammaslgammasufacsr/  r9  exp_r   r&  rsr   gamma1gamma2fac_anapbmbqgammasplusminusnewanewckr   r   r  r*  r)  r  s3   ``                                           @@@@@@rj   _rewrite_gammar`    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 &!8 $#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 <E <ttQBqD(33u< <E<#tQBqD(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Bw 17 !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Bw  AE""""Q+  	 6 |
C GG G!!!GG G!!!GG G!!!GG G!!!8b"XsHc11rk   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)r   G
as_meijergr   stripr   s     rj   r   z-_inverse_mellin_transform.<locals>.<listcomp>  sE     % % % .aAuj6;= = = % % %rk   c                     g | ]
}|d          S )ry   r   r   r&  s     rj   r   z-_inverse_mellin_transform.<locals>.<listcomp>  s    (((aQqT(((rk   c                     g | ]
}|d          S )r   r   ri  s     rj   r   z-_inverse_mellin_transform.<locals>.<listcomp>  s    '''QAaD'''rk   )gensr   ry   )hyperexpandr(  zCould not calculate integral   Fzdoes not converger   ) rK   rewriterF   rU   r   r   r   ru   r	   r   rA   r   rP   r`  r`   rH   
ValueErrorr   rl  r   r   r   r&   r%   argumentdeltar   rO   rW  rY  r$   nu)r  r   x_rg  rf  rB  r   r   r   r   r   CerE  re  hrl  r   r   s    ` ``             @rj   rd  rd    s    	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 >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   )rx  _none_sentinelrr   __new__)clsr  r   r   r   r   optss          rj   r|  zInverseMellinTransform.__new__M  sE     	6&5A 	6&5A (aAq!DDtDDDrk   c                 ~    | j         d         | j         d         }}|t          j        u rd }|t          j        u rd }||fS )Nrm     )ru   rx  r{  )rf   r   r   s      rj   fundamental_stripz(InverseMellinTransform.fundamental_stripT  sL    y|TYq\1&55 	A&55 	A!trk   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)   rF   r9   r7   r:   r8   r,   r.   r/   r-   r"   r#   r!   is_Functionr   r   r`   r  rd  )rf   r  r   r   r   r   rg  s          rj   r   z)InverseMellinTransform._compute_transform]  s     			*d### 	UCc3dD$2H %Q'' 	I 	IA} Iq IafH.D I,-=q%Ca%GI I I&(Aq%AA5AAArk   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 Nr|   )ri   _crJ   r   ImaginaryUnitr   Pi)rf   r  r   r   r   s        rj   r   z#InverseMellinTransform._as_integralm  so    N!qb'	Aq1?1:+E'Eq$%OAJ$>H? $@ A ABCAD&BXZ 	Zrk   N)rl   rm   rn   ro   r   r   r{  r  r|  r   r  r   r   r   rk   rj   rx  rx  ?  s          EU6]]N	sBE E E   XB B B Z Z Z Z Zrk   rx  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   ry   r   )rx  r   )r  r   r   rg  r   s        rj   inverse_mellin_transformr  s  s8    j D!!Q58U1X>>CLLeLLLrk   c                     fdfdfdfd}d }ddl m}  ||           }  || t                    }  || t          fd          }  || t          |          } t          |           S )	a  
    Naively simplify some conditions occurring in ``expr``, given that `\operatorname{Re}(s) > a`.

    Examples
    ========

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

    >>> from sympy import Ne
    >>> simp(Ne(1, x**3), x, 1)
    True
    >>> simp(Ne(1, x**3), x, 2)
    True
    >>> simp(Ne(1, x**3), x, 0)
    Ne(1, x**3)
    c                 J    | k    rdS | j         r| j        k    r| j        S d S r	  )r8  r9  r)   )exr   s    rj   powerz_simplifyconds.<locals>.power  s7    7 	19 	A 	6Mtrk   c                 8   |                                r|                               rdS t          | t                    r| j        d         } t          |t                    r|j        d         }|                                r d|z  d| z            S  |          }|dS 	 |dk    r)t          |           t                    |z  k    dk    rdS |dk     r)t          |           t                    |z  k    dk    rdS dS dS # t          $ r Y dS w xY w)z_ Return True only if |ex1| > |ex2|, False only if |ex1| < |ex2|.
            Else return None. Nr   ry   TF)r   r   r&   ru   r>  )ex1ex2r  r   biggerr  r   s      rj   r  z_simplifyconds.<locals>.bigger  sL    771:: 	#''!** 	4c3 	(1+Cc3 	(1+C771:: 	(6!C%3'''E#JJ 	4	1u #c((c!ffai/D8 u1u #c((c!ffai/D8 t    	 	 	DD	s   )-D -D 
DDc                     | j         st          | t                    r|j         st          |t                    s| |k     S  | |          }|| S | |k     S )z simplify x < y )is_positiver   r&   )r   yr  r  s      rj   repliez_simplifyconds.<locals>.replie  sj     	As!3!3 		)3As););	ENF1aLL 	5LArk   c                 H     | |          }|dv rdS t          | |          S )NTFT)r   )r   r  r   r  s      rj   repluez_simplifyconds.<locals>.replue  s4    F1aLL 	4!Qrk   c                 <    | dv rt          |           S  | j        | S )Nr  )boolr   )r  ru   s     rj   replz_simplifyconds.<locals>.repl  s)     	88Orz4  rk   r   )collect_absc                      ||           S r   r   )r   r  r  s     rj   r   z _simplifyconds.<locals>.<lambda>  s    vva|| rk   )sympy.simplify.radsimpr  r   r   r   r   )	r   r   r   r  r  r  r  r  r  s	    ``   @@@rj   _simplifycondsr    s    @           ,             ! ! ! 322222;tD4b&!!D4b333344D4j&))DT77Nrk   c                 R    t          | |                     t                              S )zs
    Expand an expression involving DiractDelta to get it as a linear
    combination of DiracDelta functions.
    )rR   r   r@   r   s    rj   expand_dirac_deltar    s     
 djj44555rk   c           	      N    t          d          t          dg          }g }g }	 t                     \  }}n# t          $ r t	          d d          w xY w|                                D ]\  }	}
|	                    t          |z                      }|r3|                    |
	                    d          ||         z             _|	j
        d         	                    d          j        rt	          d d          |                    |	|
z             t          t          t           z            t          |g|R  z  t          j        t          j        f          t          |           }|                    t&                    s;t)          |	                              |          t          j        t          j        fS |j        st	          d d          |j
        d         \  }}|                    t&                    rt	          d d	           fd
fdt1          |          D             }d |D             }|sd |D             }t3          t5          |                    }d |                    fd           |st	          d d          |d         \  }}fd}|r"t9          ||          }t9          ||          }t)          |	                              |           ||          t;           ||                    fS )z The backend function for Laplace transforms.

    This backend assumes that the frontend has already split sums
    such that `f` is to an addition anymore.
    r   r   excludeLaplacez'could not expand DiracDelta expressionsr   znot implemented yet.r   r   c                 	   ddl m} t          j        }t          j        }t          t          |                     } t          dt          g          \  }}}}}}	}
|t          t          |z   |z                      z  |k     |t          t          |z   |z                      z  |k    t          t          |z   |z  |z  |                    |k     t          t          |z   |z  |z  |                    |k    t          t          t          |z             |z  |z  |                    |k     t          t          t          |z             |z  |z  |                    |k    f}| D ]Q}t          j        }g }t          |          D ]}|j        r|j        j        v r|j        }|j        r#t'          |t(          t*          f          r|j        }|D ]}|                    |          r nrG|         j        r:|         |         z  t2          dz  k    rt5          |         z              dk     }|                    |t7          |t          t          |
z                      z  |z            t          |z            |	z  z  z
  dk               sc|                    t7          |t          t          |z  |
z  |                    |z  z
            t          |z            |	z  z  dk               sp|                    |t7          t          t          t                    |z  |
z  |                    |z            t          |z            |	z  z  z
  dk               r9t9          fd||||	|
fD                       rt5                    |         k    }|                    t4          d                               t5                              }|j        r3|j        dv s*|                               s|                               s||gz  } ||          }|j        r	|j        dv r||gz  }|j!        k    rtE          d	d
          tG          |j!        |          }|t          j        urtI          ||          }:tK          |tM          |           }S||j        r|j'        n|fS )z7 Turn ``conds`` into a strip and auxiliary conditions. r   r   zp q w1 w2 w3 w4 w5r}  r  r|   c              3   2   K   | ]}|         j         V  d S r   )r  )r   wildr  s     rj   r   z<_laplace_transform.<locals>.process_conds.<locals>.<genexpr>_  s*      RRTQtW0RRRRRRrk   c                 Z    |                                                                  d         S r   )r   r   r   s    rj   r   z;_laplace_transform.<locals>.process_conds.<locals>.<lambda>b  s    !((**"9"9";";A"> rk   r   r  zconvergence not in half-plane?)(r   r   r   r   r   rM   rL   r   r    r&   r%   r(   r'   r   rN   r   rhsr   reversedr   r   r   reversedsignmatchr  r   r$   r7   r4  r   r   r   r   r   r`   r3   r2   rP   rO   	canonical)r   r   r   r   r&  r$  w1w2w3w4w5patternsr   r   r   r   patr   r   r  r   r   r   s                      @rj   r   z)_laplace_transform.<locals>.process_conds9  s   @@@@@@f&--((#* dQC$9 $9 $9 1b"b"b c#q2vqj//"""R'c#q2vqj//"""b(!1r6A+a-4455:!1r6A+a-4455;!:a"f#5#5"9!";R@@AABF!:a"f#5#5"9!";R@@AARGI  -	* -	*ABDq\\ &+ &+? #qAE,>'> #
A? 'z!b"X'>'> 'A#  CA  /t' /AbE!A$J"Q$,> /AbE	]]NQ.GGABs3qt99~~$5b$8 9 9#ae**b. HH1LMM \A$5aeBh$B$B C CB FFGGArE

TVVYZZ\ \A 2C$5jmmR6G6JA$N$N O OPR R  !!R%jj"n- -/012 2A  %RRRRb"b"b=QRRRRR %1!AYY>>@ @@DRUUA  H,66!99,.FF1II QCKD((Q//) |3QCKD8q= +0A)IK K K TXr**BB# *AJJ#r4y))3#4=#--#==rk   c                 &    g | ]} |          S r   r   r   s     rj   r   z&_laplace_transform.<locals>.<listcomp>x  r   rk   c                 R    g | ]$}|d          dk    |d         t           j        u"|%S )ry   Fr   )r   r   r   s     rj   r   z&_laplace_transform.<locals>.<listcomp>y  s6    SSSA!A$%-SAaD@R4RSaSSSrk   c                 *    g | ]}|d          dk    |S )ry   Fr   r   s     rj   r   z&_laplace_transform.<locals>.<listcomp>{  s%    444adem4!444rk   c                 6    | dv rdS |                                  S )Nr  r   r   r  s    rj   cntz_laplace_transform.<locals>.cnt~  s$    =  	1~~rk   c                 8    | d           | d                   fS Nr   ry   r   )r   r  s    rj   r   z$_laplace_transform.<locals>.<lambda>  s    qteSS1YY/ rk   r   r   c                 0    |                                S r   )r   )r   r   r  s    rj   sbsz_laplace_transform.<locals>.sbs  s    yyBrk   )r   r    r  rS   r`   itemsr  r@   r   r   ru   is_zeror	   rI   r)   r   r   r   r   rJ   r   r   r   r   rN   r   r   r   r  r   )r   r   r  r   r   	deltazerodeltanonzerointegratable	deltadict
dirac_funcdirac_coeffr&  r  r   r   conds2r   r  r  r   r   s   ```               @@@rj   _laplace_transformr    s    	c

AS1#AILA"4Q"7"7ii A A A$1?A A 	AA $-??#4#4 	< 	<
KZ!__-- 	<[--a221Q478888q!&&q++3 <,Y-CE E E ##J{$:;;;;Ic1"Q$ii#l"B\"B"B"BB!&!*-/ /O	 	A 55?? N21113EqvMM> 8$q68 8 	8 fQiGAtuuX 9$q79 9 	9=> => => => => => =>~ 8777y777ESSSSSF 544U444!!E      
JJ////J000 K$Y3IJJJ1XFAs            (1a##S!Q''QVVAr]]H--ss1vvz##c((7K7KKKs   A   Ac                     | j         }t          | j                  }t          | j                  dk    r| S fd|D             }|j        r ||                               S  || S )a  
    This is an internal helper function that traverses through the epression
    tree of `f(t)` and collects arguments. The purpose of it is that
    anything like `f(w*t-1*t-c)` will be written as `f((w-1)*t-c)` such that
    it can match `f(a*t+b)`.
    r   c                 0    g | ]}t          |          S r   _laplace_deep_collect)r   r%   r   s     rj   r   z)_laplace_deep_collect.<locals>.<listcomp>  s$    >>>#%c1-->>>rk   )r   r   ru   r   r   collect)r   r   r   ru   s    `  rj   r  r    s|     6D<<D
16{{a >>>>>>>; 	4;&&q)))4;rk   c                 H    t          d g          }t          d g          }t          d g          }t          d g          }t          d g          } fd}g |||z  t          j        t          j        |ft	          | z  |z
            t          | |z  |z            t          |          z  t          t          |dk    |dk              t          |dk     |dk                        t          j        |ft	          | z  |z
            t          d          t          t          |dk     |dk              t          |dk    |dk                        t          j        |fd	d	|z  t          j        t          j        |ft          | z  |z
            t          | |z  |z            |z  t          |dk    |dk              t          j        |ft          | z  |z
            d	t          | |z  |z            z
  |z  t          |dk     |dk               t          j        |ft          | z  |z
            d	|z  t          |dk    |dk              t          j        |ft          | z  |z
            dt          |dk     |dk              t          j        |f d	|d
z  z  t          j        t          j        |fd	| z  |z   z  t          | |z  |z             t          | |z  |z            z  |z  |dk    t          j        |fd	t          | z  |z             z  t          |t          z  |z            t          ||z  |z            z  t          t          ||z  |z                      z  |z  |dk    t          j        |ft                      |z   z  t          t          |z            t          t          |          z  t          ||z            z  t          t          ||z                      z  z
  t          j        t          j        |f| z  |z   t          d           d
z  z  d
|t          d	           d
z  z  z  d
t          |z  |z  t          d	          d
z  z  z  t          ||z  |z            z  t          t          ||z  |z                      z  |z  z
  |dk    t          j        |f t          d	          d
z  z   |z   dz  z  t          |z  t          d	          d
z  z  t          |t          d	          d
z  z  z  t          ||z            z  t          t          ||z                      z  z
  t          j        t          j        |fd	|t                     z   dz  z   z  t          |t          d	          d
z  z  z  t          ||z            z  t          t          ||z                      z  t          j        t          j        |f |z  t          |d	z             ||d	z   z  z  |dk    t          j        |f| z  |z   |z  t          |d	z   ||z  |z            t          | |z  |z            z  ||d	z   z  z  |z  t          |dk    |dk              t          j        |f |z   |z   z  ||z  t          |d	z             z  t          | ||z            z  |dk    t          j        |ft          | z  |z
            t          |           ||z
  z  t          j        ||f t          | z  |z
            z  t          |           ||z
  d
z  z  t          j        ||f |z  t          | z            z  t          |d	z             ||z
  |d	z   z  z  |dk    ||ft          |  d
z  z            t          t          dz  |z            t          |d
z  dz  |z            z  t          |t          d|z            z            z  |dk    t          j        |f t          |  d
z  z            z  d	d
|z  z  d
t          t                    z  d|z  t          d          d
z  z  z  |z  t          |t          d|z            z            z  z
  t          j        t          j        |ft          |  z            d
t          ||z            z  t!          d	d
t          ||z            z            z  |dk    t          j        |ft                     t          |  z            z  t          d	          d
z  t          t          |dz  z            z  d	d
t          ||z            z  z   z  t          dt          ||z            z            z  |dk    t          j        |ft          |  z            t                     z  t          t          |z            t          dt          ||z            z            z  |dk    t          j        |ft          |  z             t                     z  z  t          t          |z            t          dt          ||z            z            z  |dk    t          j        |f |z  t          |  z            z  d
||z  |d	z   d
z  z  z  t!          |d	z   d
t          ||z            z            z  |dk    t          j        |ft          dt          | z            z            |dz  t          t          |z            |t          d           d
z  z  z  t          ||z            z  t          t          ||z                      z  z
  t          j        t          j        |ft          dt          | z            z            t                     z  t          |z  t          d	          d
z  z  t          ||z            z  t          t          ||z                      z  t          j        t          j        |ft#          | z            ||d
z  |d
z  z
  z  t          j        t          |          |ft#          | z            d
z  d
|d
z  z  |dz  d|d
z  z  |d
z  z  z
  z  t          j        t          d
|z            |ft#          | z             z  t%          ||z   ||z
  z            d
z  t          j        ||f |z  t#          | z            z  t          |d	z             d
z  ||z
  | d	z
  z  ||z   | d	z
  z  z
  z  |dk    t          |          |ft#          d
t          | z            z            t          t          |z            |z  t          |          z  t          ||z            z  t          j        t          j        |ft                     t#          d
t          | z            z            z  t          t          d	          d
z  z  |t          d           d
z  z  z  |d
z  |z   z  t          ||z            z  t'          t          ||z                      z  |t          d	          d
z  z  |dz  z  z
  t          j        t          j        |ft#          d
t          | z            z            t                     z  t          t          d	          d
z  z  |t          d	           d
z  z  z  t          ||z            z  t'          t          ||z                      z  t          j        t          j        |ft#          t          | z                      d
z  t                     z  t          t          d	          d
z  z  d
z  |t          d	           d
z  z  z  t          ||z            d	z
  z  t          j        t          j        |ft)          | z            ||d
z  |d
z  z
  z  t          j        t          |          |ft)          | z            d
z  |d
z  d
|d
z  z  z
  |dz  d|d
z  z  |d
z  z  z
  z  t          j        t          d
|z            |f |z  t)          | z            z  t          |d	z             d
z  ||z
  | d	z
  z  ||z   | d	z
  z  z   z  |dk    t          |          |ft)          d
t          | z            z            d	|z  t          t          |z            |z  t          |          z  t          ||z            z  t'          t          ||z                      z  z   t          j        t          j        |ft                     t)          d
t          | z            z            z  t          t          d	          d
z  z  |t          d           d
z  z  z  |d
z  |z   z  t          ||z            z  t          j        t          j        |ft)          d
t          | z            z            t                     z  t          t          d	          d
z  z  |t          d	           d
z  z  z  t          ||z            z  t          j        t          j        |ft)          t          | z                      d
z  t                     z  t          t          d	          d
z  z  d
z  |t          d	           d
z  z  z  t          ||z            d	z   z  t          j        t          j        |ft%          | z            t%          ||z  t          j        z              |z  |dk    t          j        |ft%          d	| z  z             t          ||z             |z  t          | |z            z  t          j        t          j        |ft%          | z  |z             t%          |          t          ||z  |z            |z  |z  t          | |z            z  z
  |z  |z  |dk    t          j        |ft%                     t                     z  t          t          |z             t%          d|z            t          j        z   z  t          j        t          j        |f |z  t%                     z  t          |d	z             || d	z
  z  z  t-          |d	z             t%          |          z
  z  |dk    t          j        |ft%          | z            d
z  t%          ||z            t          j        z   d
z  t          d
z  dz  z   |z  |dk    t          j        |ft          |  z            t%                     z  t%          ||z             t          j        z    ||z   z  t          j        | |ft/          | z            ||d
z  |d
z  z   z  t          j        t          j        |ft          t/          | z                      ||d
z  |d
z  z   z  t1          t          |z  d
z  |z            z  |dk    t          j        |ft/          | z             z  t3          ||z            t          j        t          j        |ft/          | z            d
z   z  t%          d	d|d
z  z  |d
z  z  z             dz  t          j        t          j        |ft/          | z            d
z   d
z  z  |t3          d
|z  |z            z  |t%          d	d|d
z  z  |d
z  z  z             z  dz  z
  t          j        t          j        |ft/          d
t          | z            z            t          t          |z            |z  t          |          z  t          | |z            z  |dk    t          j        |ft/          d
t          | z            z             z  t          t'          t          ||z                      z  |dk    t          j        |ft5          | z            ||d
z  |d
z  z   z  t          j        t          j        |ft5          | z            d
z  |d
z  d
|d
z  z  z   |d
z  d|d
z  z  z   z  |z  t          j        t          j        |ft                     t5          d
t          | z            z            z  t          t                    d
z  |t          d           d
z  z  z  |d
|z  z
  z  t          | |z            z  |dk    t          j        |ft5          d
t          | z            z            t                     z  t          t          |z            t          | |z            z  |dk    t          j        |ft/          | z            t/          | z            z  d
|z  |z  |z  |d
z  ||z   d
z  z   z  |d
z  ||z
  d
z  z   z  t          j        t          j        |ft5          | z            t/          | z            z  ||d
z  |d
z  z
  |d
z  z   z  |d
z  ||z   d
z  z   z  |d
z  ||z
  d
z  z   z  t          j        t          j        |ft5          | z            t5          | z            z  ||d
z  |d
z  z   |d
z  z   z  |d
z  ||z   d
z  z   z  |d
z  ||z
  d
z  z   z  t          j        t          j        |ft          | z            t/          | z            z  |||z
  d
z  |d
z  z   z  t          j        ||ft          | z            t5          | z            z  ||z
  ||z
  d
z  |d
z  z   z  t          j        ||ft'          | z            t          |d
z  d
|z  d
z  z            t          |d
|z  z            z  |z  |dk    t          j        |ft'          t          | z                      t          |          t          ||z             z  |z  |dk    t          j        |ft          | z            t'          t          | z                      z  t          |          t          |          z  ||z
  z  |dk    ||ft'          t          | z            d
z            d	t          t          ||z                       z
  |z  |dk    t          j        |ft          t          | z                      t          ||z             t          |          z
  t          ||z             z  |z  |dk    t          j        |ft          | z            t          t          | z                      z  d	|t          ||z            z   z  |dk    t          j        |ft          t          | z            d
z            t          t          ||z                       |z  |dk    t          j        |ft7          || z            ||z  t          |d
z  |d
z  z             |t          |d
z  |d
z  z             z   |z  z  z  t          |dk    |dk              t          j        |f |z  t7          || z            z  d
|z  t          t                    z  t          |t          j        z             z  ||z  z  |d
z  |d
z  z   | t          j        z
  z  z  t          t          |dk    |t          j         k              t;          ||                    t          j        |f |z  t7          || z            z  d
|d	z   z  t          t                    z  t          |t          d          d
z  z             z  ||z  z  |z  |d
z  |d
z  z   | t          d          d
z  z
  z  z  t          t          |dk    |dk              t;          ||d	z                       t          j        |ft7          dd
t          | z            z            t          | |z            |z  |dk    t          j        |f |z  t7          |d
t          | z            z            z  ||d
z  z  || d	z
  z  z  t          | |z            z  t          t          |dk    |dk              t;          ||t          j        z                      t          j        |ft7          d|t           d
z  | z  z             z            t          ||z  |t          |d
z  |d
z  z             z  z
            t          |d
z  |d
z  z             z  |dk    t          j        |ft=          || z            ||z  t          |d
z  |d
z  z
            |t          |d
z  |d
z  z
            z   |z  z  z  t          |dk    |dk              t          |          |f |z  t=          || z            z  d
|z  t          t                    z  t          |t          j        z             z  ||z  z  |d
z  |d
z  z
  | t          j        z
  z  z  t          t          |dk    |t          j         k              t;          ||                    t          |          |f |z  t=          || z            z  d
|d	z   z  t          t                    z  t          |t          d          d
z  z             z  ||z  z  |z  |d
z  |d
z  z
  | t          d          d
z  z
  z  z  t          t          |dk    |dk              t;          ||d	z                       t          |          |f |z  t=          |d
t          | z            z            z  ||d
z  z  || d	z
  z  z  t          ||z            z  t          t          |dk    |dk              t;          ||t          j        z                      t          j        |ft?          d| z            dt          z  tA          ||z            z  t          |d
z  |d
z  z             z  |dk    t          j        |ft!          d| z            t%          |t          |d
z  |d
z  z
            z             t          |d
z  |d
z  z
            z  |dk    t          |          |f}|S )z
    This is an internal helper function that returns the table of Laplace
    transfrom rules in terms of the time variable `t` and the frequency
    variable `s`.  It is used by `_laplace_apply_rules`.
    r   r  r   r  tauomegac                 $    t          |           S r   r  )r   r   s    rj   r   z&_laplace_build_rules.<locals>.<lambda>  s    )!A.. rk   r   ry   r|   rm  r  g      ?r        )!r    r   r   r   r@   r)   r&   rO   rP   rA   rD   r4   r   rC   rF   rG   r>   r.   r*   rB   r,   
EulerGammarE   r9   r-   r;   r7   r=   r@  r   r<   r?   r0   )	r   r   r   r   r  r  r  dcolaplace_transform_ruless	   `        rj   _laplace_build_rulesr    s"    	S1#AS1#AS1#A
uqc
"
"
"C1#&&&E
.
.
.
.Cf !QVQVS!f !A!Aa[[QAaCAAaCA''6f !AqTTAaCAAaCA''6f  qSVQVS!f( qs1u!Aa[[]1ac]]AFC!)f. qs1uQBqDFmQ1ac]]AFC!/f4 qs1uqS1ad^^QVS"5f: qs1u1ac]]AFC!;fB q!tVVQVSCfJ !AY	1"Q$q&kk\"aRT!V**QqS!&#KfT tAaCE{{]	!B$q&\\#ac!e**T$qs1u++...q0qS!&#Uf\ 
!WWac]	"Q$ZZ477
3qs88#DacOO33VQVS]fd c!e!uQwqAaDD57|^Ar!tAv1a((QqSU3Dac!e4E4EEaGGqS!&#efl 1a[!A#dadd1fbQqTT!VnS1XX-d4!99oo==VQVSmft $q''	AHAaDDF^C!HHT$qs))__,VQVSuf| T
1Q3ZZAaCrT163}fD c!eaZ!QqSUC1QKK'AaC022qs^^QVS"EfL T1Q3ZT%!**_Z1Q3'''rT163MfT 	1S\\#YY!_VQUf\ s1Q3s7||^#YY!axVQ]fd T#ac((]
1Q3ZZ1!rT1cefp 	!AqD\\	"Q$q&\\#ad1fQh--QtAaCyy[ 1 11qS!&#qfx sA2ad7||^!WQtBxxZ1!Q')$qac{*;*;;;VQVSyf@ 	!AYYtAaCyy[Ad1Q3iiK(((T163AfH 
!WWS!AYYqTT!VDAqDMM1QtAaCyy[=)#bacl*;*;;T163IfP 	!AYYtAww	"Q$ZZBtAaCyyL!!!T163QfX 	!AYY$q''		"Q$ZZBtAaCyyL!!!qS!&#Yf` T#qbd))^!!Qw!QtAaCyy[111qS!&#afh 	D1IIWT"Q$ZZQqTTE!G$S1XX-d4!99oo==VQVSifp 	D1IItAwwdadd1fc!A#hhtD1II.VQVSqfx 
!A#YY1QT	]VSVVSyf@ 
!A#YY\q!tVQT!AqD&A+VS1XXsAfH 
!A#YYq[!A#!aVQIfP T$qs))^
1Q3ZZ\AaCA2a4=!A#!A./rT3q663QfX 
!D1II+	"Q$ZZ\$q''#ac(("VQVSYf` 
!WWT!D1II+!A$$q&\!qtteAg,!A&s1Q3xx/D1II>q1Q446{1r7?RRVQVSafh 
!D1II+tAww!A$$q&\!qtteAg,s1Q3xx'D1II6VQVSifp 
$qs))__aQ!A$$q&\!^A1aL #ac((1*-VQVSqfx 
!A#YY1QT	]VSVVSyf@ 
!A#YY\d1QT6kAqD1a41$%VS1XXsAfH T$qs))^
1Q3ZZ\AaCA2a4=!A#!A./rT3q663IfP 
!D1II+qSbdAd1gg	c!A#hh	&s4!99~~	55VQVSQfX 
!WWT!D1II+!A$$q&\!qtteAg,!A&s1Q3xx/VQVSYf` 
!D1II+tAww!A$$q&\!qtteAg,s1Q3xx'VQVSafh 
$qs))__aQ!A$$q&\!^A1aL #ac((1*-VQVSifp 	1XX	!A#al
AqS!&#qfx 	1Q3ZZ	!A#hhYq[QBqDVQVSyf@ 	1QZZ	!ffS1QZZ\!^Br!tHH$$a')qS!&#AfJ 	VVDGG^
2a4jj[#ac((1<'(VQVSKfT T#a&&[
1Q3ZZQBqD	71Q3<<A./rT163Uf\ 	1XXq[
1Q3xxq Qq(!+qS!&#]fd 	!AYYs1vv
1Q3xxqs#VaRefl 	q\\
AqDMVQVSmft 	U1W
AqDM41Qu---
1Wafcuf@ 	q\\!^	%']]VQVSAfH 	q\\1_Q1UAX:ad?	AVQVSIfP 	q\\1_QT
4%	??1S1UAX:ad?!2333A55VQVSQfX 	4!99
2a4jjl4773r!t99$c163Yf` 	4!99aD1IIqS!&#afh 	q\\1UAXVQVSifp 	q\\1_d1UAX:o1QuaxZ(*VQVSqf~ 
!WWS4!99	"XXaZQqTTE!Ga!e$S!AYY.qS!&#fF 	4!99d1gg	"Q$ZZQBqD		qS!&#GfN 	1XXc!A#hhqSU1WadAaC!8madAaC!8m,VQVSOfV 	1XXc!A#hh1QT	!Q$AqsQh'AqsQh7VQVSWf^ 	1XXc!A#hh1QT	!Q$AqsQh'AqsQh7VQVS_ff 	1XXc!A#hh1qAVQgfn 	1XXc!A#hhcQqS1HQTMVQofv 	1XXAqsQhQ!W%a'qS!&#wf~ 	ac^^	!WWT!A#YYqqS!&#fF	 	1XXc$qs))nn	!WWT!WW_acqS!SG	fN	 	ac1T!A#YYJqS!&#O	fV	 
$qs))__
1Q3iiQac"1$qS!&#W	f^	 	1XXd4!99oo$qs))_qS!&#_	ff	 
$qs))A+$qs))__QqS!&#g	fn	 Q!__T41QT	??Ad1a419oo-1121ad^^QVS"o	fv	 T'!QqS//T$r((]516??"1a4'Aadqbi(@@QqS!QVG)		bAhh''6w	f~	 T'!QqS//1Xd2hhuQqttAvX&q!t+A-q!tAqDyQBqttAvI.FFQqS!B$Aqs$$afc3	fF
 Q$qs))!AYYq[qS!&#G
fN
 VGAqac{###1Xa1"Q$iQBqD		!QqS!B$Aqx))1638O
fV
 Q$q!tAaCx.. !!1QtAqDAI	QT!Q$Y/qS!&#W
f^
 Q!__T41QT	??Ad1a419oo-1121ad^^SVVS"_
ff
 T'!QqS//T$r((]516??"1a4'Aadqbi(@@QqS!QVG)		bAhh''Q6g
fn
 T'!QqS//1Xd2hhuQqttAvX&q!t+A-q!tAqDyQBqttAvI.FFQqS!B$Aqs$$c!ffc3o
fv
 VGAqac{###1Xa1"Q$iAaC QqS!B$Aqx))1638w
f~
 Q!__U51::d1a419oo%qS!&#
fF Q!__	!DAadOO
tAqDAI/qS#a&&#GfN #"rk   c                 B    |                     dd           }|r| ||fS | S )z
    Internal helper function that will return `(f, a, c)` unless `**hints`
    contains `noconds=True`, in which case it will only return `f`.
    r   F)get)r   r   r   r   r   s        rj   _laplace_crr    s2    
 		)U+++E !Qwrk   c           	         |                     dd          }t          dg          }t          dd          }|                     d	          \  }}	|	                    |          }
|
r|
|         j        d
                                       } |j        |z            }|rR||         d
k    rEt          d           t          d| d|
d|d           t          d           ||         dk    r|dk    rht          fd|
|         	                    t                    D                       s/|t          |
|                                       ||          z  S |t          |
|                                       |fi |z  S t          |
|                                       |||         z  fd|i|}	 |\  }}}|||         z  |z  ||fS # t          $ r |||         z  |z  cY S w xY wdS )a  
    This internal helper function tries to apply the time-scaling rule of the
    Laplace transform and returns `None` if it cannot do it.

    Time-scaling means the following: if $F(s)$ is the Laplace transform of,
    $f(t)$, then, for any $a>0$, the Laplace transform of $f(at)$ will be
    $\frac1a F(\frac{s}{a})$. This scaling will also affect the transform's
    convergence plane.
    r   Tr   r  rB  ry   nargsFas_Addr   _laplace_apply_rules match:      f:     ( ,  )z1      rule: amplitude and time scaling (1.1, 1.2)c              3   B   K   | ]}|                               V  d S r   )r   )r   r   r   s     rj   r   z*_laplace_rule_timescale.<locals>.<genexpr>8  sE       *I *I$$((1++ *I *I *I *I *I *Irk   r   r   N)r   r    r   r2  r  ru   r  r^   r   r   r
   r  r   LaplaceTransform_laplace_apply_rulesr>  )r   r   r   r   r   r   r   rB  r_  r   ma1r%   ma2Lr  r&  r   s    `               rj   _laplace_rule_timescaler  !  ss    		*d++IS1#AS"""Aq//GAt
**Q--C
 &!fk!n$$Q''ci!nn 	&3q6!8 	&/000Eqqq###sss;<<<EFFF1vqy &: Mc *I *I *I *I-0V\\,-G-G*I *I *I 'I 'I M/AA19BD D D D D -c!fkk!nnaLLeLLLL(QQAc!fH = =.2=6;= =&GAq!c!fHQJ1--  & & &SV8A:%%%&4s   G G87G8c                    |                     dd           t          d|g          }t          d|g          }t          d          }t          dd	          }|                     |d
          \  }	}
|
                    t          |          |z            }|r8||                             ||z
            }||         j        d                             |                              ||z
            }|r||         dk    r|r||         ||         k    rt          d           t          d| d|d|d|d	           t          d           t          ||         
                    |          ||fd|i|}	 |\  }}}|	t          ||          |z            z  |z  ||fS # t          $ r" |	t          ||          |z            z  |z  cY S w xY wdS )z
    This internal helper function tries to transform a product containing the
    `Heaviside` function and returns `None` if it cannot do it.
    r   Tr   r  r   r  rB  ry   r  Fr  r   r  r  r  r  r  z      rule: time shift (1.3)r   N)r   r    r   r2  r  rA   ru   r  r^   r  r   r)   r>  )r   r   r   r   r   r   r   r  rB  r_  r   r  r  ma3r  r  r&  r   s                     rj   _laplace_rule_heavisider  H  s   
 
IIj$S1#AS1#AS		AS"""Aq//GAt
**Yq\\!^
$
$C
 *!fll1Q3!fk!n$$Q''--ac22 		*3q6!8 		* 		*AA 		*/000E111ccc333DEEE0111$SV[[^^QNNNNNA*1a#s1vgai..(*Aq11 * * *c!fWQY'))))*4s   >'F& &)GGc           	      v   |                     dd           t          d|g          }t          d          }t          d          }|                     |d          \  }}	|	                    t	          |          |z            }
|
r|
|                             |                              ||z            }|r~t          d	           t          d
| d|
d|d           t          d           t          |
|         ||||         z
  fd|i|}	 |\  }}}||||         z   |fS # t          $ r |cY S w xY wdS )z
    This internal helper function tries to transform a product containing the
    `exp` function and returns `None` if it cannot do it.
    r   Tr   r  r  zFr  r  r  r  r  r  z#      rule: multiply with exp (1.5)r   N)	r   r    r2  r  r)   r  r^   r  r>  )r   r   r   r   r   r   r  r  r_  r   r  r  r  r  r&  r   s                   rj   _laplace_rule_expr  d  si   
 
IIj$S1#AS		AS		Aq//GAt
**SVVAX

C
 !fnnQ%%ac** 		/000Eqqq###sss;<<<7888$SVQ#a&MMtMuMMA1a1SV8Q''   4s   D' 'D65D6c                    |                     dd          }t          d|g          }t          d          }t          d          }|                     |d          \  }	}
t          |          d	d
dd
ft	          |          dd
d
d
ft          |          dt           dt          ft          |          dd
d
t          fg}|D ]}|\  }}}}}|
                    ||z            }|r||         	                    |                              ||z            }|rt          d           t          d| d|d|d           t          d|j        d|d           t          ||         ||fd|i|}	 |\  }}}|d
k    rt          ||                   }nd}||                    |||||         z  z
            ||                    |||||         z  z             z  z   z                                  dz  ||z   |fc S # t           $ r |dk    rj|dk    rd||                    |||||         z  z
            ||                    |||||         z  z             z  z   z                                  dz  cY c S ||                    |||||         z  z
            ||                    |||||         z  z             z  z   z  dz  cY c S w xY wdS )z
    This internal helper function tries to transform a product containing a
    trigonometric function (`sin`, `cos`, `sinh`, `cosh`, ) and returns
    `None` if it cannot do it.
    r   Tr   r  r  r  Fr  z1.6ry   r  z1.7z1.81.9r  r  r  r  r  z      rule: multiply with z ()r   r   r|   N)r   r    r2  r.   r,   r9   r   r7   r  r  r^   r   r  r&   r   r   r>  )r   r   r   r   r   r   r   r  r  r_  r   	trigrulestrigrulefmrr  s1s2sdr  r  r  r  r&  r   cp_shifts                            rj   _laplace_rule_trigr  ~  sw    		*d++IS1#AS		AS		Aq//GAt q''51b!,tAwwq!Q.Ga&&51"b!,s1vvq!Q.GII B B%BBjjA 	Ba&..##))!A#..C B3444111ccc333?@@@2777BBBGHHH(QAJJDJEJJBGAq! 1u %#&s1v;;#$1RAY;!7!7$&qvva2c!f9'='=$="> ?@H

1MhJ+ + + + ! B B BTz Bio B "AFF1a3q6	k$:$:$&qvva2c!f9'='=$=%> !?@H

1 M M M M M M !#AFF1a3q6	k$:$:$&qvva2c!f9'='=$=%> !?@A B B B B B BB 4s   6B	HA6K<AKKc                    |                     dd           t          d|g          }t          d          }t          d|g          }t          dd	          }|                     |t	          |||f          z            }	|	rW|	|         j        d
         |k    r?|	|         j        r1t          d           t          d|            t          d           g }
t          |	|                   D ]}|d
k    r0|	|         	                    |          
                    |d
          }n?t	          |	|         	                    |          ||f          
                    |d
          }|
                    ||	|         |z
  dz
  z  |z             ||	|         z  t          |	|         	                    |          ||fd|i|z  }|	|         |t          |
 z
  z  S dS )z
    This internal helper function tries to transform an expression containing
    a derivative of an undefined function and returns `None` if it cannot
    do it.
    r   Tr   r  r  r  rB  ry   r  r   r  r  z(      rule: time derivative (1.11, 1.12)r   N)r   r    r   r  r   ru   
is_integerr^   r?  r   r   r   r  r	   )r   r   r   r   r   r   r  r  rB  r  r   r_  r  s                rj   _laplace_rule_diffr    s    
IIj$S1#AS		AS1#AS"""A
''!Jq1a&)))
*
*C
 $s1v{1~" $s1v'8 $+,,,#$$$8999s1v 	( 	(A!t BFKKNN''1--s1v{{1~~1v66;;AqAAHHQQ!_Q&''''s1vI*3q6;;q>>1a 4 4d 4-24 4 41vq37{##4rk   c                    |                      |d          \  }}t          ||          }|D ]\  }}	}
}} ||                              |          }|rt          d           t          d|           t          d|d|	           	 t          d|
           |
                    |          }t          d|
d	|           |d
k    rDt          ||	                    |          z  |                    |          t          j        fi |c S # t          $ r t          d           Y w xY w	| 	                    t                    rdS t          t          t          t          t          g}|D ]} || ||fd|i|}||c S dS )aM  
    Helper function for the class LaplaceTransform.

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

    If it is called with `doit=False`, then it will instead return
    `LaplaceTransform` objects.
    Fr  r  r  z      rule: z o---o z      try   z      check z -> Tz#_laplace_apply_rules did not match.Nr   )r2  r  r  r^   xreplacer  r   r   	Exceptionr   r@   r  r  r  r  r  )r   r   r   r   r   r_  r   simple_rulest_doms_domcheckplaneprepmar   
prog_rulesp_ruler;  s                     rj   r  r    s    q//GAt'1--L,8 = =(ueUDT$ZZe$$ 	=/000EDD*+++EUUUEE:;;;=/000NN2&&eeeQQ7888d7 E&q););'; %r 2 2AFE E>CE E E E EE  = = =;<<<<<=	= 	uuZ t)+B#%79KMJ  VAq!00$0%00 	III	4s   BDD10D1c                   .    e Zd ZdZdZd Zd Zd Zd ZdS )r  z
    Class representing unevaluated Laplace transforms.

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

    For how to compute Laplace transforms, see the :func:`laplace_transform`
    docstring.
    r  c                     t          |||fi |}|K|                    dd          }t          d|           t          d|           t          |||fd|i|S |S )Nr   Tz._laplace_apply_rules could not match function z    hints: )r  r   r^   r  )rf   r   r   r   r   r;  r   s          rj   r   z#LaplaceTransform._compute_transform  s    !!Q33U33 			*d33IEaaIJJJE55*+++%aAKK	KUKKKIrk   c                 x    t          |t          | |z            z  |t          j        t          j        f          S r   )rJ   r)   r   r   r   )rf   r   r   r   s       rj   r   zLaplaceTransform._as_integral  s-    #qbd))a%<===rk   c                     g }g }|D ]/\  }}|                     |           |                     |           0t          | }t          | }|dk    rt          dd d          ||fS )NFr  zNo combined convergence.)r   rP   r2   r`   )rf   r   r   planesr  r   s         rj   r   z LaplaceTransform._collapse_extra  s      	! 	!KE4LLMM%    E{V5= 	=(4!;= = =d{rk   c                     | j         }t          d|           | j        }| j        }d }|j        s3t          |          }	  | j        |||fi |}n# t          $ r d }Y nw xY w||fS )Nz----> _try_directly: )re   r^   rz   r}   r   r   r   r`   )rf   r   r   t_r  r;  s         rj   r   zLaplaceTransform._try_directly  s    ].///#$y 	BB,T,RRAA5AA)   2vs   A A! A!N)	rl   rm   rn   ro   r   r   r   r   r   r   rk   rj   r  r    sa          E  > > >      rk   r  c           	      x   t          d| ddd           t          | t                    rt          | d          rމ                    dd           }|r[|rYt          ddd	
           t          t                    5  |                     fd          cddd           S # 1 swxY w Y   njfd| D             }|r<t          | \  }}}	 t          |           g | j        |R  }
|
t          | t          |	 fS  t          |           g | j        |R  S  t          |           j        di S )ak	  
    Compute the Laplace Transform `F(s)` of `f(t)`,

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

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

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

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

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

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

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

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

    by applying rules.

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

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

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

    Examples
    ========

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

    See Also
    ========

    inverse_laplace_transform, mellin_transform, fourier_transform
    hankel_transform, inverse_hankel_transform

    z
***** laplace_transform(r  r  	applyfuncr   Fz
Calling laplace_transform() on a Matrix with noconds=False (the default) is
deprecated. Either noconds=True or use legacy_matrix=False to get the new
behavior.
                r  z#deprecated-laplace-transform-matrix)deprecated_since_versionactive_deprecations_targetc                 "    t          | fi S r   laplace_transform)fijr   r   r   s    rj   r   z#laplace_transform.<locals>.<lambda>  s    /@a/T/Te/T/T rk   Nc                 .    g | ]}t          |fi S r   r  )r   r  r   r   r   s     rj   r   z%laplace_transform.<locals>.<listcomp>  s.    QQQ/QCCUCCQQQrk   r   )r^   r   rQ   hasattrr  rZ   r\   r[   r  r7  typeshaper2   rP   r  r   )r   r   r   legacy_matrixr   r   elements_transelementsavals
conditions	f_laplaces    `` `      rj   r  r  .  s   D 
E111aaa
;<<<!Z   9WQ%<%< 9IIi/// 	9] 	9%
 */+P    !!899 V V{{#T#T#T#T#T#TUUV V V V V V V V V V V V V V V V V RQQQQQqQQQN 9.1>.B+%#DGG7QW7h777	 #u+sJ/???tAww888888)Aq!$$)22E222s   B**B.1B.c                    ddl m}m t          dd          fd}|                               r|                               } | j        rCt          fd| j        D              }t          |
                    |                    dfS 	 t          | t                     dt          j        fdd	
          \  }}n# t          $ r d}Y nw xY w| ||           }|t          d|d          |j        r<|j        d         \  }}|                    t$                    rt          d|d          nt          j        }|                    t*          |          }|j        r|
                    |          |fS t          d          t          j        ffd	}	|                    t.          |	          }d }
|                    t          |
          }t          |
                    |                    |fS )z6 The backend function for inverse Laplace transforms. r   )meijerint_inversion_get_coeff_expr   Tr   c                  x   t          |           dk    r	t          |  S | d         j        d         j        } |          \  }}| d         j        d         }| d         j        d         }t	          dt          |          z  |z  z
            |z  t	          |z  dt          |          z  z
            |z  z   S )z3 Simplify a piecewise expression from hyperexpand. rm  r|   r   ry   )r   r5   ru   rp  rA   r&   )ru   r%   r   rF  e1e2r,  r   s         rj   pw_simpz+_inverse_laplace_transform.<locals>.pw_simp  s     t99> 	$d##1gl1o&(.a00x!W\!_!W\!_3u::8344R78aE

l233B67 	7rk   c           	      6    g | ]}t          |          S r   )_inverse_laplace_transform)r   Xr  r   r   r   s     rj   r   z._inverse_laplace_transform.<locals>.<listcomp>  s9     & & & -Q1eXFF & & &rk   NF)r   r   Inverse Laplacer   z(inversion integral of unrecognised form.uc                 l    | j         t                               }|                              rt          | |          S ddlm}  ||dk              }|j        k    r't          |j                  }t          |z   |          S t          |j                  }t          |z    |          S )Nr   r   )	r   r)   r   rA   r   r   r   r*   r   )r%   H0r   r   relr_  r   r5  s         rj   simp_heavisidez2_inverse_laplace_transform.<locals>.simp_heaviside  s    CHS!WWa  5588 	&S"%%%@@@@@@Aq))7a< 	+CGAQUB'''CGAq1uXr***rk   c                 :    t          t          |                     S r   )r   r)   )r%   s    rj   simp_expz,_inverse_laplace_transform.<locals>.simp_exp  s    c#hh'''rk   )sympy.integrals.meijerintr+  r,  r   is_rational_functionapartr   r	   ru   r   r   r  r)   r   r   r`   r   r   rJ   r   r   r5   r@  rA   )r  r   r  r  r   r+  r0  r   r   r9  r;  r,  r   r5  s    ` ``      @@@rj   r2  r2    s    NMMMMMMM
 	cA
7 
7 
7 
7 
7 
7 	a   GGAJJx 8 & & & & & & &f& & & '211477*1aaR4:L48%I I I44!    *1a(( 	C():ArBBB> 	fQiGAtuuX Q,->%OQ Q QQ 6DIIi))~ # vva}}d""c

A v + + + + + + + 	
		)^,,A( ( ( 	
		#x  A
 QVVAr]]H--t33s   2C CCc                   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 )
InverseLaplaceTransformz
    Class representing unevaluated inverse Laplace transforms.

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

    For how to compute inverse Laplace transforms, see the
    :func:`inverse_laplace_transform` docstring.
    r4  ry  r   c                 J    |t           j        }t          j        | ||||fi |S r   )r@  r{  rr   r|  )r}  r  r   r   r  r~  s         rj   r|  zInverseLaplaceTransform.__new__  s3     	;+:E (aAuEEEEErk   c                 @    | j         d         }|t          j        u rd }|S Nrm  )ru   r@  r{  )rf   r  s     rj   fundamental_planez)InverseLaplaceTransform.fundamental_plane  s(    	!+:: 	Erk   c                 ,    t          |||| j        fi |S r   )r2  rD  )rf   r  r   r   r   s        rj   r   z*InverseLaplaceTransform._compute_transform  s!    )!Q43ISSUSSSrk   c                    | j         j        }t          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 r  )ri   r  rJ   r)   r   r  r   r  )rf   r  r   r   r   s        rj   r   z$InverseLaplaceTransform._as_integral  sp    NAaC
QAOAJ,F(F%&)C%C%E F FGHvaoG]_ 	_rk   N)rl   rm   rn   ro   r   r   r{  r  r|  r   rD  r   r   r   rk   rj   r@  r@    s          EU6]]N	sBF F F
   XT T T_ _ _ _ _rk   r@  c                     t          | t                    r+t          | d          r|                     fd          S  t	          |           j        di S )a  
    Compute the inverse Laplace transform of `F(s)`, defined as

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

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

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

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

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

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

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

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

    Examples
    ========

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

    See Also
    ========

    laplace_transform, _fast_inverse_laplace
    hankel_transform, inverse_hankel_transform
    r  c                 $    t          | fi S r   )inverse_laplace_transform)Fijr   r  r   r   s    rj   r   z+inverse_laplace_transform.<locals>.<lambda>0  s    '@aE'['[UZ'['[ rk   r   )r   rQ   r!  r  r@  r   )r  r   r   r  r   s    ````rj   rI  rI    s{    V !Z   ]WQ%<%< ]{{[[[[[[[\\\7"1aE227@@%@@@rk   c                    	
 t          dt          g          \  	
fdfdfd	
fdfd |           S )zEFast inverse Laplace transform of rational function including RootSumza, b, nr  c                     |                                s| S | j        r |           S | j        r |           S | j        r |           S t	          | t
                    r |           S t          r   )r   r   is_Mulr8  r   rY   r   )ru  _ilt_add_ilt_mul_ilt_pow_ilt_rootsumr   s    rj   _iltz#_fast_inverse_laplace.<locals>._ilt8  s    uuQxx 	&HX 		&8A;;X 	&8A;;X 	&8A;;7## 	&<??"%%rk   c                 >     | j         t          | j                   S r   )r   mapru   )ru  rR  s    rj   rN  z'_fast_inverse_laplace.<locals>._ilt_addF  s    qvs4(())rk   c                 l    |                                \  }}|j        rt          | |          z  S r   )r2  rM  r   )ru  r   r   rR  r   s      rj   rO  z'_fast_inverse_laplace.<locals>._ilt_mulI  s=    &&q))t; 	&%%ttDzz!!rk   c                 J   |                      z  z   z            }|||         |         |         }}}|j        r>|dk     r8	| dz
  z  t          ||z   	z            z  || z  t          |           z  z  S |dk    rt          ||z   	z            |z  S t          r  )r  r:  r)   rF   r   )
ru  r  nmamrX  r   r   r  r   r   s
        rj   rP  z'_fast_inverse_laplace.<locals>._ilt_powO  s    1q1%% 	,q58U1XBB} Ga GB3q5z#2hqj//12s75"::3EFFQw ,RU8A:++!!rk   c                     | j         j        }| j         j        \  }t          | j        t          |t           |                                        S r   )funr   	variablesrY   polyr   rW   )ru  r   variablerR  s      rj   rQ  z+_fast_inverse_laplace.<locals>._ilt_rootsumY  sC    uzU_
qvvhd0D0DEEFFFrk   )r   r    )ru  r   r   rR  rN  rO  rP  rQ  r   r   r  s    ``@@@@@@@@rj   _fast_inverse_laplacer^  4  s    iTA3777GAq!& & & & & & & & &* * * * *" " " " " "" " " " " " " " "G G G G G
 477Nrk   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   )rI   r)   r   r  r   r   r   rJ   r   r   NaNr`   r   ru   )
r   r   r_  r   r   r   r   r  
integral_fr   s
             rj   _fourier_transformrb  e  s0    	!A#c!AO+A-a/0001a6H!*2UVVA55?? .H%%qv--1q!"4ajABBJa(!*ae<< V
x@X@X V$T1.TUUU> L$T1.JKKKfQiGAtuuX M$T1.KLLLQ!!4''rk   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   ri   rv   s    rj   r   zFourierTypeTransform.a  !    !:T^KM M 	Mrk   c                 0    t          d| j        z            Nz,Class %s must implement b(self) but does notrg  rv   s    rj   r   zFourierTypeTransform.b  rh  rk   c                     t          ||||                                 |                                 | j        j        fi |S r   )rb  r   r   ri   r   rf   r   r   r_  r   s        rj   r   z'FourierTypeTransform._compute_transform  sI    !!Q"&&&((DFFHH"&."6A A:?A A 	Ark   c                     |                                  }|                                 }t          ||z  t          |t          j        z  |z  |z            z  |t          j        t          j        f          S r   )r   r   rJ   r)   r   r  r   r   )rf   r   r   r_  r   r   s         rj   r   z!FourierTypeTransform._as_integral  s\    FFHHFFHH!C!/ 1! 3A 5666A<NPQPZ8[\\\rk   Nrl   rm   rn   ro   r   r   r   r   r   rk   rj   rd  rd    sd        --M M MM M MA A A
] ] ] ] ]rk   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   rv   s    rj   r   zFourierTransform.a      qrk   c                      dt           j        z  S )Nr  r   r  rv   s    rj   r   zFourierTransform.b  s    !$wrk   Nrl   rm   rn   ro   r   r   r   r   rk   rj   rp  rp    sC          E      rk   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   r   r   r_  r   s       rj   fourier_transformry    s+    N *Aq!$$)22E222rk   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   rv   s    rj   r   zInverseFourierTransform.a  rs  rk   c                      dt           j        z  S r  ru  rv   s    rj   r   zInverseFourierTransform.b  s    vrk   Nrv  r   rk   rj   r{  r{    sC          E      rk   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  r_  r   r   s       rj   inverse_fourier_transformr    s+    N 1"1a++0995999rk   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   )rI   r   r   r   r   rJ   r   r   r   r`   ru   )
r   r   r_  r   r   Kr   r   r  r   s
             rj   _sine_cosine_transformr  	  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''rk   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  rv   s    rj   r   zSineCosineTypeTransform.a7	  rh  rk   c                 0    t          d| j        z            rj  rg  rv   s    rj   r   zSineCosineTypeTransform.b;	  rh  rk   c           	          t          ||||                                 |                                 | j        j        | j        j        fi |S r   )r  r   r   ri   _kernr   rl  s        rj   r   z*SineCosineTypeTransform._compute_transform@	  sT    %aA&*ffhh&*n&:&*n&:E E ?DE E 	Erk   c                     |                                  }|                                 }| j        j        }t	          ||z   |||z  |z            z  |t
          j        t
          j        f          S r   )r   r   ri   r  rJ   r   r   r   )rf   r   r   r_  r   r   r  s          rj   r   z$SineCosineTypeTransform._as_integralF	  sY    FFHHFFHHN !AAac!eHHq!&!*&=>>>rk   Nrn  r   rk   rj   r  r  1	  sc         
M M MM M M
E E E? ? ? ? ?rk   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 r  r4   r   rv   s    rj   r   zSineTransform.aZ	      AwwtBxxrk   c                     t           j        S r   r   r3  rv   s    rj   r   zSineTransform.b]	  	    urk   N	rl   rm   rn   ro   r   r9   r  r   r   r   rk   rj   r  r  M	  sH          EE         rk   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   rx  s       rj   sine_transformr  a	  s*    H '=Aq!!&/////rk   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 r  r  rv   s    rj   r   zInverseSineTransform.a	  r  rk   c                     t           j        S r   r  rv   s    rj   r   zInverseSineTransform.b	  r  rk   Nr  r   rk   rj   r  r  	  sH          EE         rk   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       rj   inverse_sine_transformr  	  s+    J .1a((-66666rk   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 r  r  rv   s    rj   r   zCosineTransform.a	  r  rk   c                     t           j        S r   r  rv   s    rj   r   zCosineTransform.b	  r  rk   N	rl   rm   rn   ro   r   r7   r  r   r   r   rk   rj   r  r  	  sH          EE         rk   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   rx  s       rj   cosine_transformr  	  s*    H )?1a##(115111rk   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 r  r  rv   s    rj   r   zInverseCosineTransform.a
  r  rk   c                     t           j        S r   r  rv   s    rj   r   zInverseCosineTransform.b
  r  rk   Nr  r   rk   rj   r  r  	  sH          EE         rk   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       rj   inverse_cosine_transformr  
  s+    H 0!!Q**/88%888rk   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   )rI   r=   r   r   r   r   rJ   r   r   r   r`   ru   )r   r  r_  rr  r   r   r  r   s           rj   _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''rk   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 rC  )r   re   rz   r}   ru   )rf   r   s     rj   r   zHankelTypeTransform.doitY
  sA    &t&t}'+'='+'>'+y|0 0 */	0 0 	0rk   c                 .    t          ||||| j        fi |S r   )r  r   )rf   r   r  r_  rr  r   s         rj   r   z&HankelTypeTransform._compute_transform`
  s"     Aq"djBBEBBBrk   c                 ~    t          |t          |||z            z  |z  |t          j        t          j        f          S r   )rJ   r=   r   r   r   )rf   r   r  r_  rr  s        rj   r   z HankelTypeTransform._as_integralc
  s5    '"ac***1,q!&!*.EFFFrk   c                 f    |                      | j        | j        | j        | j        d                   S rC  )r   re   rz   r}   ru   rv   s    rj   r   zHankelTypeTransform.as_integralf
  s3      !%!7!%!8!%1/ / 	/rk   N)	rl   rm   rn   ro   r   r   r   r   r   r   rk   rj   r  r  T
  sl         0 0 0C C CG G G / / X/ / /rk   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rl   rm   rn   ro   r   r   rk   rj   r  r  n
  s          EEErk   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   )r   r  r_  rr  r   s        rj   hankel_transformr  {
  s,    \ -?1aB'',55u555rk   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   rk   rj   r  r  
  s          EEErk   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  rr  r   s        rj   inverse_hankel_transformr  
  s-    \ 4!!Q2..3<<e<<<rk   )F)Tr   )ro   	functoolsr   r   	itertoolsr   
sympy.corer   r   r   sympy.core.addr	   sympy.core.functionr
   r   r   r   r   r   r   r   r   sympy.core.mulr   sympy.core.numbersr   r   sympy.core.relationalr   r   r   r   r   r   sympy.core.sortingr   r   sympy.core.symbolr   r   r    sympy.core.traversalr!   (sympy.functions.combinatorial.factorialsr"   r#   $sympy.functions.elementary.complexesr$   r%   r&   r'   r(   &sympy.functions.elementary.exponentialr)   r*   r+   %sympy.functions.elementary.hyperbolicr,   r-   r.   r/   r0   #sympy.functions.elementary.integersr1   (sympy.functions.elementary.miscellaneousr2   r3   r4   $sympy.functions.elementary.piecewiser5   r6   (sympy.functions.elementary.trigonometricr7   r8   r9   r:   r;   sympy.functions.special.besselr<   r=   r>   r?   'sympy.functions.special.delta_functionsr@   rA   'sympy.functions.special.error_functionsrB   rC   rD   'sympy.functions.special.gamma_functionsrE   rF   rG   sympy.functions.special.hyperrH   sympy.integralsrI   rJ   r<  rK   sympy.logic.boolalgrL   rM   rN   rO   rP   sympy.matrices.matricesrQ   sympy.polys.matrices.linsolverR   rS   sympy.polys.polyrootsrT   sympy.polys.polytoolsrU   rV   sympy.polys.rationaltoolsrW   sympy.polys.rootoftoolsrX   rY   sympy.utilities.exceptionsrZ   r[   r\   sympy.utilities.iterablesr]   sympy.utilities.miscr^   r   r`   rr   r   r   _nocondsr   r  r  r  r  ro  r  r`  rd  r  rx  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r2  r@  rI  r^  rb  rd  rp  ry  r{  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   rk   rj   <module>r     s
     # # # # # # # #                      / / / / / / / / / / / / / / / / / / / / / /       ) ) ) ) ) ) ) ) H H H H H H H H H H H H H H H H 8 8 8 8 8 8 8 8 2 2 2 2 2 2 2 2 2 2 4 4 4 4 4 4 B B B B B B B BE E E E E E E E E E E E E E F F F F F F F F F F O O O O O O O O O O O O O O 7 7 7 7 7 7 C C C C C C C C C C J J J J J J J J M M M M M M M M M M M M M M M M M M M M M M M M M M I I I I I I I I A A A A A A A A A A N N N N N N N N N N 1 1 1 1 1 1 / / / / / / / / , , , , , , E E E E E E E E E E E E E E . . . . . . J J J J J J J J ' ' ' ' ' ' . . . . . . . . . . . . . . 4 4 4 4 4 4 4 49 9 9 9 9 9 9 9 9 9 / . . . . . & & & & & &! ! ! ! !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V V Vp6 6 6 
}L }L }L 
}L~  $s# s# s#j	 	 	% % % %N   8   43 3 3 3j   :' ' ' 'R2 2 2 2 2( 2 2 2j_3 _3 _3 _3D 4M4 M4 M4 M4` _  _  _  _  _/  _  _  _F-A -A -A -A`* * *b 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 
 
 
.= .= .= .= .=rk   