Find the roots to the following transcendental equation?

342 Views Asked by At

How can I most easily find the roots to the following transcendental equation?

$$ f(K)=K \cot(K L)+\sqrt{2V-K^2}\coth\Big( \sqrt{2V-k^2}\frac{a}{2} \Big) \tag{1} $$

Where $L,V$ and $a$ are constants. I.e. I'm looking for values of $K$ where $f(K)=0$.

I was thinking about using Newton-Raphson's Method, but then I need a good initial guess $K_0$. I could possible find a good starting point by plotting the function $f(K)$.

This is how how the plot of $f(K)$ looks like for $L=\pi$, $V=10$ and $a=\pi /2$ Trancendental function

So perhaps $0.9$ would be a good initial guess to find the first root and $1.8$ for the second root of the function. The problem is that if I change the value of $L,V$ or $a$ I need to plot this figure every time and look for new initial guesses.

Is there a recipe or someway that I can have my initial guess $K_0$ as a periodic function of my constants $L,V,a$ and a parameter $n$, where $n$ would indicate if it is the first second or third root and so on?

I'm programming in Mathematica and here is my code:

v = 10;
a = Pi/2;
L = Pi;
K0 = 0.9; (* Initial guess *)
FindRoot[K Cot[K L] == -Sqrt[2 v - K^2] g[(-1)^n, 
    Sqrt[2 v - K^2] (a/2)], {K, K0}]