Итак, я пытаюсь найти для собственных значений решения в связанном состоянии потенциал конечной квадратной ямы, который включает решение уравнения:
![tan(z) = \sqrt{\left ( \frac{z_{0}}{z} \right )^{2} - 1} image](https://latex.codecogs.com/gif.latex?tan(z)&space;=&space;%5Csqrt%7B%5Cleft&space;(&space;%5Cfrac%7Bz_%7B0%7D%7D%7Bz%7D&space;%5Cright&space;)%5E%7B2%7D&space;-&space;1%7D)
I was able to solve it graphically by plotting the two functions and figuring out where they intersect, then using the intersection as an initial guess in scipy.optimize.root. However, this seems like a fairly cumbersome process. From what I understand, root finding methods usually requires an initial guess and finds the local minima closest to the initial guess.
What I'm wondering is if there is a way to find all the roots or all local minima in a given range in Python without necessarily providing an initial guess. From the web searches I've done, there seems to be some methods in mathematica but in general, finding all roots within a good tolerance is impossible except for specific functions. What I'm wondering, though, is whether my equation happens to fall under those specific situations? Below is a graph of the two functions and the code I used using scipy.optimize.root:
def func(z, z0):
return np.tan(z) - np.sqrt((z0/z)**2 - 1)
#finding z0
a = 3
V0 = 3
h_bar = 1
m = 1
z0 = a*np.sqrt(2*m*V0)/h_bar
#calculating roots
res = opt.root(func, [1.4, 4.0, 6.2], args = (z0, ))
res.x
#output
array([1.38165158, 4.11759958, 6.70483966])