.claude/skills/differential-equation-solver/SKILL.md
Solve linear and nonlinear differential equations using chebops. Use when solving boundary value problems, ODEs, integral equations, or PDEs with spectral methods.
npx skillsauth add ShaneLogic/SolarLab differential-equation-solverInstall 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.
Solve equations of the form L(u) = f where:
Define the operator:
L = chebop(@(x,u) diff(u,2) + x.^3*u, [-3,3]);
Specify boundary conditions:
L.bc = 0; % Dirichlet (zero at both ends)
L.bc = 100; % Dirichlet (value at both ends)
L.bc = @(u) diff(u); % Neumann (derivative conditions)
L.bc = 'periodic'; % Periodic BCs
Alternative single-line syntax:
L = chebop(op, domain, bc_left, bc_right);
Solve:
u = L \ f;
Verify solution:
norm(L(u) - f) % Should be near machine precision
% Define operator: u'' + x^3*u = f
L = chebop(@(x,u) diff(u,2) + x.^3*u, [-1,1]);
L.bc = 0; % u(-1) = u(1) = 0
f = chebfun(@(x) exp(x), [-1,1]);
u = L \ f; % Solve
For PDEs of the form du/dt = Lu:
Define spatial operator:
L = chebop(@(x,u) diff(u,2), domain); % Second derivative
Compute operator exponential for time t:
E = expm(t * L);
Apply to initial condition:
u_t = E * u_0;
Example: Heat equation (u_t = u_xx):
L = chebop(@(x,u) diff(u,2), [-1,1]);
L.bc = 0;
u_0 = chebfun(@(x) exp(-10*x.^2), [-1,1]);
u_at_t = expm(0.1 * L) * u_0; % Solution at t = 0.1
u = L \ f; % Chebfun uses automatic differentiation
Chebfun automatically constructs the Frechet derivative (Jacobian).
% Construct Jacobian explicitly
J = chebop(@(x,u) linearized_operator, ...);
% Iterate
u_new = u - J \ (L(u) - f);
Include parameters as unknowns with zero derivatives:
% Solve with unknown temperature T
L = chebop(@(x,u,T) diff(u,2) + u.^2 - T, [0,1]);
L.bc = @(u,T) [u(0); diff(u,1) - T];
f = 0;
uT = L \ f; % Returns chebmatrix
% Extract results
u = uT{1}; % Solution function
T = uT{2}; % Parameter value
Important: Different initial guesses may converge to different solutions.
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.