scipy.special.
y1p_zeros#
- scipy.special.y1p_zeros(nt, complex=False)[source]#
计算 Bessel 导数 Y1’(z) 的 nt 个零点,以及每个零点处的值。
这些值由在 Y1’(z1)=0 的每个 z1 处的 Y1(z1) 给出。
- 参数:
- ntint
要返回的零点数量
- complexbool, default False
设置为 False 则只返回实数零点;设置为 True 则只返回实部为负、虚部为正的复数零点。请注意,后者的复共轭也是函数的零点,但此例程不返回。
- 返回:
- z1pnndarray
Y1’(z) 的第 n 个零点的位置
- y1z1pnndarray
第 n 个零点处导数 Y1(z1) 的值
参考
[1]Zhang, Shanjie and Jin, Jianming. “Computation of Special Functions”, John Wiley and Sons, 1996, 第 5 章。 https://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.real}") ... print(f"Y1 values: {y1_values.real}") Y1' Roots: [ 3.68302 6.9415 10.1234 13.28576] Y1 values: [ 0.41673 -0.30317 0.25091 -0.21897]
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()