{ } Raw JSON

bundles / scipy latest / scipy / special / _basic / y1_zeros

function

scipy.special._basic:y1_zeros

source: /scipy/special/_basic.py :648

Signature

def   y1_zeros ( nt complex = False )

Summary

Compute nt zeros of Bessel function Y1(z), and derivative at each zero.

Extended Summary

The derivatives are given by Y1'(z1) = Y0(z1) at each zero z1.

Parameters

nt : int

Number of zeros to return

complex : bool, default False

Set to False to return only the real zeros; set to True to return only the complex zeros with negative real part and positive imaginary part. Note that the complex conjugates of the latter are also zeros of the function, but are not returned by this routine.

Returns

z1n : ndarray

Location of nth zero of Y1(z)

y1pz1n : ndarray

Value of derivative Y1'(z1) for nth zero

Examples

Compute the first 4 real roots and the derivatives at the roots of :math:`Y_1`:
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}")
Extract the real parts:
realzeros = zeros.real
realzeros
Plot :math:`Y_1` and the first four computed roots.
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()
fig-25a1256668143255.png
Compute the first 4 complex roots and the derivatives at the roots of :math:`Y_1` by setting ``complex=True``:
y1_zeros(4, True)

Aliases

  • scipy.special.y1_zeros