The most powerful computational tool - solve real integrals via complex methods
One number at each pole, the residue, is enough to work out a whole contour integral. The same trick cracks real integrals that resist ordinary calculus.
Drag the zeros (rings) and poles (crosses), add your own, and draw any closed curve. Watch f(γ) wind around 0 exactly Z − P times, and ∮ f dz match 2πi times the residues.
Distances from 0 are squeezed so the whole curve fits (dashed circle: |f| = 1.72); every angle is exact. Turns so far: 0
Hue is the argument of f (red for positive reals, then yellow, green, blue as the angle grows); with rings on, each band is a doubling of |f|. Turns are counted by following arg f in small steps along γ; the integral uses Gauss–Legendre quadrature on the drawn polygon, and residues of higher-order poles are computed exactly from the factored form.
The Residue Theorem turns a contour integral into arithmetic: add up one number at each pole inside the curve.
The workspace checks this on whatever curve you draw. It integrates f along the curve numerically, with no knowledge of the residues, and compares the answer with 2πi times the residues it computes from the factored formula. Draw a curve clockwise, or one that loops twice around a pole, and both sides change together, because the winding numbers n(γ, zk) become −1 or 2.
For a pole of order m at b, write f(z) = g(z)/(z − b)m with g analytic at b. The residue is the coefficient of (z − b)m−1 in the Taylor series of g, that is g(m−1)(b)/(m − 1)!. The workspace uses this exactly, so double and triple poles are handled too; for example z³/(z − 1)² has residue 3 at z = 1.
The left side is the number of turns f(γ) makes around 0. To see why, write f(z) = (z − a)kg(z) near a zero a of order k: as z circles a once, the factor (z − a)k turns k times and g barely moves. A pole of order m contributes −m turns the same way. The workspace counts the turns by following arg f along the curve in small steps, and separately counts zeros and poles from their positions, so the two readouts are independent checks of the theorem.
Engineers use the same count in the Nyquist stability test: how many times the Nyquist plot winds around −1, together with the open-loop unstable poles, tells you how many unstable poles the closed-loop feedback system has.
Choose a function and find its poles, the bright white points. The table gives each pole's order and residue; the contour integral is 2πi times their sum.
Poles appear as bright white points with radial color patterns
💡 Residue Computation Methods:
The residue of a function f(z) at an isolated singularity z₀ is the coefficient a₋₁ in the Laurent expansion:
Choose a real integral and follow the steps: extend it to the complex plane, close a semicircle in the upper half-plane, and add up the residues inside. Start with the arctangent integral, which comes out to π.
Semicircle in upper half-plane enclosing pole at z = i
🎯 Key Insight:
This real integral from -∞ to ∞ would be extremely difficult (or impossible) to evaluate with real analysis techniques. By extending to the complex plane and using the Residue Theorem, we reduce it to a simple residue calculation! This demonstrates the incredible power of complex analysis.
One of the most spectacular applications of the Residue Theorem is evaluating real improper integrals that are otherwise very difficult or impossible to solve with real methods.
Classic examples: ∫₋∞∞ 1/(1+x²) dx = π, ∫₋∞∞ cos(x)/(1+x²) dx = π/e
Spot a mistake or have an idea?