From grimoire
Classifies ODE/PDE type, selects analytical or numerical solution methods, validates solutions, and interprets physical meaning.
How this skill is triggered — by the user, by Claude, or both
Slash command
/grimoire:apply-differential-equationsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Classify, solve, and validate differential equations — choosing between analytical solutions (exact, separation of variables, integrating factor) and numerical methods (RK4, stiff solvers, finite difference/element) appropriate to the problem structure and stiffness.
Classify, solve, and validate differential equations — choosing between analytical solutions (exact, separation of variables, integrating factor) and numerical methods (RK4, stiff solvers, finite difference/element) appropriate to the problem structure and stiffness.
Adopted by: Differential equations model virtually all physical, biological, chemical, and engineering systems. Newton's laws, Maxwell's equations, Schrödinger equation, Navier-Stokes, the SIR epidemic model, Black-Scholes option pricing, and population dynamics are all differential equations. MATLAB ODE Suite, SciPy's solve_ivp, and Mathematica NDSolve are the standard numerical tools used in research and industry worldwide. Impact: Strogatz (2014) demonstrates that even qualitative analysis of ODEs (phase portraits, stability analysis) reveals system behavior without solving explicitly — a method used in epidemiology (epidemic thresholds), neuroscience (neural firing patterns), and climate modeling (tipping points). Hairer et al. (1993) showed that choosing the wrong solver for a stiff ODE (e.g., explicit RK4 on a stiff chemical kinetics problem) produces exponentially growing errors and requires time steps 1000× smaller than the implicit alternative.
Before solving, identify the type — it determines the solution method:
Ordinary Differential Equations (ODE): one independent variable (usually time t)
Partial Differential Equations (PDE): multiple independent variables
Stiffness: system is stiff if it contains time scales that differ by orders of magnitude; stiff systems require implicit solvers.
1st order ODE (dy/dt = f(t,y)):
Linear 2nd order with constant coefficients (ay'' + by' + cy = g(t)):
Laplace transform (for IVP with forcing): transform to algebraic equation in s-domain; solve; inverse transform.
For numerical solution, solver selection depends on problem type:
| Problem type | Recommended solver | Notes |
|---|---|---|
| Non-stiff ODE | RK45 (scipy default) | Runge-Kutta 4-5, explicit |
| Stiff ODE | Radau, BDF | Implicit; required for stiff problems |
| Highly stiff (chemistry) | LSODA (auto-detects stiffness) | Switches between Adams (non-stiff) and BDF |
| Oscillatory (Hamiltonian) | Symplectic integrator | Preserves energy; long-time accuracy |
| PDE (elliptic) | Finite element (FEniCS, FEniCSx) | — |
| PDE (time-marching) | Finite difference, method of lines | — |
from scipy.integrate import solve_ivp
def f(t, y):
return [-y[0] + y[1], -100*y[1]] # stiff system
sol = solve_ivp(f, t_span=[0, 10], y0=[1, 0],
method='Radau', # or 'BDF' for stiff
dense_output=True, rtol=1e-8, atol=1e-10)
Verify solution quality: halve the step size (or tighten tolerances) and check if solution changes meaningfully.
For autonomous systems dy/dt = f(y), without solving explicitly:
Phase portrait analysis reveals long-term behavior without numerical integration.
For analytical solutions: verify by differentiating and substituting back into the ODE. Check initial/boundary conditions.
For numerical solutions:
npx claudepluginhub jeffreytse/grimoire --plugin grimoireExplains existence and uniqueness of solutions to ODE initial value problems. Covers local/global dynamics, stability, bifurcations in dynamical systems theory.
Performs symbolic math in Python with SymPy: exact algebra, calculus (derivatives, integrals, limits), equation solving, symbolic matrices, ODEs, code generation (lambdify to NumPy/C/Fortran). Use for precise results over numerical approx.
Performs symbolic mathematics in Python with SymPy: solve equations algebraically, compute derivatives/integrals/limits, manipulate expressions, work with symbolic matrices, and generate code from formulas. Use when exact symbolic results are needed.