Residue¶
Status: Stable
documented, exercised by the test suite and/or worked examples, with no known limitations recorded.
Description¶
Residue[f, {z, z0}]
gives the residue of f at the isolated singularity z = z0 -- the coefficient of (z - z0)^-1 in the Laurent expansion of f.
Notes
Computed by power-series expansion, so a residue is found only where f admits a Laurent series at z0. Returns unevaluated at branch points (fractional-power expansions) and when no series can be produced. See NResidue for a numerical alternative that also handles essential singularities.Examples (19)¶
Every input below was run against the current Mathilda build and its output recorded.
Basic examples (9)¶
In[1]:= Residue[1/z, {z, 0}]
Out[1]= 1
In[2]:= Residue[1/z^2, {z, 0}]
Out[2]= 0
In[3]:= Residue[1/Sin[z]^5, {z, 0}]
Out[3]= 3/8
Order-2 pole
Complex pole
Algebraic pole
Unknown numerator
Branch point
Applications (10)¶
A simple pole at the origin
Simple pole at a complex location, via P(z0)/Q'(z0)
An algebraic pole location, kept in one radical spelling
Fifth-order pole of a transcendental integrand
The summation kernel Pi Cot[Pi z] at a pole of the rational factor
Residue 1 at the only pole of Zeta
Symbolic double pole, self-validated across expansion orders
In[16]:= Residue[Exp[I z]/(z^2 + a^2)^2, {z, I a}]
Out[16]= ((-1/4*I) E^(-a))/a^3 + ((-1/4*I) E^(-a))/a^2
Fractional power times a double pole, via the dropped-pole guard
A branch point has no residue, so the call stays unevaluated
Limitation: Series has no expansion of Gamma at its poles, so this stays unevaluated; NResidue gives -0.166667
Algorithm¶
residue.c -- Residue[expr, {z, z0}], the symbolic residue.
The residue of f at an isolated singularity z = z0 is the coefficient of (z - z0)^-1 in the Laurent expansion of f. We obtain it directly from the series engine: expand f to order (z - z0)^0 (which always spans the -1 term, however deep the pole), then read the coefficient at exponent -1 out of the resulting SeriesData[z, z0, {coefs}, nmin, nmax, den].
A residue is well defined only for an ordinary Laurent expansion (den == 1). A fractional-power (Puiseux) expansion, den > 1, signals a branch point, where the residue is undefined -- we leave the call unevaluated, matching Mathematica (e.g. Residue[1/Sqrt[z], {z, 0}]).
evaluating the denominator there and testing it against zero; but for a pole whose location is a SUM of radicals (e.g. z0 = -2 + Sqrt[3], a root of 1 + 4 z + z^2), Denominator(z0) is an expression like 1 + 4 (-2 + Sqrt[3]) + (-2 + Sqrt[3])^2 that does not auto-simplify to 0, so
expanding about z0 EXPLICITLY: substitute z -> z0 + w, then Expand the denominator of the result -- polynomial expansion collapses the radical arithmetic (Sqrt[3]^2 -> 3, ...) so the vanishing constant term becomes a
coefficient is then a plain Series-at-0 of the expanded form.
Implementation notes¶
Algorithm. builtin_residue handles only the two-argument form
Residue[f, {z, z0}] (fewer arguments emit Residue::argm; a non-symbol z
or a malformed spec leaves the call unevaluated) and hands it to
residue_compute, which reads the coefficient of (z - z0)^-1 out of a Laurent
expansion. The integrand is first classified by residue_is_rational_in (is
Together[f] a ratio of polynomials in z?). For a rational f,
residue_simple_pole tries the fast path P(z0)/Q'(z0) (P/Q = Together[f],
Q(z0) == 0 and Q'(z0) != 0 decided by PossibleZeroQ), which never builds a
series. Otherwise residue_shift_form substitutes z -> z0 + w (a private
symbol Residue`$w) and Expands the shifted numerator and denominator
separately, so Q's constant term collapses to a literal 0 and an algebraic
z0 keeps one radical spelling. Transcendental integrands (Cot, Zeta,
unknown f[z]/z^n) are expanded directly about z0, so the series engine's own
Laurent knowledge applies.
In both cases the coefficient comes from residue_extract, which is
self-validating since v0.268. An order-0 probe (residue_coeff_once) learns
the pole order m and short-circuits the analytic (residue 0) and branch-point
(den > 1, unevaluated) cases. residue_coeff_resolved then expands from order
m - 1, raising the order by 3 while the O-term still hides exponent -1.
Successive orders are compared (residue_coeffs_agree, a PossibleZeroQ of the
difference), and a coefficient is accepted only when two consecutive orders
agree. A padded Series can return a -1 coefficient that is present but
inaccurate at a higher-order pole: the cofactor is truncated, so product-rule
cross terms drop out, and this happened at symbolic double poles such as
E^(I z)/(z^2 + a^2)^2 at I a. The agreement test catches that case. A
second guard covers a dropped pole. When the direct expansion reports 0 but
residue_has_pole_at finds that Denominator[Together[f]] vanishes at z0,
the function re-expands f /. z -> z0 + w about w = 0. There z^p becomes the
analytic binomial (z0 + w)^p, which fixes the silent 0 previously returned
for z^(1/3)/(1 + z^2)^2 at z = I.
Data structures. Expr trees throughout. The helpers residue_eval1/residue_eval2
build and evaluate calls to Together, Numerator, Denominator, Expand,
D, ReplaceAll and Series. The expansion is a SeriesData[z, z0, {coefs},
nmin, nmax, den], and the residue is the coefficient at index -1 - nmin.
Complexity / limits. The simple-pole path costs one differentiation and two
substitutions. The series path costs a few Laurent expansions. The resolve loop
gives up past order 256, and the agreement loop is bounded at order 64 / 12
iterations, returning the last estimate. The residue is defined only for an
ordinary Laurent expansion, so a Puiseux expansion (a branch point, as in
1/Sqrt[z] at 0) is left unevaluated. So is any point where Series itself has
no expansion. The essential singularity E^(1/z) at 0 and the poles of Gamma
at the non-positive integers fall in this class (Series[Gamma[z], {z, 0, n}]
is itself unevaluated). For those cases, use the numerical NResidue.
Attributes: Protected.
References¶
See also: NResidue, Together, Zeta, Series
- Source:
src/calculus/residue.c - Specification:
docs/spec/builtins/calculus.md - Tests:
tests/test_residue.c
Notes & additional examples¶
Notes¶
Residue[f, {z, z0}]is the coefficient of(z - z0)^-1in the Laurent expansion offatz0. An analytic point gives0. Poles of any order, at numeric or symbolic centres, are handled.- For higher-order poles the coefficient is accepted only after two consecutive
expansion orders agree. This closes the silent wrong answers at symbolic
double and triple poles that existed before v0.268. Those wrong residues also
fed
Integrate[..., Method -> "Residue"]. - A branch point (a fractional-power expansion) is left unevaluated, matching
Mathematica. An essential singularity (
E^(1/z)at0) and the poles ofGammaare also left unevaluated, becauseSerieshas no expansion there. Mathematica returns1and(-1)^n/n!for these. UseNResiduefor a numerical value. - Only the two-argument form is supported. Attributes:
Protected. - See also:
NResidue,Series,SeriesCoefficient,Integrate(contour / residue-theorem definite integration).