Python scipy.special.ellipj() Examples

The following are 16 code examples of scipy.special.ellipj(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module scipy.special , or try the search function .
Example #1
Source File: test_mpmath.py    From GraphicDesignPatternByPython with MIT License 6 votes vote down vote up
def test_cospi_zeros():
    eps = np.finfo(float).eps
    dx = np.r_[-np.logspace(0, -13, 3), 0, np.logspace(-13, 0, 3)]
    dy = dx.copy()
    dx, dy = np.meshgrid(dx, dy)
    dz = dx + 1j*dy
    zeros = (np.arange(-100, 100, 1) + 0.5).reshape(1, 1, -1)
    z = (zeros + np.dstack((dz,)*zeros.size)).flatten()
    dataset = []
    for z0 in z:
        dataset.append((z0, complex(mpmath.cospi(z0))))

    dataset = np.array(dataset)
    FuncData(_cospi, dataset, 0, 1, rtol=2*eps).check()


# ------------------------------------------------------------------------------
# ellipj
# ------------------------------------------------------------------------------ 
Example #2
Source File: filter_design.py    From lambda-packs with MIT License 5 votes vote down vote up
def _vratio(u, ineps, mp):
    [s, c, d, phi] = special.ellipj(u, mp)
    ret = abs(ineps - s / c)
    return ret 
Example #3
Source File: filter_design.py    From Computable with MIT License 5 votes vote down vote up
def _vratio(u, ineps, mp):
    [s, c, d, phi] = special.ellipj(u, mp)
    ret = abs(ineps - s / c)
    return ret 
Example #4
Source File: test_basic.py    From Computable with MIT License 5 votes vote down vote up
def test_ellipj(self):
        cephes.ellipj(0,1) 
Example #5
Source File: test_basic.py    From Computable with MIT License 5 votes vote down vote up
def test_ellipj_nan(self):
        """Regression test for #912."""
        special.ellipj(0.5, np.nan) 
Example #6
Source File: test_basic.py    From Computable with MIT License 5 votes vote down vote up
def test_ellipj(self):
        el = special.ellipj(0.2,0)
        rel = [sin(0.2),cos(0.2),1.0,0.20]
        assert_array_almost_equal(el,rel,13) 
Example #7
Source File: test_mpmath.py    From Computable with MIT License 5 votes vote down vote up
def test_ellipfun_sn(self):
        # Oscillating function --- limit range of first argument; the
        # loss of precision there is an expected numerical feature
        # rather than an actual bug
        assert_mpmath_equal(lambda u, m: sc.ellipj(u, m)[0],
                            lambda u, m: mpmath.ellipfun("sn", u=u, m=m),
                            [Arg(-1e6, 1e6), Arg(a=0, b=1)],
                            atol=1e-20) 
Example #8
Source File: test_mpmath.py    From Computable with MIT License 5 votes vote down vote up
def test_ellipfun_dn(self):
        # see comment in ellipfun_sn
        assert_mpmath_equal(lambda u, m: sc.ellipj(u, m)[2],
                            lambda u, m: mpmath.ellipfun("dn", u=u, m=m),
                            [Arg(-1e6, 1e6), Arg(a=0, b=1)],
                            atol=1e-20) 
Example #9
Source File: filter_design.py    From GraphicDesignPatternByPython with MIT License 5 votes vote down vote up
def _vratio(u, ineps, mp):
    [s, c, d, phi] = special.ellipj(u, mp)
    ret = abs(ineps - s / c)
    return ret 
Example #10
Source File: test_basic.py    From GraphicDesignPatternByPython with MIT License 5 votes vote down vote up
def test_ellipj(self):
        cephes.ellipj(0,1) 
Example #11
Source File: test_basic.py    From GraphicDesignPatternByPython with MIT License 5 votes vote down vote up
def test_ellipj_nan(self):
        """Regression test for #912."""
        special.ellipj(0.5, np.nan) 
Example #12
Source File: test_basic.py    From GraphicDesignPatternByPython with MIT License 5 votes vote down vote up
def test_ellipj(self):
        el = special.ellipj(0.2,0)
        rel = [sin(0.2),cos(0.2),1.0,0.20]
        assert_array_almost_equal(el,rel,13) 
Example #13
Source File: test_mpmath.py    From GraphicDesignPatternByPython with MIT License 5 votes vote down vote up
def test_ellipfun_sn(self):
        def sn(u, m):
            # mpmath doesn't get the zero at u = 0--fix that
            if u == 0:
                return 0
            else:
                return mpmath.ellipfun("sn", u=u, m=m)

        # Oscillating function --- limit range of first argument; the
        # loss of precision there is an expected numerical feature
        # rather than an actual bug
        assert_mpmath_equal(lambda u, m: sc.ellipj(u, m)[0],
                            sn,
                            [Arg(-1e6, 1e6), Arg(a=0, b=1)],
                            rtol=1e-8) 
Example #14
Source File: test_mpmath.py    From GraphicDesignPatternByPython with MIT License 5 votes vote down vote up
def test_ellipfun_cn(self):
        # see comment in ellipfun_sn
        assert_mpmath_equal(lambda u, m: sc.ellipj(u, m)[1],
                            lambda u, m: mpmath.ellipfun("cn", u=u, m=m),
                            [Arg(-1e6, 1e6), Arg(a=0, b=1)],
                            rtol=1e-8) 
Example #15
Source File: test_mpmath.py    From GraphicDesignPatternByPython with MIT License 5 votes vote down vote up
def test_ellipfun_dn(self):
        # see comment in ellipfun_sn
        assert_mpmath_equal(lambda u, m: sc.ellipj(u, m)[2],
                            lambda u, m: mpmath.ellipfun("dn", u=u, m=m),
                            [Arg(-1e6, 1e6), Arg(a=0, b=1)],
                            rtol=1e-8) 
Example #16
Source File: filter_design.py    From Splunking-Crime with GNU Affero General Public License v3.0 5 votes vote down vote up
def _vratio(u, ineps, mp):
    [s, c, d, phi] = special.ellipj(u, mp)
    ret = abs(ineps - s / c)
    return ret