How to get residue of $f(z)=\frac{n/z}{z^{n}-1}$ with correct residue of $-n$ at zero?
It works it out just fine at 1 with:
Residue[(n/z/(z^n - 1)), {z, 1}]
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityHow to get residue of $f(z)=\frac{n/z}{z^{n}-1}$ with correct residue of $-n$ at zero?
It works it out just fine at 1 with:
Residue[(n/z/(z^n - 1)), {z, 1}]
Regarding the comment: the residue at z=1 is clearly wrong
If a function, $f(z)$, has a pole of order $k$ at $z=z_0$ then
$$ \begin{equation} \text{Res}(f,z_0)=\frac{1}{(k-1)!}\frac{d^{k-1}}{dz^{k-1}} \left[(z-z_0)^k f(z) \right]\Bigg|_{z=z_0} \end{equation} $$
Ok, so let's consider the function -which is the example in the OP with $n=1$
$$ \begin{equation} f = - \frac{1}{z(1-z)} \end{equation} $$
The above has a pole of order $1$ at $z=0$ and a pole of order $1$ at $z=1$. Hence, we compute explicitly
$$ \text{Res}(f,0) = \frac{1}{(1-1)!} \left((z-0)^1(-)\frac{1}{z}\frac{1}{1-z} \right)\Bigg|_{z=0} = - 1 $$
and also
$$ \text{Res}(f,1) = \frac{1}{(1-1)!} \left((z-1)^1(-)\frac{1}{z}\frac{1}{1-z} \right)\Bigg|_{z=1} = 1 $$
And likewise for higher values of $n$.
So, when Mathematica
computes
Residue[n/(z (z^n - 1)) /. n -> 1, {z, 0}]
Residue[n/(z (z^n - 1)) /. n -> 1, {z, 1}]
as
-1
1
it is indeed correct.
Then, all the methods agree.
@Artes suggested
FindSequenceFunction[Table[Residue[n/(z (z^n - 1)), {z, 0}], {n, 10}],
n]
which returns
-n
and is the same as
Assuming[n ∈ Integers && n >= 1,
Simplify@SeriesCoefficient[n/(z (z^n - 1)), {z, 0, -1}]]
from the linked question. Credits are to @Carl Woll.
Hopefully the above offers some clarity and will stop the war of the comments.
Assuming[n \[Element] Integers && n >= 1, Simplify@SeriesCoefficient[n/(z (z^n - 1)), {z, 0, -1}]]
is somewhat more exact.
$\endgroup$
Feb 25 at 14:53
SeriesCoefficient[n/(z (z^n - 1)), {z, 0, -1}, Assumptions -> n \[Element] Integers && n >= 1]
returns Piecewise[{{-n, Mod[0, n] == 0}}, 0]
.
$\endgroup$
Feb 25 at 14:58
SeriesCoefficient[n/(z (z^n - 1)), {z, 0, -1}, Assumptions -> n \[Element] Integers && n >= 1] // FullSimplify
returns -n
$\endgroup$