.claude/skills/chebyshev-approximation/SKILL.md
Work with Chebyshev series and interpolants, including extracting coefficients, understanding convergence properties, and constructing fixed-length approximations. Use when analyzing the mathematical foundation of chebfun approximations or needing explicit polynomial representations.
npx skillsauth add ShaneLogic/SolarLab chebyshev-approximationInstall 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.
% N+1 Chebyshev points on [-1, 1]
N = 10;
j = 0:N;
x_j = -cos(j * pi / N);
% Special case: N=0 gives x_0 = 0
% Chebyshev polynomial of degree N
T_N = @(x) cos(N * acos(x));
% Examples:
% T_0(x) = 1
% T_1(x) = x
% T_2(x) = 2x^2 - 1
A smooth function f has unique expansion:
f(x) = Σ_{k=0}^∞ a_k T_k(x)
% For k > 0:
a_k = (2/pi) * integral_{-1}^1 (f(x) * T_k(x) / sqrt(1-x^2)) dx
% For k = 0:
a_0 = (1/pi) * integral_{-1}^1 (f(x) / sqrt(1-x^2)) dx
Chebfun constructs approximations via interpolants:
f_N(x) = Σ_{k=0}^N c_k T_k(x)
f = chebfun(@(x) exp(x), [-1, 1]);
% Get Chebyshev coefficients (high-order first)
coeffs_cheb = chebcoeffs(f);
% Returns row vector: [c_N, c_{N-1}, ..., c_0]
% Get coefficients in monomial basis 1, x, x^2, ...
coeffs_mono = poly(f);
% Returns row vector: [a_N, a_{N-1}, ..., a_0]
For functions not "really" polynomials:
% First entry is typically just above machine precision
f = chebfun(@(x) sin(x), [-1, 1]);
coeffs_cheb = chebcoeffs(f);
% coeffs_cheb(1) ≈ eps * scale(f)
% Force specific length N (non-adaptive)
f_fixed = chebfun(@(x) exp(x), [-1, 1], 20);
length(f_fixed) % Returns 20
For functions not well-approximated by polynomials:
% Function with discontinuity
f = chebfun(@(x) sign(x), [-1, 1], 50);
plot(f) % Shows overshoot near x=0
% Measure overshoot amplitude
overshoot = max(f);
Note: Gibbs overshoot persists as N → ∞.
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.