SciPy 1.12 中文文档(四十)
scipy.special.jnyn_zeros
scipy.special.jnyn_zeros(n, nt)
计算贝塞尔函数 Jn(x)、Jn’(x)、Yn(x)和 Yn’(x)的nt个零点。
返回长度为nt的 4 个数组,分别对应 Jn(x)、Jn’(x)、Yn(x)和 Yn’(x)的前nt个零点,零点按升序返回。
参数:
nint
贝塞尔函数的阶数
ntint
需要计算的零点数(<=1200)
返回:
Jnndarray
第一nt个 Jn 的零点
Jnpndarray
第一nt个 Jn’的零点
Ynndarray
第一nt个 Yn 的零点
Ynpndarray
第一nt个 Yn’的零点
另请参阅
jn_zeros, jnp_zeros, yn_zeros, ynp_zeros
参考文献
[1]
张善杰和金建明。“特殊函数的计算”,John Wiley and Sons,1996 年,第五章。people.sc.fsu.edu/~jburkardt/f77_src/special_functions/special_functions.html
示例
计算(J_1)、(J_1')、(Y_1)和(Y_1')的前三个根。
>>> from scipy.special import jnyn_zeros
>>> jn_roots, jnp_roots, yn_roots, ynp_roots = jnyn_zeros(1, 3)
>>> jn_roots, yn_roots
(array([ 3.83170597, 7.01558667, 10.17346814]),
array([2.19714133, 5.42968104, 8.59600587]))
绘制(J_1)、(J_1')、(Y_1)、(Y_1')及其根。
>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>> from scipy.special import jnyn_zeros, jvp, jn, yvp, yn
>>> jn_roots, jnp_roots, yn_roots, ynp_roots = jnyn_zeros(1, 3)
>>> fig, ax = plt.subplots()
>>> xmax= 11
>>> x = np.linspace(0, xmax)
>>> x[0] += 1e-15
>>> ax.plot(x, jn(1, x), label=r"$J_1$", c='r')
>>> ax.plot(x, jvp(1, x, 1), label=r"$J_1'$", c='b')
>>> ax.plot(x, yn(1, x), label=r"$Y_1$", c='y')
>>> ax.plot(x, yvp(1, x, 1), label=r"$Y_1'$", c='c')
>>> zeros = np.zeros((3, ))
>>> ax.scatter(jn_roots, zeros, s=30, c='r', zorder=5,
... label=r"$J_1$ roots")
>>> ax.scatter(jnp_roots, zeros, s=30, c='b', zorder=5,
... label=r"$J_1'$ roots")
>>> ax.scatter(yn_roots, zeros, s=30, c='y', zorder=5,
... label=r"$Y_1$ roots")
>>> ax.scatter(ynp_roots, zeros, s=30, c='c', zorder=5,
... label=r"$Y_1'$ roots")
>>> ax.hlines(0, 0, xmax, color='k')
>>> ax.set_ylim(-0.6, 0.6)
>>> ax.set_xlim(0, xmax)
>>> ax.legend(ncol=2, bbox_to_anchor=(1., 0.75))
>>> plt.tight_layout()
>>> plt.show()
scipy.special.jn_zeros
scipy.special.jn_zeros(n, nt)
计算整数阶 Bessel 函数 Jn 的零点。
在区间 ((0, \infty)) 上计算 Bessel 函数 (J_n(x)) 的前 nt 个零点。这些零点按升序返回。请注意,此区间不包括对于 (n > 0) 存在于 (x = 0) 处的零点。
参数:
n int
Bessel 函数的阶数
nt int
要返回的零点数量
返回:
ndarray
Bessel 函数的前 nt 个零点。
另见
jv
第一类实阶 Bessel 函数
jnp_zeros
(Jn') 的零点
参考文献
[1]
张善杰和金建明著。“特殊函数的计算”,约翰·威利与儿子,1996 年,第五章。people.sc.fsu.edu/~jburkardt/f77_src/special_functions/special_functions.html
示例
计算 (J_3) 的前四个正根。
>>> from scipy.special import jn_zeros
>>> jn_zeros(3, 4)
array([ 6.3801619 , 9.76102313, 13.01520072, 16.22346616])
绘制 (J_3) 及其前四个正根。请注意,位于 0 处的根不由 jn_zeros 返回。
>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>> from scipy.special import jn, jn_zeros
>>> j3_roots = jn_zeros(3, 4)
>>> xmax = 18
>>> xmin = -1
>>> x = np.linspace(xmin, xmax, 500)
>>> fig, ax = plt.subplots()
>>> ax.plot(x, jn(3, x), label=r'$J_3$')
>>> ax.scatter(j3_roots, np.zeros((4, )), s=30, c='r',
... label=r"$J_3$_Zeros", zorder=5)
>>> ax.scatter(0, 0, s=30, c='k',
... label=r"Root at 0", zorder=5)
>>> ax.hlines(0, 0, xmax, color='k')
>>> ax.set_xlim(xmin, xmax)
>>> plt.legend()
>>> plt.show()
scipy.special.jnp_zeros
scipy.special.jnp_zeros(n, nt)
计算整数阶 Bessel 函数导数 (Jn') 的零点。
在区间 ((0, \infty)) 上计算函数 (J_n'(x)) 的 nt 个零点。零点按升序返回。注意,此区间不包括 (x = 0) 处 (n > 1) 时存在的零点。
参数:
nint
Bessel 函数的阶数
ntint
要返回的零点数
返回值:
ndarray
First nt zeros of the Bessel function.
另请参阅
jvp
整数阶贝塞尔函数的导数
jv
浮点阶贝塞尔函数的第一类
参考文献
[1]
Zhang, Shanjie 和 Jin, Jianming. “特殊函数的计算”, John Wiley and Sons, 1996, 第五章。people.sc.fsu.edu/~jburkardt/f77_src/special_functions/special_functions.html
示例
计算 (J_2') 的前四个根。
>>> from scipy.special import jnp_zeros
>>> jnp_zeros(2, 4)
array([ 3.05423693, 6.70613319, 9.96946782, 13.17037086])
如 jnp_zeros 返回 (J_n') 的根,可用于计算 (J_n) 的峰值位置。绘制 (J_2)、(J_2') 及 (J_2') 的根的位置。
>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>> from scipy.special import jn, jnp_zeros, jvp
>>> j2_roots = jnp_zeros(2, 4)
>>> xmax = 15
>>> x = np.linspace(0, xmax, 500)
>>> fig, ax = plt.subplots()
>>> ax.plot(x, jn(2, x), label=r'$J_2$')
>>> ax.plot(x, jvp(2, x, 1), label=r"$J_2'$")
>>> ax.hlines(0, 0, xmax, color='k')
>>> ax.scatter(j2_roots, np.zeros((4, )), s=30, c='r',
... label=r"Roots of $J_2'$", zorder=5)
>>> ax.set_ylim(-0.4, 0.8)
>>> ax.set_xlim(0, xmax)
>>> plt.legend()
>>> plt.show()
scipy.special.yn_zeros
scipy.special.yn_zeros(n, nt)
计算整数阶贝塞尔函数 ( Y_n(x) ) 的零点。
计算 nt 个函数 ( Y_n(x) ) 在区间 ((0, \infty)) 上的零点。这些零点按升序返回。
参数:
n整数
贝塞尔函数的阶数
nt整数
要返回的零点数
返回:
ndarray
贝塞尔函数的前 nt 个零点。
另请参阅
yn
整数阶贝塞尔函数的第二类函数
yv
实数阶贝塞尔函数的第二类函数
参考文献
[1]
张, 善杰 和 金, 建明. “特殊函数的计算”, 约翰·威利与儿子公司, 1996 年, 第五章. people.sc.fsu.edu/~jburkardt/f77_src/special_functions/special_functions.html
示例
计算 ( Y_2 ) 的前四个根。
>>> from scipy.special import yn_zeros
>>> yn_zeros(2, 4)
array([ 3.38424177, 6.79380751, 10.02347798, 13.20998671])
绘制 ( Y_2 ) 及其前四个根。
>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>> from scipy.special import yn, yn_zeros
>>> xmin = 2
>>> xmax = 15
>>> x = np.linspace(xmin, xmax, 500)
>>> fig, ax = plt.subplots()
>>> ax.hlines(0, xmin, xmax, color='k')
>>> ax.plot(x, yn(2, x), label=r'$Y_2$')
>>> ax.scatter(yn_zeros(2, 4), np.zeros((4, )), s=30, c='r',
... label='Roots', zorder=5)
>>> ax.set_ylim(-0.4, 0.4)
>>> ax.set_xlim(xmin, xmax)
>>> plt.legend()
>>> plt.show()
scipy.special.ynp_zeros
scipy.special.ynp_zeros(n, nt)
计算整数阶贝塞尔函数导数 (Yn'(x)) 的零点。
在区间 ((0, \infty)) 上计算 nt 个函数 (Y_n'(x)) 的零点。返回的零点按升序排列。
参数:
nint
贝塞尔函数的阶数
ntint
要返回的零点数
返回:
ndarray
第一个 nt 个贝塞尔函数导数的零点。
另请参见
yvp
参考文献
[1]
张善杰和金建明。“特殊函数的计算”,John Wiley and Sons,1996 年,第五章。people.sc.fsu.edu/~jburkardt/f77_src/special_functions/special_functions.html
示例
计算阶数为 0 的贝塞尔函数第一导数的前四个根 (Y_0')。
>>> from scipy.special import ynp_zeros
>>> ynp_zeros(0, 4)
array([ 2.19714133, 5.42968104, 8.59600587, 11.74915483])
绘制 (Y_0)、(Y_0') 并视觉确认 (Y_0') 的根位于 (Y_0) 的局部极值点。
>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>> from scipy.special import yn, ynp_zeros, yvp
>>> zeros = ynp_zeros(0, 4)
>>> xmax = 13
>>> x = np.linspace(0, xmax, 500)
>>> fig, ax = plt.subplots()
>>> ax.plot(x, yn(0, x), label=r'$Y_0$')
>>> ax.plot(x, yvp(0, x, 1), label=r"$Y_0'$")
>>> ax.scatter(zeros, np.zeros((4, )), s=30, c='r',
... label=r"Roots of $Y_0'$", zorder=5)
>>> for root in zeros:
... y0_extremum = yn(0, root)
... lower = min(0, y0_extremum)
... upper = max(0, y0_extremum)
... ax.vlines(root, lower, upper, color='r')
>>> ax.hlines(0, 0, xmax, color='k')
>>> ax.set_ylim(-0.6, 0.6)
>>> ax.set_xlim(0, xmax)
>>> plt.legend()
>>> plt.show()
scipy.special.y0_zeros
scipy.special.y0_zeros(nt, complex=False)
计算贝塞尔函数(Y0(z))的 nt 个零点,以及每个零点处的导数。
导数由每个零点(z0)处的(Y0’(z0) = -Y1(z0))给出。
参数:
ntint
返回零点的数量
complexbool,默认为 False
将其设置为 False 以仅返回实根;将其设置为 True 以仅返回具有负实部和正虚部的复根。请注意,后者的复共轭也是函数的零点,但此例程不返回它们。
返回:
z0nndarray
第 n 个(Y0(z))的零点位置
y0pz0nndarray
第 n 个零点处的导数(Y0’(z0))
参考资料
[1]
张善杰和金建明。“特殊函数的计算”,John Wiley and Sons,1996 年,第五章。people.sc.fsu.edu/~jburkardt/f77_src/special_functions/special_functions.html
示例
计算(Y_0)的前 4 个实根及其根处的导数:
>>> import numpy as np
>>> from scipy.special import y0_zeros
>>> zeros, grads = y0_zeros(4)
>>> with np.printoptions(precision=5):
... print(f"Roots: {zeros}")
... print(f"Gradients: {grads}")
Roots: [ 0.89358+0.j 3.95768+0.j 7.08605+0.j 10.22235+0.j]
Gradients: [-0.87942+0.j 0.40254+0.j -0.3001 +0.j 0.2497 +0.j]
绘制(Y_0)的实部和前四个计算得到的根。
>>> import matplotlib.pyplot as plt
>>> from scipy.special import y0
>>> xmin = 0
>>> xmax = 11
>>> x = np.linspace(xmin, xmax, 500)
>>> fig, ax = plt.subplots()
>>> ax.hlines(0, xmin, xmax, color='k')
>>> ax.plot(x, y0(x), label=r'$Y_0$')
>>> zeros, grads = y0_zeros(4)
>>> ax.scatter(zeros.real, np.zeros((4, )), s=30, c='r',
... label=r'$Y_0$_zeros', zorder=5)
>>> ax.set_ylim(-0.5, 0.6)
>>> ax.set_xlim(xmin, xmax)
>>> plt.legend(ncol=2)
>>> plt.show()
通过设置complex=True计算(Y_0)的前 4 个复根及其根处的导数:
>>> y0_zeros(4, True)
(array([ -2.40301663+0.53988231j, -5.5198767 +0.54718001j,
-8.6536724 +0.54841207j, -11.79151203+0.54881912j]),
array([ 0.10074769-0.88196771j, -0.02924642+0.5871695j ,
0.01490806-0.46945875j, -0.00937368+0.40230454j]))
scipy.special.y1_zeros
scipy.special.y1_zeros(nt, complex=False)
计算贝塞尔函数 (Y1(z)) 的 nt 个零点及每个零点处的导数。
每个零点 z1 处的导数由 Y1’(z1) = Y0(z1) 给出。
参数:
ntint
要返回的零的数量
complexbool,默认为 False
将其设置为 False 以仅返回实零点;将其设置为 True 以仅返回具有负实部和正虚部的复零点。请注意,后者的复共轭也是函数的零点,但不会由此程序返回。
返回:
z1nndarray
第 n 个(Y1(z))的零点位置
y1pz1nndarray
第 n 个零点处的导数值 Y1’(z1)
参考文献
[1]
张, 珊杰 和 金, 建明。“特殊函数的计算”,约翰·威利和儿子出版社,1996 年,第五章。people.sc.fsu.edu/~jburkardt/f77_src/special_functions/special_functions.html
示例
计算(Y_1)的前 4 个实根及其在根处的导数:
>>> import numpy as np
>>> from scipy.special import y1_zeros
>>> zeros, grads = y1_zeros(4)
>>> with np.printoptions(precision=5):
... print(f"Roots: {zeros}")
... print(f"Gradients: {grads}")
Roots: [ 2.19714+0.j 5.42968+0.j 8.59601+0.j 11.74915+0.j]
Gradients: [ 0.52079+0.j -0.34032+0.j 0.27146+0.j -0.23246+0.j]
提取实部:
>>> realzeros = zeros.real
>>> realzeros
array([ 2.19714133, 5.42968104, 8.59600587, 11.74915483])
绘制 (Y_1) 和前四个计算出的根。
>>> import matplotlib.pyplot as plt
>>> from scipy.special import y1
>>> xmin = 0
>>> xmax = 13
>>> x = np.linspace(xmin, xmax, 500)
>>> zeros, grads = y1_zeros(4)
>>> fig, ax = plt.subplots()
>>> ax.hlines(0, xmin, xmax, color='k')
>>> ax.plot(x, y1(x), label=r'$Y_1$')
>>> ax.scatter(zeros.real, np.zeros((4, )), s=30, c='r',
... label=r'$Y_1$_zeros', zorder=5)
>>> ax.set_ylim(-0.5, 0.5)
>>> ax.set_xlim(xmin, xmax)
>>> plt.legend()
>>> plt.show()
通过设置 complex=True 计算(Y_1)的前 4 个复根及其在根处的导数:
>>> y1_zeros(4, True)
(array([ -0.50274327+0.78624371j, -3.83353519+0.56235654j,
-7.01590368+0.55339305j, -10.17357383+0.55127339j]),
array([-0.45952768+1.31710194j, 0.04830191-0.69251288j,
-0.02012695+0.51864253j, 0.011614 -0.43203296j]))
scipy.special.y1p_zeros
scipy.special.y1p_zeros(nt, complex=False)
计算贝塞尔导数 Y1’(z)的 nt 个零点,并计算每个零点处的值。
值由 Y1(z1)在每个 Y1’(z1)=0 的 z1 处给出。
参数:
nt int
要返回的零点数
复杂bool,默认为 False
设为 False 以仅返回实部为零的零点;设为 True 以仅返回具有负实部和正虚部的复零点。请注意,后者的复共轭也是该函数的零点,但不会被此例程返回。
返回:
z1pn ndarray
第 n 个 Y1’(z)的零点的位置
y1z1pn ndarray
第 n 个零点处的导数 Y1(z1)的值
参考文献
[1]
张, 善杰 和 金, 建明. “特殊函数的计算”, 约翰威利和儿子, 1996, 第五章. people.sc.fsu.edu/~jburkardt/f77_src/special_functions/special_functions.html
示例
计算(Y_1')的前四个根和这些根处的(Y_1)的值。
>>> import numpy as np
>>> from scipy.special import y1p_zeros
>>> y1grad_roots, y1_values = y1p_zeros(4)
>>> with np.printoptions(precision=5):
... print(f"Y1' Roots: {y1grad_roots}")
... print(f"Y1 values: {y1_values}")
Y1' Roots: [ 3.68302+0.j 6.9415 +0.j 10.1234 +0.j 13.28576+0.j]
Y1 values: [ 0.41673+0.j -0.30317+0.j 0.25091+0.j -0.21897+0.j]
y1p_zeros 可用于直接计算(Y_1)的极值点。这里我们绘制了(Y_1)和前四个极值点。
>>> import matplotlib.pyplot as plt
>>> from scipy.special import y1, yvp
>>> y1_roots, y1_values_at_roots = y1p_zeros(4)
>>> real_roots = y1_roots.real
>>> xmax = 15
>>> x = np.linspace(0, xmax, 500)
>>> x[0] += 1e-15
>>> fig, ax = plt.subplots()
>>> ax.plot(x, y1(x), label=r'$Y_1$')
>>> ax.plot(x, yvp(1, x, 1), label=r"$Y_1'$")
>>> ax.scatter(real_roots, np.zeros((4, )), s=30, c='r',
... label=r"Roots of $Y_1'$", zorder=5)
>>> ax.scatter(real_roots, y1_values_at_roots.real, s=30, c='k',
... label=r"Extrema of $Y_1$", zorder=5)
>>> ax.hlines(0, 0, xmax, color='k')
>>> ax.set_ylim(-0.5, 0.5)
>>> ax.set_xlim(0, xmax)
>>> ax.legend(ncol=2, bbox_to_anchor=(1., 0.75))
>>> plt.tight_layout()
>>> plt.show()
scipy.special.j0
原文:
docs.scipy.org/doc/scipy-1.12.0/reference/generated/scipy.special.j0.html#scipy.special.j0
scipy.special.j0(x, out=None) = <ufunc 'j0'>
零阶第一类贝塞尔函数。
参数:
x 类似数组
参数(浮点数)。
out ndarray, 可选
可选的函数值输出数组
返回:
J标量或 ndarray
x 处零阶第一类贝塞尔函数的值。
参见
jv
实数阶贝塞尔函数和复数参数的贝塞尔函数。
spherical_jn
球面贝塞尔函数。
注释
将域分为区间[0, 5]和(5, 无穷大)。在第一个区间内使用以下有理近似:
[J_0(x) \approx (w - r_1²)(w - r_2²) \frac{P_3(w)}{Q_8(w)},]
其中 (w = x²),(r_1)、(r_2) 是 (J_0) 的零点,(P_3) 和 (Q_8) 是分别为 3 和 8 次的多项式。
在第二区间内,使用 Hankel 渐近展开,其中包括两个 6/6 和 7/7 次有理函数。
此函数是 Cephes 的[1]例程j0的包装。请勿与球面贝塞尔函数混淆(参见spherical_jn)。
参考资料
[1]
Cephes 数学函数库,www.netlib.org/cephes/
示例
计算单点函数:
>>> from scipy.special import j0
>>> j0(1.)
0.7651976865579665
计算多点函数:
>>> import numpy as np
>>> j0(np.array([-2., 0., 4.]))
array([ 0.22389078, 1\. , -0.39714981])
绘制从-20 到 20 的函数图像。
>>> import matplotlib.pyplot as plt
>>> fig, ax = plt.subplots()
>>> x = np.linspace(-20., 20., 1000)
>>> y = j0(x)
>>> ax.plot(x, y)
>>> plt.show()
scipy.special.j1
原文:
docs.scipy.org/doc/scipy-1.12.0/reference/generated/scipy.special.j1.html#scipy.special.j1
scipy.special.j1(x, out=None) = <ufunc 'j1'>
一阶贝塞尔函数的示例。
参数:
xarray_like
参数(浮点数)。
outndarray,可选
函数值的可选输出数组
返回:
J标量或 ndarray
在x处一阶贝塞尔函数的值。
参见
jv
一阶贝塞尔函数
spherical_jn
球形贝塞尔函数。
注释
该域被分为区间[0, 8]和(8, 无穷大)。在第一个区间中使用 24 项切比雪夫展开式。在第二个区间中,采用两个 5/5 次有理函数的渐近三角表示法。
此函数是 Cephes [1]例程j1的包装器。请不要将其与球形贝塞尔函数混淆(请参见spherical_jn)。
参考文献
[1]
Cephes 数学函数库,www.netlib.org/cephes/
示例
在一个点计算函数:
>>> from scipy.special import j1
>>> j1(1.)
0.44005058574493355
在多个点计算函数:
>>> import numpy as np
>>> j1(np.array([-2., 0., 4.]))
array([-0.57672481, 0\. , -0.06604333])
绘制从-20 到 20 的函数图。
>>> import matplotlib.pyplot as plt
>>> fig, ax = plt.subplots()
>>> x = np.linspace(-20., 20., 1000)
>>> y = j1(x)
>>> ax.plot(x, y)
>>> plt.show()
scipy.special.y0
原文:
docs.scipy.org/doc/scipy-1.12.0/reference/generated/scipy.special.y0.html#scipy.special.y0
scipy.special.y0(x, out=None) = <ufunc 'y0'>
零阶第二类贝塞尔函数。
参数:
xarray_like
参数(浮点数)。
outndarray,可选
可选的输出数组用于函数结果
返回:
Y标量或 ndarray
零阶第二类贝塞尔函数在x处的值。
另请参见
j0
零阶第一类贝塞尔函数
yv
第一类贝塞尔函数
注意事项
域被分为区间[0, 5]和(5, 无穷大)。在第一个区间中,使用有理逼近(R(x))计算,
[Y_0(x) = R(x) + \frac{2 \log(x) J_0(x)}{\pi},]
其中(J_0)是零阶第一类贝塞尔函数。
在第二个区间中,使用 6/6 和 7/7 阶有理函数的 Hankel 渐近展开。
此函数是 Cephes 库[1]中y0的封装。
参考文献
[1]
Cephes 数学函数库,www.netlib.org/cephes/
示例
计算一个点上的函数:
>>> from scipy.special import y0
>>> y0(1.)
0.08825696421567697
在几个点上计算:
>>> import numpy as np
>>> y0(np.array([0.5, 2., 3.]))
array([-0.44451873, 0.51037567, 0.37685001])
从 0 到 10 绘制函数。
>>> import matplotlib.pyplot as plt
>>> fig, ax = plt.subplots()
>>> x = np.linspace(0., 10., 1000)
>>> y = y0(x)
>>> ax.plot(x, y)
>>> plt.show()
scipy.special.y1
原文:
docs.scipy.org/doc/scipy-1.12.0/reference/generated/scipy.special.y1.html#scipy.special.y1
scipy.special.y1(x, out=None) = <ufunc 'y1'>
第二类贝塞尔函数,阶数为 1。
参数:
xarray_like
参数(浮点数)。
outndarray,可选
函数结果的可选输出数组
返回:
Y标量或 ndarray
在x处阶数为 1 的第二类贝塞尔函数值。
另请参阅
j1
第一类贝塞尔函数,阶数为 1
yn
第二类贝塞尔函数
yv
第二类贝塞尔函数
注意事项
域被分成区间[0, 8]和(8, 无穷大)。在第一个区间使用 25 项切比雪夫展开,计算(J_1)(第一类贝塞尔函数)是必需的。在第二个区间,使用两个 5/5 次有理函数的渐近三角函数表示。
此函数是 Cephes [1]例程的包装 y1。
参考资料
[1]
Cephes 数学函数库,www.netlib.org/cephes/
示例
在一个点计算函数:
>>> from scipy.special import y1
>>> y1(1.)
-0.7812128213002888
在多个点计算:
>>> import numpy as np
>>> y1(np.array([0.5, 2., 3.]))
array([-1.47147239, -0.10703243, 0.32467442])
绘制从 0 到 10 的函数图像。
>>> import matplotlib.pyplot as plt
>>> fig, ax = plt.subplots()
>>> x = np.linspace(0., 10., 1000)
>>> y = y1(x)
>>> ax.plot(x, y)
>>> plt.show()
scipy.special.i0
原文链接:
docs.scipy.org/doc/scipy-1.12.0/reference/generated/scipy.special.i0.html#scipy.special.i0
scipy.special.i0(x, out=None) = <ufunc 'i0'>
零阶修正贝塞尔函数。
定义如下,
[I_0(x) = \sum_{k=0}^\infty \frac{(x²/4)^k}{(k!)²} = J_0(\imath x),]
其中 (J_0) 是零阶第一类贝塞尔函数。
参数:
x:array_like
参数(浮点数)
out:ndarray,可选
可选的输出数组用于函数值
返回:
I:标量或者 ndarray
在x处的零阶修正贝塞尔函数的值。
请参见
iv
任意阶数的修正贝塞尔函数
i0e
指数尺度的零阶修正贝塞尔函数
注意事项
区间被分为两个部分[0, 8]和(8, 无穷大)。在每个区间中使用切比雪夫多项式展开。
此函数是 Cephes 的[1]例程i0的包装器。
参考文献
[1]
Cephes 数学函数库,www.netlib.org/cephes/
示例
在一个点计算函数:
>>> from scipy.special import i0
>>> i0(1.)
1.2660658777520082
在几个点计算:
>>> import numpy as np
>>> i0(np.array([-2., 0., 3.5]))
array([2.2795853 , 1\. , 7.37820343])
在区间 -10 到 10 绘制函数。
>>> import matplotlib.pyplot as plt
>>> fig, ax = plt.subplots()
>>> x = np.linspace(-10., 10., 1000)
>>> y = i0(x)
>>> ax.plot(x, y)
>>> plt.show()
scipy.special.i0e
原文:
docs.scipy.org/doc/scipy-1.12.0/reference/generated/scipy.special.i0e.html#scipy.special.i0e
scipy.special.i0e(x, out=None) = <ufunc 'i0e'>
阶数为 0 的指数尺度修改贝塞尔函数。
定义如下:
i0e(x) = exp(-abs(x)) * i0(x).
参数:
xarray_like
参数(浮点数)
outndarray,可选
可选输出数组的函数值
返回:
Iscalar or ndarray
x 的指数尺度修改贝塞尔函数阶数为 0 的值。
另请参见
第一类修正贝塞尔函数
阶数为 0 的修正贝塞尔函数
注意事项
将范围分为两个区间 [0, 8] 和 (8, 无穷大)。在每个区间中使用切比雪夫多项式展开。使用的多项式展开与i0中的相同,但没有乘以主导指数因子。
此函数是 Cephes [1] 例程 i0e 的包装器。对于大的参数 x,i0 很快会溢出。
参考文献
Cephes 数学函数库,www.netlib.org/cephes/
示例
在以下示例中,i0 返回无穷大,而i0e 仍然返回一个有限数。
>>> from scipy.special import i0, i0e
>>> i0(1000.), i0e(1000.)
(inf, 0.012617240455891257)
通过提供 NumPy 数组或列表的 x 在几个点计算函数:
>>> import numpy as np
>>> i0e(np.array([-2., 0., 3.]))
array([0.30850832, 1\. , 0.24300035])
在-10 到 10 之间绘制函数。
>>> import matplotlib.pyplot as plt
>>> fig, ax = plt.subplots()
>>> x = np.linspace(-10., 10., 1000)
>>> y = i0e(x)
>>> ax.plot(x, y)
>>> plt.show()
scipy.special.i1
原文链接:
docs.scipy.org/doc/scipy-1.12.0/reference/generated/scipy.special.i1.html#scipy.special.i1
scipy.special.i1(x, out=None) = <ufunc 'i1'>
修改的一阶贝塞尔函数。
定义为,
[I_1(x) = \frac{1}{2}x \sum_{k=0}^\infty \frac{(x²/4)^k}{k! (k + 1)!} = -\imath J_1(\imath x),]
其中(J_1)是一阶贝塞尔函数的类型 1。
参数:
xarray_like
参数(浮点数)
outndarray,可选
函数值的可选输出数组
返回:
I标量或 ndarray
在x处的修改贝塞尔函数的值。
参见
iv
修改的一阶贝塞尔函数
i1e
指数缩放的修改的一阶贝塞尔函数
注释
范围被分为两个区间[0, 8]和(8, 无穷大)。在每个区间中使用切比雪夫多项式展开。
此函数是 Cephes 库[1]中i1例程的封装i1。
参考文献
[1]
Cephes 数学函数库,www.netlib.org/cephes/
示例
计算一个点处的函数:
>>> from scipy.special import i1
>>> i1(1.)
0.5651591039924851
在多个点计算函数:
>>> import numpy as np
>>> i1(np.array([-2., 0., 6.]))
array([-1.59063685, 0\. , 61.34193678])
绘制函数在-10 到 10 之间的图像。
>>> import matplotlib.pyplot as plt
>>> fig, ax = plt.subplots()
>>> x = np.linspace(-10., 10., 1000)
>>> y = i1(x)
>>> ax.plot(x, y)
>>> plt.show()
scipy.special.i1e
原文链接:
docs.scipy.org/doc/scipy-1.12.0/reference/generated/scipy.special.i1e.html#scipy.special.i1e
scipy.special.i1e(x, out=None) = <ufunc 'i1e'>
指数级别修正贝塞尔函数的一阶函数。
定义如下:
i1e(x) = exp(-abs(x)) * i1(x)
参数:
x:array_like
参数(浮点数)
out:ndarray,可选
函数值的可选输出数组
返回:
I:标量或者 ndarray
指数级别修正贝塞尔函数的一阶函数在x处的值。
另请参见
iv
第一类修改贝塞尔函数
i1
一阶修改贝塞尔函数
注意
范围分为两个区间:[0, 8]和(8, 无穷大)。在每个区间中使用切比雪夫多项式展开。所使用的多项式展开与i1中的相同,但不会乘以主导的指数因子。
该函数是 Cephes 库[1]中的i1e例程的包装器。对于较大的参数x,i1会快速溢出,因此i1e非常有用。
参考资料
[1]
Cephes 数学函数库,www.netlib.org/cephes/
示例
在以下示例中,i1返回无穷大,而i1e仍然返回有限数值。
>>> from scipy.special import i1, i1e
>>> i1(1000.), i1e(1000.)
(inf, 0.01261093025692863)
通过提供 NumPy 数组或列表来计算函数在多个点的值:
>>> import numpy as np
>>> i1e(np.array([-2., 0., 6.]))
array([-0.21526929, 0\. , 0.15205146])
在-10 到 10 之间绘制函数图像。
>>> import matplotlib.pyplot as plt
>>> fig, ax = plt.subplots()
>>> x = np.linspace(-10., 10., 1000)
>>> y = i1e(x)
>>> ax.plot(x, y)
>>> plt.show()
scipy.special.k0
原文:
docs.scipy.org/doc/scipy-1.12.0/reference/generated/scipy.special.k0.html#scipy.special.k0
scipy.special.k0(x, out=None) = <ufunc 'k0'>
第二类阶数为 0 的修正贝塞尔函数 (K_0)。
此函数有时也被称为零阶第三类修正贝塞尔函数。
参数:
x 数组样式
参数(浮点数)。
out ndarray,可选
可选输出数组用于函数值。
返回值:
K 标量或者 ndarray
在 x 处的修正贝塞尔函数 (K_0) 的值。
另请参阅
kv
修改后的第二类贝塞尔函数的任意阶数。
k0e
指数尺度的第二类修正贝塞尔函数
注释
该范围被分为两个区间 [0, 2] 和 (2, 无穷)。在每个区间内使用切比雪夫多项式展开。
此函数是 Cephes [1] 库中 k0 程序的包装器。
参考文献
[1]
Cephes 数学函数库,www.netlib.org/cephes/
示例
计算一个点上的函数值:
>>> from scipy.special import k0
>>> k0(1.)
0.42102443824070823
计算几个点上的函数值:
>>> import numpy as np
>>> k0(np.array([0.5, 2., 3.]))
array([0.92441907, 0.11389387, 0.0347395 ])
绘制从 0 到 10 的函数图像。
>>> import matplotlib.pyplot as plt
>>> fig, ax = plt.subplots()
>>> x = np.linspace(0., 10., 1000)
>>> y = k0(x)
>>> ax.plot(x, y)
>>> plt.show()
scipy.special.k0e
原文链接:
docs.scipy.org/doc/scipy-1.12.0/reference/generated/scipy.special.k0e.html#scipy.special.k0e
scipy.special.k0e(x, out=None) = <ufunc 'k0e'>
指数缩放修正贝塞尔函数阶数为 0
定义如下:
k0e(x) = exp(x) * k0(x).
参数:
x类似数组
参数(浮点数)
outndarray,可选
函数值的可选输出数组
返回:
K标量或 ndarray
指数缩放修正贝塞尔函数阶数为 0 在x处的值。
另请参见
kv
任意阶数第二类修正贝塞尔函数
k0
第二类修正贝塞尔函数
注意事项
范围被分为两个区间[0, 2]和(2, 无穷大)。在每个区间中使用切比雪夫多项式展开。
此函数是 Cephes [1]例程k0e的包装器。对于大参数,k0e非常有用:对于这些参数,k0容易下溢。
参考文献
[1]
Cephes 数学函数库,www.netlib.org/cephes/
示例
在以下示例中,k0返回 0,而k0e仍然返回一个有用的有限数:
>>> from scipy.special import k0, k0e
>>> k0(1000.), k0e(1000)
(0., 0.03962832160075422)
通过提供一个 NumPy 数组或列表来计算x的函数在多个点上的值:
>>> import numpy as np
>>> k0e(np.array([0.5, 2., 3.]))
array([1.52410939, 0.84156822, 0.6977616 ])
绘制从 0 到 10 的函数图像。
>>> import matplotlib.pyplot as plt
>>> fig, ax = plt.subplots()
>>> x = np.linspace(0., 10., 1000)
>>> y = k0e(x)
>>> ax.plot(x, y)
>>> plt.show()
scipy.special.k1
原文链接:
docs.scipy.org/doc/scipy-1.12.0/reference/generated/scipy.special.k1.html#scipy.special.k1
scipy.special.k1(x, out=None) = <ufunc 'k1'>
修正贝塞尔函数的第二类,阶数为 1,(K_1(x))。
参数:
x 数组样式
参数(浮点数)
out 数组,可选
可选的输出数组,包含函数值
返回值:
K 标量或者数组
计算修正贝塞尔函数 K 的值,其阶数为 1,x 变量。
另见
kv
任意阶数的修正贝塞尔函数的第二类
k1e
指数尺度的修正贝塞尔函数 K,其阶数为 1
注意事项
范围分为两个区间 [0, 2] 和 (2, 无穷大)。在每个区间内采用切比雪夫多项式展开。
此函数是 Cephes [1] 中的 k1 程序包装器。
参考文献
[1]
Cephes 数学函数库, www.netlib.org/cephes/
示例
计算单个点的函数值:
>>> from scipy.special import k1
>>> k1(1.)
0.6019072301972346
计算多个点的函数值:
>>> import numpy as np
>>> k1(np.array([0.5, 2., 3.]))
array([1.65644112, 0.13986588, 0.04015643])
绘制函数从 0 到 10 的图表。
>>> import matplotlib.pyplot as plt
>>> fig, ax = plt.subplots()
>>> x = np.linspace(0., 10., 1000)
>>> y = k1(x)
>>> ax.plot(x, y)
>>> plt.show()
scipy.special.k1e
原文链接:
docs.scipy.org/doc/scipy-1.12.0/reference/generated/scipy.special.k1e.html#scipy.special.k1e
scipy.special.k1e(x, out=None) = <ufunc 'k1e'>
指数尺度修正的贝塞尔函数 K 一阶
定义如下:
k1e(x) = exp(x) * k1(x)
参数:
xarray_like
参数(浮点数)
outndarray, 可选参数
可选的输出数组,用于函数值
返回:
K标量或 ndarray
指数尺度修正的贝塞尔函数 K 一阶在 x 处的值。
另见
kv
任意阶数的第二类修正贝塞尔函数
k1
一阶修正贝塞尔函数 K
注意事项
范围被分成两个区间 [0, 2] 和 (2, 无穷大)。每个区间使用切比雪夫多项式展开。
此函数是 Cephes [1] 的 k1e 程序包装。
参考文献
[1]
Cephes 数学函数库,www.netlib.org/cephes/
示例
在下面的例子中,k1 返回 0,而k1e 仍然返回一个有用的浮点数。
>>> from scipy.special import k1, k1e
>>> k1(1000.), k1e(1000.)
(0., 0.03964813081296021)
通过提供一个 NumPy 数组或列表来在多个点计算函数的值:
>>> import numpy as np
>>> k1e(np.array([0.5, 2., 3.]))
array([2.73100971, 1.03347685, 0.80656348])
绘制函数从 0 到 10。
>>> import matplotlib.pyplot as plt
>>> fig, ax = plt.subplots()
>>> x = np.linspace(0., 10., 1000)
>>> y = k1e(x)
>>> ax.plot(x, y)
>>> plt.show()
scipy.special.itj0y0
原文:
docs.scipy.org/doc/scipy-1.12.0/reference/generated/scipy.special.itj0y0.html#scipy.special.itj0y0
scipy.special.itj0y0(x, out=None) = <ufunc 'itj0y0'>
一阶贝塞尔函数积分。
计算积分
[\begin{split}\int_0^x J_0(t) dt \ \int_0^x Y_0(t) dt.\end{split}]
关于 (J_0) 和 (Y_0) 的更多信息请参见j0 和 y0。
参数:
xarray_like
评估积分的值点。
outndarray 或者 tuple,可选
函数结果的可选输出数组。
返回:
ij0标量或者 ndarray
j0的积分
iy0标量或者 ndarray
y0的积分
参考文献
[1]
S. Zhang 和 J.M. Jin,“特殊函数的计算”,Wiley 1996
示例
在一个点评估函数。
>>> from scipy.special import itj0y0
>>> int_j, int_y = itj0y0(1.)
>>> int_j, int_y
(0.9197304100897596, -0.637069376607422)
在几个点评估函数。
>>> import numpy as np
>>> points = np.array([0., 1.5, 3.])
>>> int_j, int_y = itj0y0(points)
>>> int_j, int_y
(array([0\. , 1.24144951, 1.38756725]),
array([ 0\. , -0.51175903, 0.19765826]))
从 0 到 10 绘制函数。
>>> import matplotlib.pyplot as plt
>>> fig, ax = plt.subplots()
>>> x = np.linspace(0., 10., 1000)
>>> int_j, int_y = itj0y0(x)
>>> ax.plot(x, int_j, label="$\int_0^x J_0(t)\,dt$")
>>> ax.plot(x, int_y, label="$\int_0^x Y_0(t)\,dt$")
>>> ax.legend()
>>> plt.show()
scipy.special.it2j0y0
原文:
docs.scipy.org/doc/scipy-1.12.0/reference/generated/scipy.special.it2j0y0.html#scipy.special.it2j0y0
scipy.special.it2j0y0(x, out=None) = <ufunc 'it2j0y0'>
与第一类零阶贝塞尔函数相关的积分。
计算积分
[\begin{split}\int_0^x \frac{1 - J_0(t)}{t} dt \ \int_x^\infty \frac{Y_0(t)}{t} dt.\end{split}]
更多关于 (J_0) 和 (Y_0) 的信息,请参见 j0 和 y0。
参数:
x:array_like
评估积分的值。
out:ndarrays 元组,可选
可选输出数组用于函数结果。
返回:
ij0:标量或 ndarray
j0 的积分
iy0:标量或 ndarray
y0 的积分
参考资料
[1]
S. Zhang 和 J.M. Jin,“计算特殊函数”,Wiley 1996
示例
在一个点上评估函数。
>>> from scipy.special import it2j0y0
>>> int_j, int_y = it2j0y0(1.)
>>> int_j, int_y
(0.12116524699506871, 0.39527290169929336)
在几个点上评估函数。
>>> import numpy as np
>>> points = np.array([0.5, 1.5, 3.])
>>> int_j, int_y = it2j0y0(points)
>>> int_j, int_y
(array([0.03100699, 0.26227724, 0.85614669]),
array([ 0.26968854, 0.29769696, -0.02987272]))
绘制从 0 到 10 的函数。
>>> import matplotlib.pyplot as plt
>>> fig, ax = plt.subplots()
>>> x = np.linspace(0., 10., 1000)
>>> int_j, int_y = it2j0y0(x)
>>> ax.plot(x, int_j, label=r"$\int_0^x \frac{1-J_0(t)}{t}\,dt$")
>>> ax.plot(x, int_y, label=r"$\int_x^{\infty} \frac{Y_0(t)}{t}\,dt$")
>>> ax.legend()
>>> ax.set_ylim(-2.5, 2.5)
>>> plt.show()
scipy.special.iti0k0
原文链接:
docs.scipy.org/doc/scipy-1.12.0/reference/generated/scipy.special.iti0k0.html#scipy.special.iti0k0
scipy.special.iti0k0(x, out=None) = <ufunc 'iti0k0'>
修改 Bessel 函数零阶的积分。
计算积分
[\begin{split}\int_0^x I_0(t) dt \ \int_0^x K_0(t) dt.\end{split}]
参数:
xarray_like
评估积分的值。
outndarrays 的元组,可选
用于函数结果的可选输出数组。
返回:
ii0标量或 ndarray
i0的积分
ik0标量或 ndarray
k0的积分
参考资料
[1]
S. Zhang 和 J.M. Jin,“特殊函数的计算”,Wiley 1996
示例
在一个点评估函数。
>>> from scipy.special import iti0k0
>>> int_i, int_k = iti0k0(1.)
>>> int_i, int_k
(1.0865210970235892, 1.2425098486237771)
在几个点评估函数。
>>> import numpy as np
>>> points = np.array([0., 1.5, 3.])
>>> int_i, int_k = iti0k0(points)
>>> int_i, int_k
(array([0\. , 1.80606937, 6.16096149]),
array([0\. , 1.39458246, 1.53994809]))
从 0 到 5 绘制函数。
>>> import matplotlib.pyplot as plt
>>> fig, ax = plt.subplots()
>>> x = np.linspace(0., 5., 1000)
>>> int_i, int_k = iti0k0(x)
>>> ax.plot(x, int_i, label="$\int_0^x I_0(t)\,dt$")
>>> ax.plot(x, int_k, label="$\int_0^x K_0(t)\,dt$")
>>> ax.legend()
>>> plt.show()
scipy.special.it2i0k0
原文:
docs.scipy.org/doc/scipy-1.12.0/reference/generated/scipy.special.it2i0k0.html#scipy.special.it2i0k0
scipy.special.it2i0k0(x, out=None) = <ufunc 'it2i0k0'>
与修改的贝塞尔函数的积分有关。
计算积分
[\begin{split}\int_0^x \frac{I_0(t) - 1}{t} dt \ \int_x^\infty \frac{K_0(t)}{t} dt.\end{split}]
参数:
x类似数组
评估积分的值。
outndarrays 的元组,可选的
函数结果的可选输出数组。
返回:
ii0标量或 ndarray
对于i0的积分
ik0标量或 ndarray
对于k0的积分
参考文献
[1]
S. Zhang 和 J.M. Jin,《特殊函数的计算》,Wiley 1996
示例
在一个点评估函数。
>>> from scipy.special import it2i0k0
>>> int_i, int_k = it2i0k0(1.)
>>> int_i, int_k
(0.12897944249456852, 0.2085182909001295)
在几个点评估函数。
>>> import numpy as np
>>> points = np.array([0.5, 1.5, 3.])
>>> int_i, int_k = it2i0k0(points)
>>> int_i, int_k
(array([0.03149527, 0.30187149, 1.50012461]),
array([0.66575102, 0.0823715 , 0.00823631]))
绘制从 0 到 5 的函数。
>>> import matplotlib.pyplot as plt
>>> fig, ax = plt.subplots()
>>> x = np.linspace(0., 5., 1000)
>>> int_i, int_k = it2i0k0(x)
>>> ax.plot(x, int_i, label=r"$\int_0^x \frac{I_0(t)-1}{t}\,dt$")
>>> ax.plot(x, int_k, label=r"$\int_x^{\infty} \frac{K_0(t)}{t}\,dt$")
>>> ax.legend()
>>> ax.set_ylim(0, 10)
>>> plt.show()