예제 #1
0
def test_sine_transform():
    from sympy import EulerGamma

    t = symbols("t")
    w = symbols("w")
    a = symbols("a")
    f = Function("f")

    # Test unevaluated form
    assert sine_transform(f(t), t, w) == SineTransform(f(t), t, w)
    assert inverse_sine_transform(f(w), w, t) == InverseSineTransform(f(w), w, t)

    assert sine_transform(1 / sqrt(t), t, w) == 1 / sqrt(w)
    assert inverse_sine_transform(1 / sqrt(w), w, t) == 1 / sqrt(t)

    assert sine_transform((1 / sqrt(t)) ** 3, t, w) == sqrt(w) * gamma(S(1) / 4) / (2 * gamma(S(5) / 4))

    assert sine_transform(t ** (-a), t, w) == 2 ** (-a + S(1) / 2) * w ** (a - 1) * gamma(-a / 2 + 1) / gamma(
        (a + 1) / 2
    )
    assert inverse_sine_transform(
        2 ** (-a + S(1) / 2) * w ** (a - 1) * gamma(-a / 2 + 1) / gamma(a / 2 + S(1) / 2), w, t
    ) == t ** (-a)

    assert sine_transform(exp(-a * t), t, w) == sqrt(2) * w / (sqrt(pi) * (a ** 2 + w ** 2))
    assert inverse_sine_transform(sqrt(2) * w / (sqrt(pi) * (a ** 2 + w ** 2)), w, t) == exp(-a * t)

    assert sine_transform(log(t) / t, t, w) == -sqrt(2) * sqrt(pi) * (log(w ** 2) + 2 * EulerGamma) / 4

    assert sine_transform(t * exp(-a * t ** 2), t, w) == sqrt(2) * w * exp(-w ** 2 / (4 * a)) / (4 * a ** (S(3) / 2))
    assert inverse_sine_transform(sqrt(2) * w * exp(-w ** 2 / (4 * a)) / (4 * a ** (S(3) / 2)), w, t) == t * exp(
        -a * t ** 2
    )
def test_sine_transform():
    from sympy import EulerGamma

    t = symbols("t")
    w = symbols("w")
    a = symbols("a")
    f = Function("f")

    # Test unevaluated form
    assert sine_transform(f(t), t, w) == SineTransform(f(t), t, w)
    assert inverse_sine_transform(f(w), w,
                                  t) == InverseSineTransform(f(w), w, t)

    assert sine_transform(1 / sqrt(t), t, w) == 1 / sqrt(w)
    assert inverse_sine_transform(1 / sqrt(w), w, t) == 1 / sqrt(t)

    assert sine_transform((1 / sqrt(t))**3, t, w) == 2 * sqrt(w)

    assert sine_transform(
        t**(-a), t,
        w) == 2**(-a + S(1) / 2) * w**(a - 1) * gamma(-a / 2 + 1) / gamma(
            (a + 1) / 2)
    assert inverse_sine_transform(
        2**(-a + S(1) / 2) * w**(a - 1) * gamma(-a / 2 + 1) /
        gamma(a / 2 + S(1) / 2), w, t) == t**(-a)

    assert sine_transform(exp(-a * t), t,
                          w) == sqrt(2) * w / (sqrt(pi) * (a**2 + w**2))
    assert inverse_sine_transform(
        sqrt(2) * w / (sqrt(pi) * (a**2 + w**2)), w, t) == exp(-a * t)

    assert sine_transform(
        log(t) / t, t,
        w) == -sqrt(2) * sqrt(pi) * (log(w**2) + 2 * EulerGamma) / 4

    assert sine_transform(
        t * exp(-a * t**2), t,
        w) == sqrt(2) * w * exp(-w**2 / (4 * a)) / (4 * a**(S(3) / 2))
    assert inverse_sine_transform(
        sqrt(2) * w * exp(-w**2 / (4 * a)) / (4 * a**(S(3) / 2)), w,
        t) == t * exp(-a * t**2)