Example #1
0
 def I1(h2, k2, s):
     res = (ellip_harm_2(h2, k2, 1, 1, s) /
            (3 * ellip_harm(h2, k2, 1, 1, s)) +
            ellip_harm_2(h2, k2, 1, 2, s) /
            (3 * ellip_harm(h2, k2, 1, 2, s)) +
            ellip_harm_2(h2, k2, 1, 3, s) /
            (3 * ellip_harm(h2, k2, 1, 3, s)))
     return res
Example #2
0
def test_ellip_harm_2():

    def I1(h2, k2, s):
        res = (ellip_harm_2(h2, k2, 1, 1, s)/(3 * ellip_harm(h2, k2, 1, 1, s))
        + ellip_harm_2(h2, k2, 1, 2, s)/(3 * ellip_harm(h2, k2, 1, 2, s)) +
        ellip_harm_2(h2, k2, 1, 3, s)/(3 * ellip_harm(h2, k2, 1, 3, s)))
        return res

    assert_almost_equal(I1(5, 8, 10), 1/(10*sqrt((100-5)*(100-8))))

    # Values produced by code from arXiv:1204.0267
    assert_almost_equal(ellip_harm_2(5, 8, 2, 1, 10), 0.00108056853382)
    assert_almost_equal(ellip_harm_2(5, 8, 2, 2, 10), 0.00105820513809)
    assert_almost_equal(ellip_harm_2(5, 8, 2, 3, 10), 0.00106058384743)
    assert_almost_equal(ellip_harm_2(5, 8, 2, 4, 10), 0.00106774492306)
    assert_almost_equal(ellip_harm_2(5, 8, 2, 5, 10), 0.00107976356454)
Example #3
0
def test_ellip_harm_2():

    def I1(h2, k2, s):
        res = (ellip_harm_2(h2, k2, 1, 1, s)/(3 * ellip_harm(h2, k2, 1, 1, s))
        + ellip_harm_2(h2, k2, 1, 2, s)/(3 * ellip_harm(h2, k2, 1, 2, s)) +
        ellip_harm_2(h2, k2, 1, 3, s)/(3 * ellip_harm(h2, k2, 1, 3, s)))
        return res

    with warnings.catch_warnings(record=True):  # occurrence of roundoff ...
        assert_almost_equal(I1(5, 8, 10), 1/(10*sqrt((100-5)*(100-8))))

        # Values produced by code from arXiv:1204.0267
        assert_almost_equal(ellip_harm_2(5, 8, 2, 1, 10), 0.00108056853382)
        assert_almost_equal(ellip_harm_2(5, 8, 2, 2, 10), 0.00105820513809)
        assert_almost_equal(ellip_harm_2(5, 8, 2, 3, 10), 0.00106058384743)
        assert_almost_equal(ellip_harm_2(5, 8, 2, 4, 10), 0.00106774492306)
        assert_almost_equal(ellip_harm_2(5, 8, 2, 5, 10), 0.00107976356454)
Example #4
0
def test_ellip_harm_2():

    def I1(h2, k2, s):
        res = (ellip_harm_2(h2, k2, 1, 1, s)/(3 * ellip_harm(h2, k2, 1, 1, s))
        + ellip_harm_2(h2, k2, 1, 2, s)/(3 * ellip_harm(h2, k2, 1, 2, s)) +
        ellip_harm_2(h2, k2, 1, 3, s)/(3 * ellip_harm(h2, k2, 1, 3, s)))
        return res

    with suppress_warnings() as sup:
        sup.filter(IntegrationWarning, "The occurrence of roundoff error")
        assert_almost_equal(I1(5, 8, 10), 1/(10*sqrt((100-5)*(100-8))))

        # Values produced by code from arXiv:1204.0267
        assert_almost_equal(ellip_harm_2(5, 8, 2, 1, 10), 0.00108056853382)
        assert_almost_equal(ellip_harm_2(5, 8, 2, 2, 10), 0.00105820513809)
        assert_almost_equal(ellip_harm_2(5, 8, 2, 3, 10), 0.00106058384743)
        assert_almost_equal(ellip_harm_2(5, 8, 2, 4, 10), 0.00106774492306)
        assert_almost_equal(ellip_harm_2(5, 8, 2, 5, 10), 0.00107976356454)
Example #5
0
def test_ellip_harm_2():
    def I1(h2, k2, s):
        res = (ellip_harm_2(h2, k2, 1, 1, s) /
               (3 * ellip_harm(h2, k2, 1, 1, s)) +
               ellip_harm_2(h2, k2, 1, 2, s) /
               (3 * ellip_harm(h2, k2, 1, 2, s)) +
               ellip_harm_2(h2, k2, 1, 3, s) /
               (3 * ellip_harm(h2, k2, 1, 3, s)))
        return res

    assert_almost_equal(I1(5, 8, 10), 1 / (10 * sqrt((100 - 5) * (100 - 8))))

    # Values produced by code from arXiv:1204.0267
    assert_almost_equal(ellip_harm_2(5, 8, 2, 1, 10), 0.00108056853382)
    assert_almost_equal(ellip_harm_2(5, 8, 2, 2, 10), 0.00105820513809)
    assert_almost_equal(ellip_harm_2(5, 8, 2, 3, 10), 0.00106058384743)
    assert_almost_equal(ellip_harm_2(5, 8, 2, 4, 10), 0.00106774492306)
    assert_almost_equal(ellip_harm_2(5, 8, 2, 5, 10), 0.00107976356454)
Example #6
0
def test_ellip_harm_2():
    def I1(h2, k2, s):
        res = (ellip_harm_2(h2, k2, 1, 1, s) /
               (3 * ellip_harm(h2, k2, 1, 1, s)) +
               ellip_harm_2(h2, k2, 1, 2, s) /
               (3 * ellip_harm(h2, k2, 1, 2, s)) +
               ellip_harm_2(h2, k2, 1, 3, s) /
               (3 * ellip_harm(h2, k2, 1, 3, s)))
        return res

    with suppress_warnings() as sup:
        sup.filter(IntegrationWarning, "The occurrence of roundoff error")
        assert_almost_equal(I1(5, 8, 10), 1 / (10 * sqrt(
            (100 - 5) * (100 - 8))))

        # Values produced by code from arXiv:1204.0267
        assert_almost_equal(ellip_harm_2(5, 8, 2, 1, 10), 0.00108056853382)
        assert_almost_equal(ellip_harm_2(5, 8, 2, 2, 10), 0.00105820513809)
        assert_almost_equal(ellip_harm_2(5, 8, 2, 3, 10), 0.00106058384743)
        assert_almost_equal(ellip_harm_2(5, 8, 2, 4, 10), 0.00106774492306)
        assert_almost_equal(ellip_harm_2(5, 8, 2, 5, 10), 0.00107976356454)
Example #7
0
 def solid_int_ellip2(lambda1, mu, nu, n, p, h2, k2):
     return (ellip_harm_2(h2, k2, n, p, lambda1)
             * ellip_harm(h2, k2, n, p, mu)*ellip_harm(h2, k2, n, p, nu))
Example #8
0
 def I1(h2, k2, s):
     res = (ellip_harm_2(h2, k2, 1, 1, s)/(3 * ellip_harm(h2, k2, 1, 1, s))
     + ellip_harm_2(h2, k2, 1, 2, s)/(3 * ellip_harm(h2, k2, 1, 2, s)) +
     ellip_harm_2(h2, k2, 1, 3, s)/(3 * ellip_harm(h2, k2, 1, 3, s)))
     return res
Example #9
0
 def solid_int_ellip2(lambda1, mu, nu, n, p, h2, k2):
     return (ellip_harm_2(h2, k2, n, p, lambda1) *
             ellip_harm(h2, k2, n, p, mu) * ellip_harm(h2, k2, n, p, nu))