.claude/skills/complex-contour-integration/SKILL.md
Compute contour integrals of complex functions along parameterized paths in the complex plane. Apply Cauchy's theorem for analytic functions and the residue theorem for meromorphic functions. Use when integrating complex functions along specific paths or around closed contours.
npx skillsauth add ShaneLogic/SolarLab complex-contour-integrationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Parameterize the contour as a chebfun z(s) where s is a real parameter:
% Define contour parameter s over [0, 2*pi]
s = chebfun('s', [0, 2*pi]);
% Define contour z(s) as complex function of s
z = exp(1i * s); % Unit circle
% Or define piecewise contours using join
z1 = chebfun(@(s) s, [0, 1]); % Line from 0 to 1
z2 = chebfun(@(s) 1 + 1i*s, [0, 1]); % Vertical line from 1 to 1+i
z = join(z1, z2); % Combined contour
% Define the function f(z)
f = @(z) exp(-z.^2);
% Compute contour integral
I = sum(f(z) .* diff(z));
This implements the mathematical definition:
∫ f(z) dz = ∫ f(z(s)) z'(s) ds
If f(z) is analytic everywhere inside and on a closed contour:
% The integral equals zero
I = sum(f(z) .* diff(z)); % Result should be ~0
For analytic functions, integrals between two points are path-independent:
% Define two different paths from z1 to z2
path1 = chebfun(@(s) z1 + s*(z2-z1), [0, 1]); % Straight line
path2 = join(...); % Piecewise path
% Both integrals should be equal
I1 = sum(f(path1) .* diff(path1));
I2 = sum(f(path2) .* diff(path2));
% I1 ≈ I2
If f(z) is meromorphic (analytic except for poles) inside a closed contour:
% Compute contour integral
I = sum(f(z) .* diff(z));
% Sum of residues
SumResidues = I / (2 * pi * 1i);
The residue of f at z0 is the coefficient of the (z-z0)^(-1) term in the Laurent expansion.
Example: For f(z) = exp(z)/z^3:
Bernoulli number B_k = k! × (k-th Taylor coefficient of z/(exp(z)-1))
% Can be computed via residue theorem
f = @(z) z ./ (exp(z) - 1);
% Extract coefficient via contour integration
development
Understand and comply with Driftfusion software licensing terms, including the open-source AGPL v3.0 frontend and proprietary MATLAB pdepe solver backend. Use when using, modifying, or distributing Driftfusion code.
development
Initialize the Driftfusion simulation environment and create parameter objects. Use this skill when starting a new MATLAB session or setting up device properties for simulation.
development
Define device layer structure, configure spatial and time meshes, and build device structures with interface grading. Use this skill when setting up the physical geometry and discretization of a simulation device.
research
Analyze simulation solutions, calculate physical quantities, and generate plots. Use this skill when processing completed simulations, extracting currents/densities, or visualizing results.