# Complex limit gives wrong answer

I'm evaluating $$\lim_{z\to e^{i \pi/2 n}} \frac{z-e^{i \pi/2 n}}{z^{2 n}+1}$$ with Mathematica 9.0.1:

In[139]:= Limit[(z - Exp[(I π)/(2 n)])*1/(1 + z^(2 n)),
z -> Exp[(I π)/(2 n)]]
Out[139]:= 0


Mathematica returns 0, but this is not correct. For example, setting n=4, we get a nonzero result:

In[140]:= With[{n = 4},
Limit[1/(1 + z^(2 n)) (z - Exp[I π/(2 n)]),
z -> Exp[I π/(2 n)]]
]
Out[140]:= -(1/8) (-1)^(1/8)


What went wrong? Is Mathematica assuming something about the value of $n$?

-
This is also consistent with Residue[1/(1 + z^(2 n)), {z, Exp[(I \[Pi])/(2 n)]}]. – b.gatessucks Dec 25 '13 at 8:49

It looks like Mathematica is not handling the 0/0 limit correctly.

expr = (z - Exp[(I π)/(2 n)])*1/(1 + z^(2 n)) ;

Simplify[Limit[Numerator[expr], z -> Exp[(I π)/(2 n)]],
Assumptions -> { n ∈ Integers}]
Simplify[Limit[Denominator[expr], z -> Exp[(I π)/(2 n)]],
Assumptions -> { n ∈ Integers}]
(* 0 *)
(* 0 *)

Simplify[Limit[D[Numerator[expr], z]/D[Denominator[expr], z],
z -> Exp[(I π)/(2 n)]], Assumptions -> { n ∈ Integers}]
(* -(E^(((I π)/(2 n)))/(2 n)) *)

Simplify[-(E^(((I π)/(2 n)))/(2 n)) /. n -> 4]
(* -(1/8) (-1)^(1/8) *)

-

You can do it another way, approach the limit by angle:

c = Exp[(I π)/(2 n)];
expr = (z - a)/(1 + z^(2 n));
exprInθ = FullSimplify[expr /. z -> c Exp[I θ], n ∈ Integers];
Limit[exprInθ, θ -> 0]


$-\frac{e^{i \pi /2n}}{2n}$

-

Let, $$f=\frac{z-e^{i \pi/2 n}}{z^{2 n}+1}$$ Then, in Mathematica code, the following seems to work,

Limit[f, z -> Exp[(I Pi)/(2 n)], Assumptions -> n >= 1/2]


which gives the result,
$$-\frac{e^{i \pi/2 n}}{2n}$$ The problem isn't that Mathematica is handling the $0/0$ limit incorrectly. It's that Mathematica, without additional information, cannot simplify,
$$(e^{i \pi/2 n})^{2n}$$ because for $0<n<1/2$ it does not evaluate to -1 and so in the limit you have $0/a$ where a is some number not equal to zero. Thus you get 0 for the limit. When $n \geq 1/2$ it does evaluate to -1 and so the limit is now $0/0$ which Mathematica can handle (as a limit). Example: Try $n=1/4$ and see that,
$$(e^{i \pi/2 n})^{2n}$$ evaluates to 1.

-
Exactly right (and an upvote). – Daniel Lichtblau Apr 29 at 15:58