为何Scipy贝塞尔函数求根不返回x=0处的根?
scipy.special.jn_zeros(1,2) Doesn't Return x=0 as a Root? Let's break this down clearly:
First off, scipy.special.jn_zeros is explicitly designed to return only positive real zeros of the nth-order Bessel function of the first kind. That's the core reason you're not seeing x=0 in your output.
What's the full zero set for J₁(x)?
The first-order Bessel function J₁(x) has zeros at:
- x=0 (since for all n ≥ 1, Jₙ(0) = 0)
- ±3.83170597, ±7.01558667, ±10.17346814, and so on
But jn_zeros(n, nt) returns the first nt positive zeros by definition. So when you call jn_zeros(1,2), you get the first two positive zeros: [3.83170597, 7.01558667]—which matches the actual output you're seeing.
Why do zeros appear symmetric along the x-axis?
This ties to the symmetry property of Bessel functions:
- For odd n (like n=1 here): Jₙ(-x) = (-1)ⁿJₙ(x) = -Jₙ(x). So if x is a zero, -x will also be a zero (since J₁(-x) = -J₁(x) = 0).
- For even n: Jₙ(-x) = Jₙ(x), so zeros are symmetric around x=0 too.
The function just doesn't include negative zeros or x=0 by default.
If you need to include x=0 in your results
You can manually prepend it to the array returned by jn_zeros:
import scipy.special as sp import numpy as np # Get first 2 positive zeros of J₁ positive_zeros = sp.jn_zeros(1, 2) # Add x=0 to get the set you expected full_zeros = np.concatenate(([0.], positive_zeros)) # Output: array([0., 3.83170597, 7.01558667])
内容的提问来源于stack exchange,提问作者WolcottR

