# Problem in computing residue

I need to integrate the following function $F(y)$ of complex variable $y$ over the unit circle $|y|=1$:

F[y_]:=-(((-1 + q) (-1 + t) (-1 + q^2 t) (-q t + Sqrt[q/y]) (-1 +
q t Sqrt[q/y]) (q t - y) (-1 + y)^2 (-1 + q t y) (-q t +
y Sqrt[q/y]) (-q - y + 2 y Sqrt[q/y]) (-1 - q y +
2 y Sqrt[q/y]) (-1 + q t y Sqrt[q/y]))/(2 (1 + q) (q - t) (-1 +
q t) (-q + Sqrt[q/y]) (-t + Sqrt[q/y]) (-1 +
q  Sqrt[q/y]) (-1 + t Sqrt[q/y]) (q - y) y^2 (-t + y) (-1 +
q y) (-1 + t y) (-q + y Sqrt[q/y]) (-t + y Sqrt[q/y]) (-1 +
q y Sqrt[q/y]) (-1 + t y  Sqrt[q/y])))


Here $q,t$ are also complex numbers with modulus $<1$. The idea is to use residue theorem. To that end, I compute the points of singularity to be y=q/t^2,q^3,t^2 q,q,t,t^2/q,0.

Using Residue, I get residues for all points except y=0. For Residue[F[y],{y,0}], the output comes same as the input. I think the trouble there is because of the terms like Sqrt[q/y]. However doing the series expansion Series[F[y],{y,0,2}] around the point y=0 to order 2, I get

(-1 + q) (-1 + t) (-1 + q^2 t)/2 (1 + q) (q - t) (-1 + q t)


as the coefficient of the term 1/y. I am confused on why Residue did not give me this output. From Hugh's comment below, I think I see that y=0 is a branch point, so one needs to change the path of integration. However, I do not know how to tell mathematica to do this. Any input to that direction would be appreciated. Thank you in advance.

• Welcome to Mathematica.StackExchange! It is a good habit here to provide copyable Mathematica so that other users can copy and experiment with it. Commented Feb 25, 2018 at 21:16
• I think that the square root means that you have a branch cut starting at y = 0. There is thus a line of discontinuity radiating out from zero. You can't integrate by just looking at residues. You have to change your contour of integration to exclude the branch cut. There is no residue at y = 0. Are you clear on such matters?
– Hugh
Commented Feb 25, 2018 at 21:50
• Thank you for the valuable comment. I had not thought about the branch cut; I am doing this now. Commented Feb 25, 2018 at 22:02
• You said there is no residue at $y=0$. However, doing the Series expansion around the point $0$, I get $\frac{(-1 + q) (-1 + t) (-1 + q^2 t)}{2 (1 + q) (q - t) (-1 + q t)}$ as the coefficient of the term $1/y$. Am I doing this wrong? Sadly, I don't seem to figure out how to tell mathematica to integrate the function, given that there is a branch point at $y=0$. Could you help me with that? Commented Feb 26, 2018 at 14:24
• The input should be provided in cut-and-pastable form. Commented Feb 26, 2018 at 16:51

This is not an answer but just an extended comment to show how you can explore a function of a complex variable. Here is your function.

F[y_] := -(((-1 + q) (-1 + t) (-1 + q^2 t) (-q t + Sqrt[q/y]) (-1 +
q t Sqrt[q/y]) (q t - y) (-1 + y)^2 (-1 + q t y) (-q t +
y Sqrt[q/y]) (-q - y + 2 y Sqrt[q/y]) (-1 - q y +
2 y Sqrt[q/y]) (-1 + q t y Sqrt[q/y]))/(2 (1 + q) (q -
t) (-1 + q t) (-q + Sqrt[q/y]) (-t + Sqrt[q/y]) (-1 +
q Sqrt[q/y]) (-1 + t Sqrt[q/y]) (q - y) y^2 (-t + y) (-1 +
q y) (-1 + t y) (-q + y Sqrt[q/y]) (-t + y Sqrt[q/y]) (-1 +
q y Sqrt[q/y]) (-1 + t y Sqrt[q/y])))


I start by giving values to q and t with your constraints and then solve to find the roots of the denominator (the poles). I prefer to work with complex variable z because I am traditional.

    f = F[z] /. {t -> (1 + I) 2, q -> (1 - I)/2};
den = Denominator[f // Together];
rts = Solve[den == 0, z]


This gives me

(* {{z -> -(1/4) - I/4}, {z -> -(1/16) - I/16}, {z -> 1/8 - I/8}, {z ->
1/4 - I/4}, {z -> 1/2 - I/2}, {z -> 1 + I}, {z -> 2 + 2 I}, {z ->
4 + 4 I}}  *)


A plot of the position of the roots is

Graphics[{Red, PointSize[0.01], Point[ReIm[z]] /. rts},
PlotRange -> All, Axes -> True]


Quite a scatter.

I now plot the modulus of the function and put a pin in at each pole.

h = 2;
Show[
Graphics3D[{
Line[{Flatten@{ReIm[z], 0}, Flatten@{ReIm[z], 2 h}}] /. rts,
Red, PointSize[0.02], Point[Flatten@{ReIm[z], 2 h}] /. rts},
Axes -> True],
Plot3D[Evaluate[Abs[f /. z -> x + I y]], {x, -6, 6}, {y, -5, 5},
PlotRange -> {All, All, {0, h}}, PlotPoints -> {50, 50}]
]


Doing the same for the argument of the function

h = 2;
Show[
Graphics3D[{
Line[{Flatten@{ReIm[z], 0}, Flatten@{ReIm[z], 2 h}}] /. rts,
Red, PointSize[0.02], Point[Flatten@{ReIm[z], 2 h}] /. rts},
Axes -> True],
Plot3D[Evaluate[Arg[f /. z -> x + I y]], {x, -6, 6}, {y, -5, 5},
PlotRange -> All, PlotPoints -> {50, 50}]


You can see that there are surfaces which are discontinuous. One point for investigation is a peak at about -2 + 2 I which does not have a pin. Why? Also I should be cautions about saying the roots of the denominator are poles. This is not a rational polynomial so these roots need checking. You could also look at roots of the numerator.

Overall you have something to explore. Further embellishments could be to make a dynamic plot where you could vary the location of t and q.

Have a good exploration. Hope that helps.