Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm searching for roots of complex function $$ 2\imath q \ln(-2\imath k)+\imath\pi-2\imath \Im(\ln(\Gamma(1+2\imath q)))+\ln(\frac{\Gamma(1+\imath q-\imath q x/k)}{\Gamma(1-\imath q-\imath q x/k)})+\ln(\frac{\sqrt{-x+1}-\sqrt{-x-1}}{\sqrt{-x+1}+\sqrt{-x-1}}) $$ where $k=\sqrt{(-x+1)(-x-1)}$; $x$ is complex number with $\Re(x)<-1$ and $\Im(x)>0$ and $q$ is real and positive parameter. If a change a little bit starting values of $x$ in FindRoot function, result changes extremely. Please, can you tell me how to fix the result and what is the better way to find complex roots of such equations.


2 I*q*Log[-2*I*Sqrt[(-x + 1) (-x - 1)]] + I*\[Pi] -  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]]
share|improve this question
Could you post some code? The function and the FindRoot? – Öskå May 31 '13 at 9:10
Find the code above – Valeriy May 31 '13 at 19:16
What's the actual value of q? – Simon Woods May 31 '13 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]],...]). – Michael E2 May 31 '13 at 20:32
You are aware that LogGamma[] is built-in? – J. M. Jun 1 '13 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*)
Pm = D[P, \[Gamma]];
Intv = .0045 + .0041 I;
\[Gamma] = 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.

share|improve this answer
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 Mar 4 '14 at 10:10
Can you give a good reference for this method where I can find its description? – bcp Apr 3 '14 at 11:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.