7
$\begingroup$

My goal is to be able to compute the residues of something like $z^{\alpha} R(z)$ where $0 < \alpha < 1$, $R(z)$ is rational, and the exponential can be chosen with any branch.

I found a way to define the logarithm with any branch here:

How does Mathematica understand branchcuts of the complex logarithm?

But when I input

Clear[arg, log];
arg[z_, σ_: - Pi] := Arg[z Exp[-I (σ + Pi)]] + σ + Pi;
log[z_, σ_: - Pi] := Log[Abs[z]] + I arg[z, σ]

and something as simple as

Residue[log[z, 0], {z, I}]

(i.e. using the branchcut $[0, 2\pi]$) which should just give $0$, as the function is analytic around $i$, I get the output

(* Residue[I (π + Arg[-z]) + Log[Abs[z]], {z, I}] *)

In other words, nothing happens. I also tried numerically using NResidue but the same thing happens. The problem is the same when I input the expressions of interest to me, such as ($\alpha = 1/3, R(z) = 1/(z^2+1)$)

Residue[Exp[(1/3) log[z, 0]]/(z^2 + 1), {z, I}]

which outputs

(* Residue[E^(1/3 (I (π + Arg[-z]) + Log[Abs[z]]))/(1 + z^2), {z, I}] *)

Any ideas?

$\endgroup$
1
  • $\begingroup$ Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory Tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. $\endgroup$
    – bbgodfrey
    Jul 5, 2015 at 4:04

1 Answer 1

7
$\begingroup$

This is because Mathematica doesn't have definitions for the derivative of Abs and Arg, so it can't do series expansions of expressions containing them. Consequently, it doesn't evaluate the Residue of such expressions either. But you could define a new function residue that knows how to extract the harmless logarithm before going on:

Clear[arg, log];
arg[z_, σ_: - Pi] := 
  Arg[z Exp[-I (σ + Pi)]] + σ + Pi;
log[z_, σ_: - Pi] := Log[Abs[z]] + I arg[z, σ]

ClearAll[residue];
SetAttributes[residue, HoldAll]
residue[x_, var_] := 
 Residue[Unevaluated[x] /. a_log :> Limit[a, Rule @@ var], var]

Here are two examples, first the conventional branch cut, then your example:

residue[2 log[2 z + 2]/z, {z, 0}]

(* ==> 2 Log[2] *)

residue[Exp[(1/3) log[z, 0]]/(z^2 + 1), {z, I}]

(* ==> -(1/2) (-1)^(2/3) *)

I didn't put in any checks for existence of the Limit that I take in residue. I assume you'll choose the expansion point such that it doesn't conflict with the branch choice.

Explanation

The purpose of residue is to implement the relation $\text{res}_{z0}\left(f(z)\,g(z)\right)= \text{res}_{z0}\left(g(z0)\,f(z)\right)$ if $g(z)$ has no singularity at $z0$. In particular, it assumes that we have chosen the branch cut such that any term involving log (as defined above) can be treated as if it were such a $g(z)$. Really, what this does is to turn $g$ into a constant factor that could be pulled out.

To be able to pull out such terms from under the original residue, I give this new function the HoldAll attribute (HoldFirst would also work here). This is necessary so that the previously given definition for log is not used until after I'm done extracting it from the residue (otherwise we would at that point end up with Abs and Arg inside Residue, which halts the evaluation).

The extraction of log happens with a replacement rule, where I look for any object with Head equal to log inside the Unevaluated form of the input expression. By matching only the Head without looking into the arguments of log, I prevent the evaluator from kicking in (it would do that because Unevaluated is a "temporary" construct, not like Hold; but it's sufficient here).

Having identified the log with a dummy name a, I then evaluate it and replace any occurrence of the variable that was specified in var by its value at the expansion point. The argument var is of the form {z, z0}, so it's easy to do this replacement by writing it as a Limit for z -> z0. This is what Rule @@ var is for. At that stage, the evaluation of the enclosing Residue can proceed, with log having been turned into a constant. You could do similar replacements not just for log but also for other functions that prevent Residue from working, if you know they have no poles.

$\endgroup$
2
  • $\begingroup$ Could you say a bit about the inner workings of residue? Thanks. $\endgroup$
    – bbgodfrey
    Jul 5, 2015 at 12:55
  • 1
    $\begingroup$ @bbgodfrey OK, I've added an explanation. $\endgroup$
    – Jens
    Jul 5, 2015 at 17:18

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.