当前位置: 首页>>代码示例>>Python>>正文


Python special.kn方法代码示例

本文整理汇总了Python中scipy.special.kn方法的典型用法代码示例。如果您正苦于以下问题:Python special.kn方法的具体用法?Python special.kn怎么用?Python special.kn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在scipy.special的用法示例。


在下文中一共展示了special.kn方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: F

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import kn [as 别名]
def F(tm, B1, B2):
    #print B1, B2
    Fi = 2. * np.sqrt(pi * (B1**2 - B2**2))
    
    km = np.arctan( np.sqrt(tm) )
    
    I2 = 0.0
    Nk = 5000
    ks = np.linspace(km, pi/2, Nk)
    dk = ks[1] - ks[0]
    for k in ks:
        t = np.tan(k)**2
        dI = (2*t+1)**2 * (t/tm/(1+t)-1.)/t + t - np.sqrt(t*tm*(1+t)) - (2 + 0.5/t) * np.log(t/tm/(1+t))
        #print t, kn(0, B2*t), B1, B2, B2*t, dI 
        #print -B1*t
        #print t, B1, ':', exp(-B1*t)
        dI *= np.exp(-B1*t) * kn(0,B2*t) * np.sqrt(1 + t)
        I2 += dI * dk
    
    return Fi * I2 
开发者ID:ocelot-collab,项目名称:ocelot,代码行数:22,代码来源:touschek.py

示例2: eigenvalue_equation

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import kn [as 别名]
def eigenvalue_equation(u, m, V):
	'''Evaluates the eigenvalue equation for a circular step-index fiber.

	Parameters
	----------
	u : scalar
		The normalized propagation constant.
	m : int
		The azimuthal order
	V : scalar
		The normalized frequency parameter of the fiber.

	Returns
	-------
	scalar
		The eigenvalue equation value
	'''
	w = np.sqrt(V**2 - u**2)
	return jv(m, u) / (u * jv(m + 1, u)) - kn(m, w) / (w * kn(m + 1, w)) 
开发者ID:ehpor,项目名称:hcipy,代码行数:21,代码来源:LP_fiber_modes.py

示例3: test_legacy

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import kn [as 别名]
def test_legacy():
    # Legacy behavior: truncating arguments to integers
    with suppress_warnings() as sup:
        sup.filter(RuntimeWarning, "floating point number truncated to an integer")
        assert_equal(special.bdtrc(1, 2, 0.3), special.bdtrc(1.8, 2.8, 0.3))
        assert_equal(special.bdtr(1, 2, 0.3), special.bdtr(1.8, 2.8, 0.3))
        assert_equal(special.bdtri(1, 2, 0.3), special.bdtri(1.8, 2.8, 0.3))
        assert_equal(special.expn(1, 0.3), special.expn(1.8, 0.3))
        assert_equal(special.hyp2f0(1, 2, 0.3, 1), special.hyp2f0(1, 2, 0.3, 1.8))
        assert_equal(special.nbdtrc(1, 2, 0.3), special.nbdtrc(1.8, 2.8, 0.3))
        assert_equal(special.nbdtr(1, 2, 0.3), special.nbdtr(1.8, 2.8, 0.3))
        assert_equal(special.nbdtri(1, 2, 0.3), special.nbdtri(1.8, 2.8, 0.3))
        assert_equal(special.pdtrc(1, 0.3), special.pdtrc(1.8, 0.3))
        assert_equal(special.pdtr(1, 0.3), special.pdtr(1.8, 0.3))
        assert_equal(special.pdtri(1, 0.3), special.pdtri(1.8, 0.3))
        assert_equal(special.kn(1, 0.3), special.kn(1.8, 0.3))
        assert_equal(special.yn(1, 0.3), special.yn(1.8, 0.3))
        assert_equal(special.smirnov(1, 0.3), special.smirnov(1.8, 0.3))
        assert_equal(special.smirnovi(1, 0.3), special.smirnovi(1.8, 0.3)) 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:21,代码来源:test_basic.py

示例4: test_kn

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import kn [as 别名]
def test_kn(self):
        cephes.kn(1,1) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:4,代码来源:test_basic.py

示例5: test_kn_largeorder

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import kn [as 别名]
def test_kn_largeorder(self):
        assert_allclose(special.kn(32, 1), 1.7516596664574289e+43) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:4,代码来源:test_basic.py

示例6: test_kv_cephes_vs_amos

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import kn [as 别名]
def test_kv_cephes_vs_amos(self):
        self.check_cephes_vs_amos(special.kv, special.kn, rtol=1e-9, atol=1e-305)
        self.check_cephes_vs_amos(special.kv, special.kv, rtol=1e-9, atol=1e-305) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:5,代码来源:test_basic.py

示例7: test_sph_kn

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import kn [as 别名]
def test_sph_kn(self):
        kn = special.sph_kn(2,.2)
        kn0 = -kn[0][1]
        kn1 = -kn[0][0]-2.0/0.2*kn[0][1]
        kn2 = -kn[0][1]-3.0/0.2*kn[0][2]
        assert_array_almost_equal(kn[0],[6.4302962978445670140,
                                         38.581777787067402086,
                                         585.15696310385559829],12)
        assert_array_almost_equal(kn[1],[kn0,kn1,kn2],9) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:11,代码来源:test_basic.py

示例8: test_besselk_int

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import kn [as 别名]
def test_besselk_int(self):
        assert_mpmath_equal(sc.kn,
                            _exception_to_nan(lambda v, z: mpmath.besselk(v, z, **HYPERKW)),
                            [IntArg(-1000, 1000), Arg()]) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:6,代码来源:test_mpmath.py

示例9: LP_radial

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import kn [as 别名]
def LP_radial(m, u, w, r):
	'''Evaluates the radial profile of the LP modes.

	Parameters
	----------
	m : int
		The azimuthal order
	u : scalar
		The normalized inner propagation constant.
	w : scalar
		The normalized outer propagation constant.
	r : array_like
		The radial coordinates on which to evaluate the bessel modes.

	Returns
	-------
	array_like
		An array that contains the radial profile.
	'''
	# The scaling factor for the continuity condition
	scaling_factor = jv(m,u) /kn(m, w)

	# Find the grid inside and outside the core radius
	mask = r < 1

	# Evaluate the radial mode profile
	mode_field = np.zeros_like(r)
	mode_field[mask] = jv(m, u * r[mask])
	mode_field[~mask] = scaling_factor * kn(m, w * r[~mask])

	return mode_field 
开发者ID:ehpor,项目名称:hcipy,代码行数:33,代码来源:LP_fiber_modes.py


注:本文中的scipy.special.kn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。