In complex analysis, let's say I choose a branch of the complex logarithm (so that I can calculate the argument of a complex function), and I want to study numerically the variation of the argument of this complex function along a given contour in the complex plane. I am not just interested in the principal argument, I want to keep track of the discontinuous jumps of the argument of the complex function along that given contour, when the function touches the branch cut. How do I do that in Mathematica?

  • $\begingroup$ Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. $\endgroup$
    – Community Bot
    Feb 26, 2022 at 11:00
  • 1
    $\begingroup$ Would be helpful if you precisely define an example $\log(z)$ branch $y(z)$, then an example paramaterization such as $z(t)$ over which you wish to evaluate $y(z(t))$. Also essential you understand clearly the analytic geometry of the $\log(z)$. Maybe this thread would be helpful: mathematica.stackexchange.com/questions/263861/… $\endgroup$
    – josh
    Feb 26, 2022 at 15:11

2 Answers 2


MMA will always give you the main branch. If you want a continuous function, you have to adjust the argument "by hand".

Here is a simple example:

fun[t_] = Exp[I t];
old = 0;
arg = 0;
 arg = Arg[fun[t]];
 If[old - arg > Pi, arg += 2 Pi]; If[old - arg < -Pi, arg -= 2 Pi]; 
 old = arg;
 old = arg;
   {Green, Circle[]}
   , {PointSize[Medium], Red, Point[ReIm[fun[t]]]}
   , Text[StringForm["Argument: ``", arg], {0, 1.1}, 
    BaseStyle -> Medium]
   }, Axes -> True]
 , {{t, 0}, -3 Pi, 3 Pi}, TrackedSymbols :> t]

enter image description here

  • $\begingroup$ Thank you for the answer @DanielHuber . I assume this is just a fragment of the program. It doesn't include the curve parametrization z(t), for which we calculate arg f(z(t)) for a sequence of close points along the curve, right? $\endgroup$ Feb 26, 2022 at 13:12
  • 1
    $\begingroup$ This is only a demo to show how to keep track of a jump in the argument. You can look at it as a parametrized curve that is the circle and the function f would be the identity. Or you can look at it as: curve = straight line from -3Pi to 3Pi along the real axis and the function is Exp[I t] $\endgroup$ Feb 26, 2022 at 13:34

For the example you give, Log, its derivative is uniquely defined. You can therefore specify the value by the integral along a defined path. E.g.

path = Table[Exp[I n], {n, 1, 20}]
(* {E^I, E^(2 I), E^(3 I), E^(4 I), E^(5 I), E^(6 I), E^(
 7 I), E^(8 I), E^(9 I), E^(10 I), E^(11 I), E^(12 I), E^(13 I), E^(
 14 I), E^(15 I), E^(16 I), E^(17 I), E^(18 I), E^(19 I), E^(20 I)} *)

Integrate[1/x, Prepend[path, x]]
(* 19 I *)

(I don't know why Mathematica is quite so slow in evaluating this integral)


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.