# Searching for roots of complex function

I'm searching for the roots of a complex function of $$x$$ with parameters $$k$$ and $$q$$ \begin{align*} f(x;q,k)&= 2 i q\log(-2 ik)+i\pi-2 i\;\text{Im}\big(\log(\Gamma(1+2 i q))\big)\\ &+\log\left(\frac{\Gamma(1+i q+i qx/k)}{\Gamma(1+iq+iqx/k)}\right)+\log\left(\frac{\sqrt{1-x}-\sqrt{-1-x}}{\sqrt{1-x}+\sqrt{-x-1}}\right) \end{align*} where $$k=\sqrt{(-x+1)(-x-1)}$$, $$x$$ is complex with $$\text{Re}(x)<-1$$ and $$\text{Im}(x)>0$$ and $$q$$ is real and positive parameter. If I change the seed in FindRoot slightly, the result changes dramatically. How may I efficiently find these roots?

Code:

2 I*q*Log[-2*I*Sqrt[(-x + 1) (-x - 1)]] + I*π -  2*I*Arg[
Gamma[1 + 2*I*q]] + Log[Gamma[1 + I*q - I*q*x/Sqrt[(-x + 1) (-x - 1)]]] -
Log[Gamma[1 - I*q - I*q*x/Sqrt[(-x + 1) (-x - 1)]]] + Log[Sqrt[-x + 1] -
Sqrt[-x - 1]] - Log[Sqrt[-x + 1] + Sqrt[-x - 1]]

• Could you post some code? The function and the FindRoot?
– Öskå
Commented May 31, 2013 at 9:10
• Find the code above Commented May 31, 2013 at 19:16
• What's the actual value of q? Commented May 31, 2013 at 20:21
• You seem to have a highly oscillatory function near x == -1, for q == 0.1, 1., 10.. Try plotting it (ContourPlot[Abs[fn[x]],...]). Commented May 31, 2013 at 20:32
• You are aware that LogGamma[] is built-in? Commented Jun 1, 2013 at 4:09

one of the best way to finding the roots of complex functions is Davidenko's Method of Complex Root Search in this way you can find the exact root of complex functions by changing your equation into a differential equation. Here is a sample of this method you can use this way.

(*Davidenko's Method of Complex Root Search*)
Clear[γ]
Pm = D[P, γ];
Intv = .0045 + .0041 I;
γ = a[t] + I *b[t];
g = Re[P];
h = Im[P];
gb = Re[Pm];
ga = -Im[Pm];
Pg = (gb)^2 + (ga)^2;
tf = 20
sol = NDSolve[{a'[t] == ((-gb*g + ga*h)/Pg),
b'[t] == ((-ga*g + gb*h)/Pg), a[0] == Re[Intv],
b[0] == Im[Intv]}, {b, a}, {t, 0, tf}]
Print[Plot[Evaluate[{b[t], a[t]} /. sol], {t, 0, tf}]]
a[tf] /. sol
b[tf] /. sol


In this method P is your equation that should be equal to zero and Gamma is the variable of your equation and Intv is the initial value that you want to find the root near.

• I note that you split the equation into real and imaginary parts and solve separately. Mathematica can solve complex differential equations and thus this aspect of your approach may be unnecessary. I keep the equation complex. Are there advantages in splitting the solution procedure?
– Hugh
Commented Mar 4, 2014 at 10:10
• Can you give a good reference for this method where I can find its description?
– bcp
Commented Apr 3, 2014 at 11:21