I need to find the first $n$ roots of the transcendental equation
\begin{equation} F(k) = J_m'(kr)Y_m'(k)-J'_m(k)Y'_m(kr) \end{equation}
for integer values of $m$ and any $r \in [0,1)$ where $J'$ and $Y'$ are derivatives of Bessel function of first and second kind. This is a (standard?) problem encountered in eigenfunction expansions for annular cylinders. Using the recurrence properties of the Bessel functions we can rewrite this equation without the derivatives, as shown in the code below.
To find the roots I'm using standard root finding algorithm fsolve
in python which requires initial guesses. I have gathered that a decent good guess for the first root is going to be $m$, the order of the Bessel function we want to find roots for. From the plot I also gather that the roots are somewhat evenly spaced so that after I find the second root I can find the other guesses.
The spacing of the roots is nonlinear in $r$. Im sure there is a robust method out there that can help with the root guessing, or maybe there is a better way to go about doing this.
from scipy.special import jn, yn
from scipy.optimize import fsolve
import matplotlib.pyplot as plt
import numpy as np
from scipy.signal import argrelextrema
# Recurrence relations to relate derivative of bessels to normal bessel
Jp = lambda m,x : 0.5*(jn(m-1,x)-jn(m+1,x))
Yp = lambda m,x : 0.5*(yn(m-1,x)-yn(m+1,x))
# r is the ratio of inner/ outer radii and is [0,1)
F = lambda k,m,r : Jp(m,k*r)*Yp(m,k)-Jp(m,k)*Yp(m,k*r)
plt.figure()
k_array = np.linspace(0.1,80,5000)
m = 5
r = 0.9
F_array = F(k_array,m,r)
guesses = np.asarray([m,m/(1-r)])
roots = fsolve(F,guesses,args=(m,r,))
#iroots = argrelextrema(F_array**2,np.less)[0]
#print iroots
plt.plot(k_array,F_array)
#plt.plot(k_array[iroots],np.zeros(len(iroots)),"ro")
plt.plot(roots,np.zeros(len(roots)),"ro")