當前位置: 首頁>>代碼示例>>Python>>正文


Python special.jvp方法代碼示例

本文整理匯總了Python中scipy.special.jvp方法的典型用法代碼示例。如果您正苦於以下問題:Python special.jvp方法的具體用法?Python special.jvp怎麽用?Python special.jvp使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在scipy.special的用法示例。


在下文中一共展示了special.jvp方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_h1vp

# 需要導入模塊: from scipy import special [as 別名]
# 或者: from scipy.special import jvp [as 別名]
def test_h1vp(self):
        h1 = special.h1vp(1,.1)
        h1real = (special.jvp(1,.1) + special.yvp(1,.1)*1j)
        assert_almost_equal(h1,h1real,8) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:6,代碼來源:test_basic.py

示例2: test_h2vp

# 需要導入模塊: from scipy import special [as 別名]
# 或者: from scipy.special import jvp [as 別名]
def test_h2vp(self):
        h2 = special.h2vp(1,.1)
        h2real = (special.jvp(1,.1) - special.yvp(1,.1)*1j)
        assert_almost_equal(h2,h2real,8) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:6,代碼來源:test_basic.py

示例3: test_jnp_zeros

# 需要導入模塊: from scipy import special [as 別名]
# 或者: from scipy.special import jvp [as 別名]
def test_jnp_zeros(self):
        jnp = special.jnp_zeros(1,5)
        assert_array_almost_equal(jnp, array([1.84118,
                                                5.33144,
                                                8.53632,
                                                11.70600,
                                                14.86359]),4)
        jnp = special.jnp_zeros(443,5)
        assert_tol_equal(special.jvp(443, jnp), 0, atol=1e-15) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:11,代碼來源:test_basic.py

示例4: test_jvp

# 需要導入模塊: from scipy import special [as 別名]
# 或者: from scipy.special import jvp [as 別名]
def test_jvp(self):
        jvprim = special.jvp(2,2)
        jv0 = (special.jv(1,2)-special.jv(3,2))/2
        assert_almost_equal(jvprim,jv0,10) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:6,代碼來源:test_basic.py

示例5: test_lmbda

# 需要導入模塊: from scipy import special [as 別名]
# 或者: from scipy.special import jvp [as 別名]
def test_lmbda(self):
        lam = special.lmbda(1,.1)
        lamr = (array([special.jn(0,.1), 2*special.jn(1,.1)/.1]),
                array([special.jvp(0,.1), -2*special.jv(1,.1)/.01 + 2*special.jvp(1,.1)/.1]))
        assert_array_almost_equal(lam,lamr,8) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:7,代碼來源:test_basic.py

示例6: perpendicular_attenuation

# 需要導入模塊: from scipy import special [as 別名]
# 或者: from scipy.special import jvp [as 別名]
def perpendicular_attenuation(self, q, tau, diameter):
        "Implements the finite time Callaghan model for cylinders"
        radius = diameter / 2.
        alpha = self.alpha
        q_argument = 2 * np.pi * q * radius
        q_argument_2 = q_argument ** 2
        res = np.zeros_like(q)

        J = special.j1(q_argument) ** 2
        for k in range(0, self.alpha.shape[0]):
            alpha2 = alpha[k, 0] ** 2
            update = (
                4 * np.exp(-alpha2 * self.diffusion_perpendicular *
                           tau / radius ** 2) *
                q_argument_2 /
                (q_argument_2 - alpha2) ** 2 * J
            )
            res += update

        for m in range(1, self.alpha.shape[1]):
            J = special.jvp(m, q_argument, 1)
            q_argument_J = (q_argument * J) ** 2
            for k in range(self.alpha.shape[0]):
                alpha2 = self.alpha[k, m] ** 2
                update = (
                    8 * np.exp(-alpha2 * self.diffusion_perpendicular *
                               tau / radius ** 2) *
                    alpha2 / (alpha2 - m ** 2) *
                    q_argument_J /
                    (q_argument_2 - alpha2) ** 2
                )
                res += update
        return res 
開發者ID:AthenaEPI,項目名稱:dmipy,代碼行數:35,代碼來源:cylinder_models.py

示例7: test_jnp_zeros

# 需要導入模塊: from scipy import special [as 別名]
# 或者: from scipy.special import jvp [as 別名]
def test_jnp_zeros(self):
        jnp = special.jnp_zeros(1,5)
        assert_array_almost_equal(jnp, array([1.84118,
                                                5.33144,
                                                8.53632,
                                                11.70600,
                                                14.86359]),4)
        jnp = special.jnp_zeros(443,5)
        assert_allclose(special.jvp(443, jnp), 0, atol=1e-15) 
開發者ID:Relph1119,項目名稱:GraphicDesignPatternByPython,代碼行數:11,代碼來源:test_basic.py

示例8: circ_radial_weights

# 需要導入模塊: from scipy import special [as 別名]
# 或者: from scipy.special import jvp [as 別名]
def circ_radial_weights(N, kr, setup):
    r"""Radial weighing functions.

    Computes the radial weighting functions for diferent array types

    For instance for an rigid array

    .. math::

        b_n(kr) = J_n(kr) - \frac{J_n^\prime(kr)}{H_n^{(2)\prime}(kr)}H_n^{(2)}(kr)

    Parameters
    ----------
    N : int
        Maximum order.
    kr : (M,) array_like
        Wavenumber * radius.
    setup : {'open', 'card', 'rigid'}
        Array configuration (open, cardioids, rigid).

    Returns
    -------
    bn : (M, 2*N+1) numpy.ndarray
        Radial weights for all orders up to N and the given wavenumbers.

    """
    kr = util.asarray_1d(kr)
    n = np.arange(N+1)
    Bns = np.zeros((len(kr), N+1), dtype=complex)
    for i, x in enumerate(kr):
        Jn = special.jv(n, x)
        if setup == 'open':
            bn = Jn
        elif setup == 'card':
            bn = Jn - 1j * special.jvp(n, x, n=1)
        elif setup == 'rigid':
            if x == 0:
                # Hn(x)/Hn'(x) -> 0 for x -> 0
                bn = Jn
            else:
                Jnd = special.jvp(n, x, n=1)
                Hn = special.hankel2(n, x)
                Hnd = special.h2vp(n, x)
                bn = Jn - Jnd/Hnd*Hn
        else:
            raise ValueError('setup must be either: open, card or rigid')
        Bns[i, :] = bn
    Bns = np.concatenate((Bns, (Bns*(-1)**np.arange(N+1))[:, :0:-1]), axis=-1)
    return np.squeeze(Bns) 
開發者ID:spatialaudio,項目名稱:sfa-numpy,代碼行數:51,代碼來源:radial.py


注:本文中的scipy.special.jvp方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。