本文整理汇总了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)
示例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)
示例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)
示例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)
示例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)
示例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
示例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)
示例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)