Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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$?

share|improve this question
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
up vote 6 down vote accepted

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) *)
share|improve this answer

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}$

share|improve this answer

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.

share|improve this answer
Exactly right (and an upvote). – Daniel Lichtblau Apr 29 at 15:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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