This is my first question here, and I feel really silly about what I'm asking, since I'm sure the answer is very simple. I hope I'm being clear and including enough code snippets! I've used Mathematica quite frequently, but I've never actually sat down to learn it properly, which is why I do a lot of things the 'wrong' way.

I'm currently using it to solve a reasonably difficult problem for a physics internship, and I was wondering if there was a simple way to obtain the poles of a certain complicated function in a certain part of the complex plane. The function in question is of the form

$$F(z) = \frac{z^6}{f(z)}$$


$$f(z) = (1 + A^2 z^2) (1 + z^4) (1 + A^2 (j^2 - h j z + z^2)) (1 + (j^2 - h j z + z^2)^2) $$

The roots are easy to find using

`Solve[(1 + A^2 z^2) (1 + z^4) (1 + A^2 (j^2 - h j z + z^2)) (1 + (j^2 - h j z + z^2)^2) == 0, u]`

However, since I'm using complex analysis to evaluate the integral of this function, I need to know the poles in the upper and lower half complex planes, and on the real line ($h,j$ and $A$ are real variables). I could go through the resulting $12$ poles ($6$ are trivial, the others depend on the interplay between the parameters) and pick out those that fall on the upper and lower half planes, but it's painful and I was hoping that Mathematica had a command for this.

I tried stuff like (with one of the poles included inside)

`Assuming[{Element[h | j | A, Reals]}, Im[ComplexExpand[1/2 (h j + Sqrt[-4 I - 4 j^2 + h^2 j^2])]]]`

but I still get results that include a pesky Arg in them.

`Im[(h j)/2 + 
   1/2 (16 + (-4 j^2 + h^2 j^2)^2)^(1/4)
     Cos[1/2 Arg[-4 I - 4 j^2 + h^2 j^2]]] + 
 1/2 Re[(16 + (-4 j^2 + h^2 j^2)^2)^(1/4)
     Sin[1/2 Arg[-4 I - 4 j^2 + h^2 j^2]]]`

I then heard of this function which works nicely:

 TransferFunctionModel[{{z^6/((1 + A^2 z^2) (1 + z^4) (1 + A^2 (j^2 - h j z + z^2)) (1 + (j^2 - h j x + z^2)^2))}}, z]]`

Now, I see that a possible option in the function TransferFunctionPoles[] is to specify a region in the complex plane, and I was hoping that this could help me. However, when I attempt:

`TransferFunctionPoles[ TransferFunctionModel[{{z^6/((1 + A^2 z^2) (1 + z^4) (1 + A^2 (j^2 - h j z + z^2)) (1 + (j^2 - h j z + z^2)^2))}}, z], {{-\[Infinity], [Infinity]}, {0, \[Infinity]}}]`

I get the following (cryptic!) error:

`TransferFunctionPoles::invreg: -- Message text not found --`

Are infinite regions not allowed? Or is there something else I'm not doing right and should regions of the complex plane be defined differently?

I went through the documentation and didn't find any examples of infinite regions. Would anyone have any ideas of how I could extract just the poles with positive real parts "quickly" and provide conditions on the parameters for when they lie in one half or the other of the plane?

  • $\begingroup$ Can you give us values to use for A, j, h ? Also why are you solving for u and not z? If you have a list of roots then Select[{1 + I 2, 1 - I 2, 3 + I 5, 3 - I 5}, Im[#] > 0 &] will select those with positive imaginary part. $\endgroup$
    – Hugh
    Jun 1, 2017 at 21:25
  • $\begingroup$ Sorry about that, my code actually has $u$ in it (I've been doing variable changes and it's hard to keep track) but I changed it to $z$ to post here since it's a question on complex numbers. I'm editing it. $A,j$ and $h$ are parameters of the problem, and I'd like my integral (and thus the residues) in terms of them. Would that be too difficult a problem to solve? And thanks for your suggestion, I'm just trying it out! $\endgroup$
    – Philip
    Jun 1, 2017 at 21:33
  • 1
    $\begingroup$ A possibility would be to replace the parameters with specific symbolic constants e.g. {E,Pi,EulerGamma}. Do the integral, by residues or otherwise, and then substitute back, This will be correct for a range of parameter values though that will have a dependency on where certain polynomials in the parameters vanish. Could do similar substitutions to handle other regions of parameter space. $\endgroup$ Jun 2, 2017 at 14:36

1 Answer 1


You can use ComplexExpand:

roots = z /. 
  Solve[(1 + A^2 z^2) (1 + z^4) (1 + A^2 (j^2 - h j z + z^2)) (1 + (j^2 - h j z + z^2)^2) == 0, z]
FullSimplify[ComplexExpand[Im[roots]], Assumptions -> Element[{h, j, A}, Reals]]

This returns a pretty nice result. For most of the terms in the list it's easy to determine whether they are positive or negative (depending on the parameters). The only non trivial expression there is Sin[1/2 Arg[-4 I + (-4 + h^2) j^2]], but this one too is easy since $$\operatorname{sign}(\tfrac{1}{2}\sin(\arg(z))) = \operatorname{sign}(\sin(\arg(z))) = \operatorname{sign}(\Im(z))$$ So you can find the sign of the imaginary part by

imaginary = FullSimplify[
       Assumptions -> Element[{h, j, A}, Reals]] /. Sin[1/2 Arg[z_]] :> ComplexExpand[Im[z]]
 Assumptions -> Element[{h, j, A}, Reals]]
  • $\begingroup$ This is exactly what I was looking for! I can't thank you enough! You've saved me so much time, especially with the $\sin(\frac{1}{2}\arg{z})$ trick! $\endgroup$
    – Philip
    Jun 1, 2017 at 22:50
  • 1
    $\begingroup$ Glad to hear that. Welcome to Mathematica SE. Here we thank people by upvoting and/or accepting their answers (little upwards arrow and checkmark, respectively). $\endgroup$
    – yohbs
    Jun 1, 2017 at 22:55
  • $\begingroup$ Yep, I use the other SEs, was just trying it out! Incidentally, I don't have six characters to edit to your post, but there seems to be a slight syntax error Element[{h, j, A}] Reals]$\to$ Element[{h, j, A}, Reals]] unless I'm very wrong! $\endgroup$
    – Philip
    Jun 1, 2017 at 23:01
  • $\begingroup$ I edited the post to correct the typo. Thanks. $\endgroup$
    – yohbs
    Jun 2, 2017 at 13:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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