Complex analysis

Residues and Laurent series

Near an isolated singularity a function is a series in positive and negative powers. The coefficient of 1/(z−c)1/(z - c) is the residue, the only part that survives integration round the point. Here the coefficients come as proven rectangles, and the kind of singularity comes from proven counts.

import { laurent, residue, singularities, rect } from "@ratmath/complex";

residue("exp(z)/z^3", 0);            // 0.5 ± 3.1e-14
residue("1/(z^2 + 1)", "i");         // 0 - 0.5i
residue("exp(1/z)", 0);              // 1, at an essential singularity

laurent("exp(z)/z^2", 0, 1, { from: -3, to: 2 }).toString();
// a_-3 = 0 ± 2.9e-14      a_-2 = 1      a_-1 = 1
// a_0 = 0.5               a_1 = 0.1666666667   a_2 = 0.0416666667

singularities("exp(z)/((z^2 + 1)^2 * sin(z))", rect([-2, 2], [-2, 2])).singularities;
// pole of order 2 at −i, pole of order 1 at 0, pole of order 2 at i

Laurent coefficients

If ff is analytic in an annulus about cc, then there

f(z)=∑n=−∞∞an(z−c)n,an=12πi∮f(z)(z−c)n+1 dz, f(z) = \sum_{n=-\infty}^{\infty} a_n (z - c)^n, \qquad a_n = \frac{1}{2\pi i}\oint \frac{f(z)}{(z - c)^{n+1}}\,dz,

the integral taken round any circle in the annulus. laurent(f, c, radius) computes these as contour integrals, all of them over the same subdivision of the circle. The series belongs to the annulus, not to the function: a different radius that crosses a singularity gives a different series, as the code box shows.

Residues

residue(f, point) is a−1a_{-1}: the integral round a small circle (radius 1/4 unless given) divided by 2πi2\pi i. The circle must hold no other singularity. For a formula given as text that is checked: the zeros of the formula's denominator are counted inside the circle and inside a far smaller one, and if the counts differ the call is refused with the advice to use a smaller radius. The point may be exact, or an enclosure of the kind zeros returns.

Kinds of singularity

An isolated singularity is removable when the function stays bounded near it, a pole of order m when (z−c)mf(z - c)^m f does, and essential otherwise. No amount of arithmetic near the point can tell a coefficient that is 0 from one that is merely tiny, so this cannot be decided by sampling. It can be decided from the formula.

singularities(f, rect) splits the formula into a numerator and a denominator by the rules of fractions, with tan⁡=sin⁡/cos⁡\tan = \sin/\cos. Then:

  • the zeros of the denominator are found, with multiplicity, by zeros;
  • round each one, the zeros of the numerator are counted on a small frame. None means a pole of the denominator's order. If the numerator vanishes there too, the difference of the two counts is the order of the pole, or shows the singularity to be removable;
  • where an entire function such as exp is applied to something with a pole, the singularity is essential;
  • where a logarithm or root is applied to something that vanishes, there is a branch point, which is not isolated at all.

One thing is taken on trust and said so in each entry's note: that a numerator zero and a denominator zero found inside the same box of width 2⁻²⁴ are the same point.

callreturns
laurent(f, center, radius, { from, to })coefficient(n), coefficients, principalPart (the negative powers, those proved non-zero marked), toString()
residue(f, point, { radius })A Rect
singularities(f, rect){ singularities: [{ enclosure, kind, order, note }], complete, unresolved, numerator, denominator }; kind is "pole", "removable", "essential", "branch point" or "undetermined"
Try itEdit the code and run it with @ratmath/complex and Core's Rational in scope. The last line's value is shown; PRINT(…) adds lines, TEX(…) typesets math.
Ctrl/⌘ + Enter runs