18
$\begingroup$

According to the documentation, Mathematica chooses the branch cut for $\log(z)$ to lie along the negative real axis. It it possible to change this so that it lies along the positive axis or elsewhere in the complex plane?

$\endgroup$
  • $\begingroup$ By the way, welcome to Mathematica.SE! Please consider registering your account so that any upvotes you get on this question are added to those you might get on future questions and answers. That way, over time you will be able to do more on the site (post graphics, edit things, etc). $\endgroup$ – Sjoerd C. de Vries Nov 18 '12 at 19:16
  • $\begingroup$ I don't have enough reputation to comment or vote, but I am just making a note that Mathematica's default branch cut means values fall in (-Pi,Pi], making Jens answer incorrect and Zzz's original answer the correct one. $\endgroup$ – user13631 Apr 11 '14 at 2:13
  • $\begingroup$ Can you explain your reasoning in more detail? @Zzz's answer gives myLog[-1, 0.1] as $-2.94159i$, which is quite incorrect. $\endgroup$ – user484 Apr 11 '14 at 2:28
  • $\begingroup$ @Owen You are wrong. The inverse of my definition, i.e. the Exp of my function, leads back to the original argument. With ZZZ's definition, that is not the case, so it is not an inverse of the exponential function. $\endgroup$ – Jens Apr 11 '14 at 2:34
  • $\begingroup$ In any case, this is not an answer and should be deleted, perhaps after some more discussion (in case I overlooked something). $\endgroup$ – Jens Apr 11 '14 at 2:35
8
$\begingroup$

Let me join the fun and see if I can write my answer without any omissions... both of the previous ones had little errors you can easily check by inverting the newly defined log function myLog, i.e., doing Exp[myLog[...]].

So here is my definition that I just verified:

myLog[z_, θ_: 0] := Log[Abs[z]] + I (Arg[z Exp[I θ]] - θ)

Note that the sign in front of the branch angle θ has to be different in the two places where it appears, so that when you do the inverse the two instances of θ cancel.

| improve this answer | |
$\endgroup$
  • $\begingroup$ I think @Zzz has right sign. May be you would like to consider it. Let me know if I am wrong, but I checked it(properly hope so). E.g. myLog[Exp[3 I Pi], Pi] = 3 I Pi, however, in your case, it comes out to be -I Pi, which is not even in the cut range(i.e from Pi to 3 Pi). I hope I am not talking bullshit $\endgroup$ – L.K. Apr 14 '18 at 17:24
  • $\begingroup$ @L.K I posted this answer as a response to the one by Zzz and therefore took over the definition of the angle from that answer. But that angle is actually the (negative of) the direction angle of the branch cut plus $\pi$. A more useful definition that really uses the angle of the branch cut is in the answer I gave here. It also gives the result you expect with the value of the second argument corresponding to the true branch angle. $\endgroup$ – Jens Apr 14 '18 at 23:30
6
$\begingroup$

My comment from elsewhere seems relevant here, so I'm reposting it.

Here's a Log with a branch cut along any curve of the form $z=-re^{i\theta(r)}$:

myLog[z_, θ_: Function[0]] := With[{r = Abs[z]}, Log[z/Exp[I θ[r]]] + I θ[r]]

Neat example: ArcTan with a weird branch cut.

myArcTan[z_] := Evaluate@ExpToTrig[TrigToExp@ArcTan[z] /. Log[w_] -> myLog[w, # &]]
ContourPlot[Re@myArcTan[x + I y], {x, -3, 3}, {y, -3, 3},
 Contours -> FindDivisions[{-π/2, π/2}, 20]]

enter image description here

| improve this answer | |
$\endgroup$
2
$\begingroup$

I think the correct way to achieve this is

    myLog[z_, θ_: 0] := Log[Abs[z]] + I (Arg[z Exp[I θ]] + θ)

Positive or negative θ corresponds to moving up or down the Riemann surface.

| improve this answer | |
$\endgroup$
  • $\begingroup$ You have a little sign error in there - see my answer. $\endgroup$ – Jens Nov 18 '12 at 3:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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