Esempio n. 1
0
    def test_modulus_transformations(phi, n, m):
        assume(m != 0 and sin(phi)**2 != 0)

        # https://dlmf.nist.gov/19.7.E6
        kappap = 1 / (1 + m)**0.5
        mu = m * kappap**2
        ctheta = (1 + m * sin(phi)**2) * kappap**2 / sin(phi)**2
        n1 = (n + m) * kappap**2

        # https://dlmf.nist.gov/19.7.E4
        cbeta = m / sin(phi + 0j)**2
        for left, right in ((ellipkinc(phi, 1 / m),
                             (m**0.5 * ellipkinc(None, m, cbeta))),
                            (ellipeinc(phi, 1 / m),
                             (ellipeinc(None, m, cbeta) -
                              (1 - m) * ellipkinc(None, m, cbeta)) / m**0.5),
                            (ellippiinc(n, phi, 1 / m),
                             m**0.5 * ellippiinc(m * n, None, m, cbeta))):
            # TODO: properly analytically continue
            assert nice_and_close(left.real, right.real)

        # https://dlmf.nist.gov/19.7.E5
        assert nice_and_close(ellipkinc(phi, -m),
                              kappap * ellipkinc(None, mu, ctheta))
        assert nice_and_close(ellipeinc(
            phi, -m), (ellipeinc(None, mu, ctheta) - mu *
                       ((ctheta - 1) / (ctheta - mu) / ctheta)**0.5) / kappap)
        assert nice_and_close(
            ellippiinc(n, phi, -m),
            (kappap / n1) * (mu * ellipkinc(None, mu, ctheta) +
                             kappap**2 * n * ellippiinc(n1, None, mu, ctheta)))
Esempio n. 2
0
    def test_every_phi_but_zero(phi):
        assume(sin(phi) != 0 and not isnan(ellippiinc(1, phi, 1)))
        c = 1 / sin(phi)**2

        # https://dlmf.nist.gov/19.6.E12
        assert nice_and_close(ellippiinc(1, phi, 1),
                              (elliprc(c, c - 1) + c**0.5 / (c - 1)) / 2)
Esempio n. 3
0
 def test_argument_transformations(phi, n, m):
     # https://dlmf.nist.gov/19.7.E7
     assume(sinh(phi) != 0)
     cpsi = 1 + sinh(phi)**(-2)
     for left, right in ((ellipkinc(1j * phi,
                                    m), ellipkinc(None, 1 - m, cpsi)),
                         (ellipeinc(1j * phi,
                                    m), ellipkinc(None, 1 - m, cpsi) -
                          ellipeinc(None, 1 - m, cpsi) +
                          (1 if phi >= 0 else -1) * sinh(phi) *
                          (1 - (1 - m) / cpsi)**0.5),
                         (ellippiinc(n, 1j * phi, m),
                          (ellipkinc(None, 1 - m, cpsi) -
                           n * ellippiinc(1 - n, None, 1 - m, cpsi)) /
                          (1 - n))):
         # TODO: properly analytically continue
         assert nice_and_close(abs(left.imag), abs(right.real))
Esempio n. 4
0
    def test_ellippiinc_every_phi_m(phi, m):
        assume(sin(phi) != 0)
        c = 1 / sin(phi)**2
        D = (1 - m / c)**0.5

        # https://dlmf.nist.gov/19.6.E12
        assert nice_and_close(ellippiinc(m, phi, 0), elliprc(c - 1, c - m))
        assert nice_and_close(ellippiinc(
            m, phi, 1), (elliprc(c, c - 1) - m * elliprc(c, c - m)) / (1 - m))
        assert nice_and_close(ellippiinc(0, phi, m), ellipkinc(phi, m))
        # https://dlmf.nist.gov/19.6.E13
        assert nice_and_close(
            ellippiinc(m, phi, m),
            (ellipeinc(phi, m) - m / D * sin(phi) * cos(phi)) / (1 - m))
        assert nice_and_close(
            ellippiinc(1, phi, m),
            ellipkinc(phi, m) - (ellipeinc(phi, m) - D * tan(phi)) / (1 - m))
Esempio n. 5
0
    def test_every_phi(phi):
        # https://dlmf.nist.gov/19.6.E8
        assert nice_and_close(ellipkinc(phi, 1), asinh(tan(phi)))

        # https://dlmf.nist.gov/19.6.E9, line 4
        assert nice_and_close(ellipeinc(phi, 1), sin(phi))
        #
        # https://dlmf.nist.gov/19.6.E11, line 3
        assert nice_and_close(ellippiinc(1, phi, 0), tan(phi))
Esempio n. 6
0
 def test_ellippi(n, m):
     assert isclose(ellippi(n, m), ellippiinc(n, pi / 2, m))