def test_functional_diffgeom_ch3():
    x0, y0 = symbols('x0, y0', real=True)
    x, y, t = symbols('x, y, t', real=True)
    f = Function('f')
    b1 = Function('b1')
    b2 = Function('b2')
    p_r = R2_r.point([x0, y0])

    s_field = f(R2.x, R2.y)
    v_field = b1(R2.x)*R2.e_x + b2(R2.y)*R2.e_y
    assert v_field.rcall(s_field).rcall(p_r).doit() == b1(
        x0)*Derivative(f(x0, y0), x0) + b2(y0)*Derivative(f(x0, y0), y0)

    assert R2.e_x(R2.r**2).rcall(p_r) == 2*x0
    v = R2.e_x + 2*R2.e_y
    s = R2.r**2 + 3*R2.x
    assert v.rcall(s).rcall(p_r).doit() == 2*x0 + 4*y0 + 3

    circ = -R2.y*R2.e_x + R2.x*R2.e_y
    series = intcurve_series(circ, t, R2_r.point([1, 0]), coeffs=True)
    series_x, series_y = zip(*series)
    assert all(
        [term == cos(t).taylor_term(i, t) for i, term in enumerate(series_x)])
    assert all(
        [term == sin(t).taylor_term(i, t) for i, term in enumerate(series_y)])
Ejemplo n.º 2
0
def test_Derivative():
    assert mcode(Derivative(sin(x), x)) == "Hold[D[Sin[x], x]]"
    assert mcode(Derivative(x, x)) == "Hold[D[x, x]]"
    assert mcode(Derivative(sin(x) * y**4, x,
                            2)) == "Hold[D[y^4*Sin[x], {x, 2}]]"
    assert mcode(Derivative(sin(x) * y**4, x, y,
                            x)) == "Hold[D[y^4*Sin[x], x, y, x]]"
    assert mcode(Derivative(sin(x) * y**4, x, y, 3,
                            x)) == "Hold[D[y^4*Sin[x], x, {y, 3}, x]]"
Ejemplo n.º 3
0
 def _eval_derivative(self, x):
     if self.args[0].is_real:
         return Derivative(self.args[0], x, **{'evaluate': True}) * sign(
             self.args[0])
     return (re(self.args[0]) *
             re(Derivative(self.args[0], x, **{'evaluate': True})) +
             im(self.args[0]) *
             im(Derivative(self.args[0], x, **{'evaluate': True}))) / Abs(
                 self.args[0])
Ejemplo n.º 4
0
    def make_expression(terms):
        product = []

        for term, rat, sym, deriv in terms:
            if deriv is not None:
                var, order = deriv

                while order > 0:
                    term, order = Derivative(term, var), order - 1

            if sym is None:
                if rat is S.One:
                    product.append(term)
                else:
                    product.append(Pow(term, rat))
            else:
                product.append(Pow(term, rat*sym))

        return Mul(*product)
Ejemplo n.º 5
0
    def _eval_derivative(self, x):
        """
        Differentiate wrt x as long as x is not in the free symbols of any of
        the upper or lower limits.

        Sum(a*b*x, (x, 1, a)) can be differentiated wrt x or b but not `a`
        since the value of the sum is discontinuous in `a`. In a case
        involving a limit variable, the unevaluated derivative is returned.

        """

        # diff already confirmed that x is in the free symbols of self, but we
        # don't want to differentiate wrt any free symbol in the upper or lower
        # limits
        # XXX remove this test for free_symbols when the default _eval_derivative is in
        if x not in self.free_symbols:
            return S.Zero

        # get limits and the function
        f, limits = self.function, list(self.limits)

        limit = limits.pop(-1)

        if limits:  # f is the argument to a Sum
            f = Sum(f, *limits)

        if len(limit) == 3:
            _, a, b = limit
            if x in a.free_symbols or x in b.free_symbols:
                return None
            df = Derivative(f, x, **{'evaluate': True})
            rv = Sum(df, limit)
            if limit[0] not in df.free_symbols:
                rv = rv.doit()
            return rv
        else:
            return NotImplementedError('Lower and upper bound expected.')
def test_functional_diffgeom_ch4():
    x0, y0, theta0 = symbols('x0, y0, theta0', real=True)
    x, y, r, theta = symbols('x, y, r, theta', real=True)
    r0 = symbols('r0', positive=True)
    f = Function('f')
    b1 = Function('b1')
    b2 = Function('b2')
    p_r = R2_r.point([x0, y0])
    p_p = R2_p.point([r0, theta0])

    f_field = b1(R2.x, R2.y)*R2.dx + b2(R2.x, R2.y)*R2.dy
    assert f_field.rcall(R2.e_x).rcall(p_r) == b1(x0, y0)
    assert f_field.rcall(R2.e_y).rcall(p_r) == b2(x0, y0)

    s_field_r = f(R2.x, R2.y)
    df = Differential(s_field_r)
    assert df(R2.e_x).rcall(p_r).doit() == Derivative(f(x0, y0), x0)
    assert df(R2.e_y).rcall(p_r).doit() == Derivative(f(x0, y0), y0)

    s_field_p = f(R2.r, R2.theta)
    df = Differential(s_field_p)
    assert trigsimp(df(R2.e_x).rcall(p_p).doit()) == (
        cos(theta0)*Derivative(f(r0, theta0), r0) -
        sin(theta0)*Derivative(f(r0, theta0), theta0)/r0)
    assert trigsimp(df(R2.e_y).rcall(p_p).doit()) == (
        sin(theta0)*Derivative(f(r0, theta0), r0) +
        cos(theta0)*Derivative(f(r0, theta0), theta0)/r0)

    assert R2.dx(R2.e_x).rcall(p_r) == 1
    assert R2.dx(R2.e_x) == 1
    assert R2.dx(R2.e_y).rcall(p_r) == 0
    assert R2.dx(R2.e_y) == 0

    circ = -R2.y*R2.e_x + R2.x*R2.e_y
    assert R2.dx(circ).rcall(p_r).doit() == -y0
    assert R2.dy(circ).rcall(p_r) == x0
    assert R2.dr(circ).rcall(p_r) == 0
    assert simplify(R2.dtheta(circ).rcall(p_r)) == 1

    assert (circ - R2.e_theta).rcall(s_field_r).rcall(p_r) == 0
Ejemplo n.º 7
0
 def _eval_derivative(self, x):
     if not self.has(x):
         return S.Zero
     return re(Derivative(self.args[0], x, **{'evaluate': True}))
Ejemplo n.º 8
0
 def _eval_derivative(self, t):
     x, y = re(self.args[0]), im(self.args[0])
     if not self.has(t):
         return S.Zero
     return (x * Derivative(y, t, **{'evaluate': True}) -
             y * Derivative(x, t, **{'evaluate': True})) / (x**2 + y**2)
Ejemplo n.º 9
0
 def _eval_derivative(self, x):
     return re(Derivative(self.args[0], x, **{'evaluate': True}))
Ejemplo n.º 10
0
 def _eval_derivative(self, t):
     x, y = re(self.args[0]), im(self.args[0])
     return (x * Derivative(y, t, **{'evaluate': True}) -
             y * Derivative(x, t, **{'evaluate': True})) / (x**2 + y**2)
Ejemplo n.º 11
0
def test_laplace_transform():
    from sympy import lowergamma
    from sympy.functions.special.delta_functions import DiracDelta
    from sympy.functions.special.error_functions import (fresnelc, fresnels)
    LT = laplace_transform
    a, b, c, = symbols('a, b, c', positive=True)
    t, w, x = symbols('t, w, x')
    f = Function("f")
    g = Function("g")

    # Test rule-base evaluation according to
    # http://eqworld.ipmnet.ru/en/auxiliary/inttrans/
    # Power-law functions (laplace2.pdf)
    assert LT(a*t+t**2+t**(S(5)/2), t, s) ==\
        (a/s**2 + 2/s**3 + 15*sqrt(pi)/(8*s**(S(7)/2)), 0, True)
    assert LT(b/(t+a), t, s) == (-b*exp(-a*s)*Ei(-a*s), 0, True)
    assert LT(1/sqrt(t+a), t, s) ==\
        (sqrt(pi)*sqrt(1/s)*exp(a*s)*erfc(sqrt(a)*sqrt(s)), 0, True)
    assert LT(sqrt(t)/(t+a), t, s) ==\
        (-pi*sqrt(a)*exp(a*s)*erfc(sqrt(a)*sqrt(s)) + sqrt(pi)*sqrt(1/s),
         0, True)
    assert LT((t+a)**(-S(3)/2), t, s) ==\
        (-2*sqrt(pi)*sqrt(s)*exp(a*s)*erfc(sqrt(a)*sqrt(s)) + 2/sqrt(a),
         0, True)
    assert LT(t**(S(1)/2)*(t+a)**(-1), t, s) ==\
        (-pi*sqrt(a)*exp(a*s)*erfc(sqrt(a)*sqrt(s)) + sqrt(pi)*sqrt(1/s),
         0, True)
    assert LT(1/(a*sqrt(t) + t**(3/2)), t, s) ==\
        (pi*sqrt(a)*exp(a*s)*erfc(sqrt(a)*sqrt(s)), 0, True)
    assert LT((t+a)**b, t, s) ==\
        (s**(-b - 1)*exp(-a*s)*lowergamma(b + 1, a*s), 0, True)
    assert LT(t**5/(t+a), t, s) == (120*a**5*lowergamma(-5, a*s), 0, True)
    # Exponential functions (laplace3.pdf)
    assert LT(exp(t), t, s) == (1/(s - 1), 1, True)
    assert LT(exp(2*t), t, s) == (1/(s - 2), 2, True)
    assert LT(exp(a*t), t, s) == (1/(s - a), a, True)
    assert LT(exp(a*(t-b)), t, s) == (exp(-a*b)/(-a + s), a, True)
    assert LT(t*exp(-a*(t)), t, s) == ((a + s)**(-2), -a, True)
    assert LT(t*exp(-a*(t-b)), t, s) == (exp(a*b)/(a + s)**2, -a, True)
    assert LT(b*t*exp(-a*t), t, s) == (b/(a + s)**2, -a, True)
    assert LT(t**(S(7)/4)*exp(-8*t)/gamma(S(11)/4), t, s) ==\
        ((s + 8)**(-S(11)/4), -8, True)
    assert LT(t**(S(3)/2)*exp(-8*t), t, s) ==\
        (3*sqrt(pi)/(4*(s + 8)**(S(5)/2)), -8, True)
    assert LT(t**a*exp(-a*t), t, s) ==  ((a+s)**(-a-1)*gamma(a+1), -a, True)
    assert LT(b*exp(-a*t**2), t, s) ==\
        (sqrt(pi)*b*exp(s**2/(4*a))*erfc(s/(2*sqrt(a)))/(2*sqrt(a)), 0, True)
    assert LT(exp(-2*t**2), t, s) ==\
        (sqrt(2)*sqrt(pi)*exp(s**2/8)*erfc(sqrt(2)*s/4)/4, 0, True)
    assert LT(b*exp(2*t**2), t, s) == b*LaplaceTransform(exp(2*t**2), t, s)
    assert LT(t*exp(-a*t**2), t, s) ==\
        (1/(2*a) - s*erfc(s/(2*sqrt(a)))/(4*sqrt(pi)*a**(S(3)/2)), 0, True)
    assert LT(exp(-a/t), t, s) ==\
        (2*sqrt(a)*sqrt(1/s)*besselk(1, 2*sqrt(a)*sqrt(s)), 0, True)
    assert LT(sqrt(t)*exp(-a/t), t, s) ==\
        (sqrt(pi)*(2*sqrt(a)*sqrt(s) + 1)*sqrt(s**(-3))*exp(-2*sqrt(a)*\
                                                    sqrt(s))/2, 0, True)
    assert LT(exp(-a/t)/sqrt(t), t, s) ==\
        (sqrt(pi)*sqrt(1/s)*exp(-2*sqrt(a)*sqrt(s)), 0, True)
    assert LT( exp(-a/t)/(t*sqrt(t)), t, s) ==\
        (sqrt(pi)*sqrt(1/a)*exp(-2*sqrt(a)*sqrt(s)), 0, True)
    assert LT(exp(-2*sqrt(a*t)), t, s) ==\
        ( 1/s -sqrt(pi)*sqrt(a) * exp(a/s)*erfc(sqrt(a)*sqrt(1/s))/\
         s**(S(3)/2), 0, True)
    assert LT(exp(-2*sqrt(a*t))/sqrt(t), t, s) == (exp(a/s)*erfc(sqrt(a)*\
        sqrt(1/s))*(sqrt(pi)*sqrt(1/s)), 0, True)
    assert LT(t**4*exp(-2/t), t, s) ==\
        (8*sqrt(2)*(1/s)**(S(5)/2)*besselk(5, 2*sqrt(2)*sqrt(s)), 0, True)
    # Hyperbolic functions (laplace4.pdf)
    assert LT(sinh(a*t), t, s) == (a/(-a**2 + s**2), a, True)
    assert LT(b*sinh(a*t)**2, t, s) == (2*a**2*b/(-4*a**2*s**2 + s**3),
                                        2*a, True)
    # The following line confirms that issue #21202 is solved
    assert LT(cosh(2*t), t, s) == (s/(-4 + s**2), 2, True)
    assert LT(cosh(a*t), t, s) == (s/(-a**2 + s**2), a, True)
    assert LT(cosh(a*t)**2, t, s) == ((-2*a**2 + s**2)/(-4*a**2*s**2 + s**3),
                                      2*a, True)
    assert LT(sinh(x + 3), x, s) == (
        (-s + (s + 1)*exp(6) + 1)*exp(-3)/(s - 1)/(s + 1)/2, 0, Abs(s) > 1)
    # The following line replaces the old test test_issue_7173()
    assert LT(sinh(a*t)*cosh(a*t), t, s) == (a/(-4*a**2 + s**2), 2*a, True)
    assert LT(sinh(a*t)/t, t, s) == (log((a + s)/(-a + s))/2, a, True)
    assert LT(t**(-S(3)/2)*sinh(a*t), t, s) ==\
        (-sqrt(pi)*(sqrt(-a + s) - sqrt(a + s)), a, True)
    assert LT(sinh(2*sqrt(a*t)), t, s) ==\
        (sqrt(pi)*sqrt(a)*exp(a/s)/s**(S(3)/2), 0, True)
    assert LT(sqrt(t)*sinh(2*sqrt(a*t)), t, s) ==\
        (-sqrt(a)/s**2 + sqrt(pi)*(a + s/2)*exp(a/s)*erf(sqrt(a)*\
                                            sqrt(1/s))/s**(S(5)/2), 0, True)
    assert LT(sinh(2*sqrt(a*t))/sqrt(t), t, s) ==\
        (sqrt(pi)*exp(a/s)*erf(sqrt(a)*sqrt(1/s))/sqrt(s), 0, True)
    assert LT(sinh(sqrt(a*t))**2/sqrt(t), t, s) ==\
        (sqrt(pi)*(exp(a/s) - 1)/(2*sqrt(s)), 0, True)
    assert LT(t**(S(3)/7)*cosh(a*t), t, s) ==\
        (((a + s)**(-S(10)/7) + (-a+s)**(-S(10)/7))*gamma(S(10)/7)/2, a, True)
    assert LT(cosh(2*sqrt(a*t)), t, s) ==\
        (sqrt(pi)*sqrt(a)*exp(a/s)*erf(sqrt(a)*sqrt(1/s))/s**(S(3)/2) + 1/s,
         0, True)
    assert LT(sqrt(t)*cosh(2*sqrt(a*t)), t, s) ==\
        (sqrt(pi)*(a + s/2)*exp(a/s)/s**(S(5)/2), 0, True)
    assert LT(cosh(2*sqrt(a*t))/sqrt(t), t, s) ==\
        (sqrt(pi)*exp(a/s)/sqrt(s), 0, True)
    assert LT(cosh(sqrt(a*t))**2/sqrt(t), t, s) ==\
        (sqrt(pi)*(exp(a/s) + 1)/(2*sqrt(s)), 0, True)
    # logarithmic functions (laplace5.pdf)
    assert LT(log(t), t, s) == (-log(s+S.EulerGamma)/s, 0, True)
    assert LT(log(t/a), t, s) == (-log(a*s + S.EulerGamma)/s, 0, True)
    assert LT(log(1+a*t), t, s) == (-exp(s/a)*Ei(-s/a)/s, 0, True)
    assert LT(log(t+a), t, s) == ((log(a) - exp(s/a)*Ei(-s/a)/s)/s, 0, True)
    assert LT(log(t)/sqrt(t), t, s) ==\
        (sqrt(pi)*(-log(s) - 2*log(2) - S.EulerGamma)/sqrt(s), 0, True)
    assert LT(t**(S(5)/2)*log(t), t, s) ==\
        (15*sqrt(pi)*(-log(s)-2*log(2)-S.EulerGamma+S(46)/15)/(8*s**(S(7)/2)),
         0, True)
    assert (LT(t**3*log(t), t, s, noconds=True)-6*(-log(s) - S.EulerGamma\
                                    + S(11)/6)/s**4).simplify() == S.Zero
    assert LT(log(t)**2, t, s) ==\
        (((log(s) + EulerGamma)**2 + pi**2/6)/s, 0, True)
    assert LT(exp(-a*t)*log(t), t, s) ==\
        ((-log(a + s) - S.EulerGamma)/(a + s), -a, True)
    # Trigonometric functions (laplace6.pdf)
    assert LT(sin(a*t), t, s) == (a/(a**2 + s**2), 0, True)
    assert LT(Abs(sin(a*t)), t, s) ==\
        (a*coth(pi*s/(2*a))/(a**2 + s**2), 0, True)
    assert LT(sin(a*t)/t, t, s) == (atan(a/s), 0, True)
    assert LT(sin(a*t)**2/t, t, s) == (log(4*a**2/s**2 + 1)/4, 0, True)
    assert LT(sin(a*t)**2/t**2, t, s) ==\
        (a*atan(2*a/s) - s*log(4*a**2/s**2 + 1)/4, 0, True)
    assert LT(sin(2*sqrt(a*t)), t, s) ==\
        (sqrt(pi)*sqrt(a)*exp(-a/s)/s**(S(3)/2), 0, True)
    assert LT(sin(2*sqrt(a*t))/t, t, s) == (pi*erf(sqrt(a)*sqrt(1/s)), 0, True)
    assert LT(cos(a*t), t, s) == (s/(a**2 + s**2), 0, True)
    assert LT(cos(a*t)**2, t, s) ==\
        ((2*a**2 + s**2)/(s*(4*a**2 + s**2)), 0, True)
    assert LT(sqrt(t)*cos(2*sqrt(a*t)), t, s) ==\
        (sqrt(pi)*(-2*a + s)*exp(-a/s)/(2*s**(S(5)/2)), 0, True)
    assert LT(cos(2*sqrt(a*t))/sqrt(t), t, s) ==\
        (sqrt(pi)*sqrt(1/s)*exp(-a/s), 0, True)
    assert LT(sin(a*t)*sin(b*t), t, s) ==\
        (2*a*b*s/((s**2 + (a - b)**2)*(s**2 + (a + b)**2)), 0, True)
    assert LT(cos(a*t)*sin(b*t), t, s) ==\
        (b*(-a**2 + b**2 + s**2)/((s**2 + (a - b)**2)*(s**2 + (a + b)**2)),
         0, True)
    assert LT(cos(a*t)*cos(b*t), t, s) ==\
        (s*(a**2 + b**2 + s**2)/((s**2 + (a - b)**2)*(s**2 + (a + b)**2)),
         0, True)
    assert LT(c*exp(-b*t)*sin(a*t), t, s) == (a*c/(a**2 + (b + s)**2),
                                              -b, True)
    assert LT(c*exp(-b*t)*cos(a*t), t, s) == ((b + s)*c/(a**2 + (b + s)**2),
                                              -b, True)
    assert LT(cos(x + 3), x, s) == ((s*cos(3) - sin(3))/(s**2 + 1), 0, True)
    # Error functions (laplace7.pdf)
    assert LT(erf(a*t), t, s) == (exp(s**2/(4*a**2))*erfc(s/(2*a))/s, 0, True)
    assert LT(erf(sqrt(a*t)), t, s) == (sqrt(a)/(s*sqrt(a + s)), 0, True)
    assert LT(exp(a*t)*erf(sqrt(a*t)), t, s) ==\
        (sqrt(a)/(sqrt(s)*(-a + s)), a, True)
    assert LT(erf(sqrt(a/t)/2), t, s) == ((1-exp(-sqrt(a)*sqrt(s)))/s, 0, True)
    assert LT(erfc(sqrt(a*t)), t, s) ==\
        ((-sqrt(a) + sqrt(a + s))/(s*sqrt(a + s)), 0, True)
    assert LT(exp(a*t)*erfc(sqrt(a*t)), t, s) ==\
        (1/(sqrt(a)*sqrt(s) + s), 0, True)
    assert LT(erfc(sqrt(a/t)/2), t, s) == (exp(-sqrt(a)*sqrt(s))/s, 0, True)
    # Bessel functions (laplace8.pdf)
    assert LT(besselj(0, a*t), t, s) == (1/sqrt(a**2 + s**2), 0, True)
    assert LT(besselj(1, a*t), t, s) ==\
        (a/(sqrt(a**2 + s**2)*(s + sqrt(a**2 + s**2))), 0, True)
    assert LT(besselj(2, a*t), t, s) ==\
        (a**2/(sqrt(a**2 + s**2)*(s + sqrt(a**2 + s**2))**2), 0, True)
    assert LT(t*besselj(0, a*t), t, s) ==\
        (s/(a**2 + s**2)**(S(3)/2), 0, True)
    assert LT(t*besselj(1, a*t), t, s) ==\
        (a/(a**2 + s**2)**(S(3)/2), 0, True)
    assert LT(t**2*besselj(2, a*t), t, s) ==\
        (3*a**2/(a**2 + s**2)**(S(5)/2), 0, True)
    assert LT(besselj(0, 2*sqrt(a*t)), t, s) == (exp(-a/s)/s, 0, True)
    assert LT(t**(S(3)/2)*besselj(3, 2*sqrt(a*t)), t, s) ==\
        (a**(S(3)/2)*exp(-a/s)/s**4, 0, True)
    assert LT(besselj(0, a*sqrt(t**2+b*t)), t, s) ==\
        (exp(b*s - b*sqrt(a**2 + s**2))/sqrt(a**2 + s**2), 0, True)
    assert LT(besseli(0, a*t), t, s) == (1/sqrt(-a**2 + s**2), a, True)
    assert LT(besseli(1, a*t), t, s) ==\
        (a/(sqrt(-a**2 + s**2)*(s + sqrt(-a**2 + s**2))), a, True)
    assert LT(besseli(2, a*t), t, s) ==\
        (a**2/(sqrt(-a**2 + s**2)*(s + sqrt(-a**2 + s**2))**2), a, True)
    assert LT(t*besseli(0, a*t), t, s) == (s/(-a**2 + s**2)**(S(3)/2), a, True)
    assert LT(t*besseli(1, a*t), t, s) == (a/(-a**2 + s**2)**(S(3)/2), a, True)
    assert LT(t**2*besseli(2, a*t), t, s) ==\
        (3*a**2/(-a**2 + s**2)**(S(5)/2), a, True)
    assert LT(t**(S(3)/2)*besseli(3, 2*sqrt(a*t)), t, s) ==\
        (a**(S(3)/2)*exp(a/s)/s**4, 0, True)
    assert LT(bessely(0, a*t), t, s) ==\
        (-2*asinh(s/a)/(pi*sqrt(a**2 + s**2)), 0, True)
    assert LT(besselk(0, a*t), t, s) ==\
        (log(s + sqrt(-a**2 + s**2))/sqrt(-a**2 + s**2), a, True)
    assert LT(sin(a*t)**8, t, s) ==\
        (40320*a**8/(s*(147456*a**8 + 52480*a**6*s**2 + 4368*a**4*s**4 +\
                        120*a**2*s**6 + s**8)), 0, True)

    # Test general rules and unevaluated forms
    # These all also test whether issue #7219 is solved.
    assert LT(Heaviside(t-1)*cos(t-1), t, s) == (s*exp(-s)/(s**2 + 1), 0, True)
    assert LT(a*f(t), t, w) == a*LaplaceTransform(f(t), t, w)
    assert LT(a*Heaviside(t+1)*f(t+1), t, s) ==\
        a*LaplaceTransform(f(t + 1)*Heaviside(t + 1), t, s)
    assert LT(a*Heaviside(t-1)*f(t-1), t, s) ==\
        a*LaplaceTransform(f(t), t, s)*exp(-s)
    assert LT(b*f(t/a), t, s) == a*b*LaplaceTransform(f(t), t, a*s)
    assert LT(exp(-f(x)*t), t, s) == (1/(s + f(x)), -f(x), True)
    assert LT(exp(-a*t)*f(t), t, s) == LaplaceTransform(f(t), t, a + s)
    assert LT(exp(-a*t)*erfc(sqrt(b/t)/2), t, s) ==\
        (exp(-sqrt(b)*sqrt(a + s))/(a + s), -a, True)
    assert LT(sinh(a*t)*f(t), t, s) ==\
        LaplaceTransform(f(t), t, -a+s)/2 - LaplaceTransform(f(t), t, a+s)/2
    assert LT(sinh(a*t)*t, t, s) ==\
        (-1/(2*(a + s)**2) + 1/(2*(-a + s)**2), a, True)
    assert LT(cosh(a*t)*f(t), t, s) ==\
        LaplaceTransform(f(t), t, -a+s)/2 + LaplaceTransform(f(t), t, a+s)/2
    assert LT(cosh(a*t)*t, t, s) ==\
        (1/(2*(a + s)**2) + 1/(2*(-a + s)**2), a, True)
    assert LT(sin(a*t)*f(t), t, s) ==\
        I*(-LaplaceTransform(f(t), t, -I*a + s) +\
           LaplaceTransform(f(t), t, I*a + s))/2
    assert LT(sin(a*t)*t, t, s) ==\
        (2*a*s/(a**4 + 2*a**2*s**2 + s**4), 0, True)
    assert LT(cos(a*t)*f(t), t, s) ==\
        LaplaceTransform(f(t), t, -I*a + s)/2 +\
        LaplaceTransform(f(t), t, I*a + s)/2
    assert LT(cos(a*t)*t, t, s) ==\
        ((-a**2 + s**2)/(a**4 + 2*a**2*s**2 + s**4), 0, True)
    # The following two lines test whether issues #5813 and #7176 are solved.
    assert LT(diff(f(t), (t, 1)), t, s) == s*LaplaceTransform(f(t), t, s)\
        - f(0)
    assert LT(diff(f(t), (t, 3)), t, s) == s**3*LaplaceTransform(f(t), t, s)\
        - s**2*f(0) - s*Subs(Derivative(f(t), t), t, 0)\
            - Subs(Derivative(f(t), (t, 2)), t, 0)
    assert LT(a*f(b*t)+g(c*t), t, s) == a*LaplaceTransform(f(t), t, s/b)/b +\
        LaplaceTransform(g(t), t, s/c)/c
    assert inverse_laplace_transform(
        f(w), w, t, plane=0) == InverseLaplaceTransform(f(w), w, t, 0)
    assert LT(f(t)*g(t), t, s) == LaplaceTransform(f(t)*g(t), t, s)

    # additional basic tests from wikipedia
    assert LT((t - a)**b*exp(-c*(t - a))*Heaviside(t - a), t, s) == \
        ((s + c)**(-b - 1)*exp(-a*s)*gamma(b + 1), -c, True)
    assert LT((exp(2*t) - 1)*exp(-b - t)*Heaviside(t)/2, t, s, noconds=True) \
        == exp(-b)/(s**2 - 1)

    # DiracDelta function: standard cases
    assert LT(DiracDelta(t), t, s) == (1, 0, True)
    assert LT(DiracDelta(a*t), t, s) == (1/a, 0, True)
    assert LT(DiracDelta(t/42), t, s) == (42, 0, True)
    assert LT(DiracDelta(t+42), t, s) == (0, 0, True)
    assert LT(DiracDelta(t)+DiracDelta(t-42), t, s) == \
        (1 + exp(-42*s), 0, True)
    assert LT(DiracDelta(t)-a*exp(-a*t), t, s) == (s/(a + s), 0, True)
    assert LT(exp(-t)*(DiracDelta(t)+DiracDelta(t-42)), t, s) == \
        (exp(-42*s - 42) + 1, -oo, True)

    # Collection of cases that cannot be fully evaluated and/or would catch
    # some common implementation errors
    assert LT(DiracDelta(t**2), t, s) == LaplaceTransform(DiracDelta(t**2), t, s)
    assert LT(DiracDelta(t**2 - 1), t, s) == (exp(-s)/2, -oo, True)
    assert LT(DiracDelta(t*(1 - t)), t, s) == \
        LaplaceTransform(DiracDelta(-t**2 + t), t, s)
    assert LT((DiracDelta(t) + 1)*(DiracDelta(t - 1) + 1), t, s) == \
        (LaplaceTransform(DiracDelta(t)*DiracDelta(t - 1), t, s) + \
         1 + exp(-s) + 1/s, 0, True)
    assert LT(DiracDelta(2*t-2*exp(a)), t, s) == (exp(-s*exp(a))/2, 0, True)
    assert LT(DiracDelta(-2*t+2*exp(a)), t, s) == (exp(-s*exp(a))/2, 0, True)

    # Heaviside tests
    assert LT(Heaviside(t), t, s) == (1/s, 0, True)
    assert LT(Heaviside(t - a), t, s) == (exp(-a*s)/s, 0, True)
    assert LT(Heaviside(t-1), t, s) == (exp(-s)/s, 0, True)
    assert LT(Heaviside(2*t-4), t, s) == (exp(-2*s)/s, 0, True)
    assert LT(Heaviside(-2*t+4), t, s) == ((1 - exp(-2*s))/s, 0, True)
    assert LT(Heaviside(2*t+4), t, s) == (1/s, 0, True)
    assert LT(Heaviside(-2*t+4), t, s) == ((1 - exp(-2*s))/s, 0, True)

    # Fresnel functions
    assert laplace_transform(fresnels(t), t, s) == \
        ((-sin(s**2/(2*pi))*fresnels(s/pi) + sin(s**2/(2*pi))/2 -
            cos(s**2/(2*pi))*fresnelc(s/pi) + cos(s**2/(2*pi))/2)/s, 0, True)
    assert laplace_transform(fresnelc(t), t, s) == (
        ((2*sin(s**2/(2*pi))*fresnelc(s/pi) - 2*cos(s**2/(2*pi))*fresnels(s/pi)
        + sqrt(2)*cos(s**2/(2*pi) + pi/4))/(2*s), 0, True))

    # Matrix tests
    Mt = Matrix([[exp(t), t*exp(-t)], [t*exp(-t), exp(t)]])
    Ms = Matrix([[    1/(s - 1), (s + 1)**(-2)],
                 [(s + 1)**(-2),     1/(s - 1)]])

    # The default behaviour for Laplace tranform of a Matrix returns a Matrix
    # of Tuples and is deprecated:
    with warns_deprecated_sympy():
        Ms_conds = Matrix([[(1/(s - 1), 1, True), ((s + 1)**(-2),
            -1, True)], [((s + 1)**(-2), -1, True), (1/(s - 1), 1, True)]])
    with warns_deprecated_sympy():
        assert LT(Mt, t, s) == Ms_conds
    # The new behavior is to return a tuple of a Matrix and the convergence
    # conditions for the matrix as a whole:
    assert LT(Mt, t, s, legacy_matrix=False) == (Ms, 1, True)
    # With noconds=True the transformed matrix is returned without conditions
    # either way:
    assert LT(Mt, t, s, noconds=True) == Ms
    assert LT(Mt, t, s, legacy_matrix=False, noconds=True) == Ms