differential-equations
Skill0 starsChanged 4 days agoMITView on GitHub
Solve ODE, SDE, DAE, DDE, and jump problems with DifferentialEquations.jl: solver choice, stiffness, callbacks, event handling, ensembles, and error control. Use when setting up or fixing a time integration.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- ffsshhttiikk/opencode-agents-skillstheir own version, first seen Feb 28, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- ffsshhttiikk/opencode-agents-skills★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository55 other files it gives its agents.
- advanced-optimizationSkill
- bayesian-inferenceSkill
- bayesian-pinnSkill
- bayesian-ude-workflowSkill
- catalyst-reactionsSkill
- continuum-mechanics-and-rheologySkill
- control-theorySkill
- creating-julia-appSkill
- debugging-toolkitSkill
- differentiationSkill
- equation-discoverySkill
- experiment-trackingSkill
- fem-feaSkill
- julia-graph-neural-networksSkill
- julia-languageSkill
- julia-ml-and-dlSkill
- julia-model-deploymentSkill
- julia-paper-implementationSkill
- julia-pro-helpSkill
- julia-pro-modeSkill
- julia-reinforcement-learningSkill
- modeling-toolkitSkill
- neural-pdeSkill
- nonlinear-dynamicsSkill
- numerical-methods-implementationSkill
- package-development-workflowSkill
- performance-tuningSkill
- physical-learning-systemsSkill
- playbook-debugSkill
- playbook-model-validateSkill
- playbook-package-releaseSkill
- playbook-paper-implementSkill
- playbook-perfSkill
- playbook-test-specSkill
- principle-both-sidesSkill
- principle-breakingSkill
- principle-file-is-truthSkill
- principle-gateSkill
- principle-limitsSkill
- principle-loud-failureSkill
- principle-one-stepSkill
- principle-proof-listSkill
- principle-rebuttalSkill
- principle-runtime-surfaceSkill
- principle-three-boundsSkill
- principle-three-clocksSkill
- scientific-visualizationSkill
- sciml-and-diffeqSkill
- setup-julia-proSkill
- signal-processingSkill
- simulation-and-hpcSkill
- statistical-physicsSkill
- symbolic-mathSkill
- web-development-juliaSkill
- zarr-cloud-arraysSkill
The file
Files
DifferentialEquations.jl
The order is fixed: name the problem type, then the solver, then the callbacks. Most "the integrator is wrong" reports are a stiff system under a non-stiff solver, a tolerance set tighter than the model's own error, or an event that fires repeatedly because the callback modified the state.
Problem type
The constructor decides which solvers are legal. A DAE written as an ODE silently solves the wrong equations.
| Equations | Constructor |
du/dt = f(u,p,t) | ODEProblem(f, u0, tspan, p) |
M du/dt = f | ODEProblem(ODEFunction(f; mass_matrix=M), u0, tspan, p) |
0 = f(du,u,p,t) | DAEProblem(f, du0, u0, tspan, p) |
du/dt = f + g dW | SDEProblem(f, g, u0, tspan, p) |
du/dt = f(u, u(t-\tau)) | DDEProblem(f, h, u0, tspan, p) |
| discrete state changes at rates | JumpProblem over a DiscreteProblem or GillespieProblem |
function lv!(du, u, p, t)
du[1] = p[1] * u[1] - p[2] * u[1] * u[2]
du[2] = -p[3] * u[2] + p[4] * u[1] * u[2]
end
prob = ODEProblem(lv!, [1.0, 1.0], (0.0, 10.0), [1.5, 1.0, 3.0, 1.0])Solver choice
| Solver | When |
Tsit5() | default for non-stiff; start here |
Vern7(), Vern9() | non-stiff at tight tolerance |
Rodas5P() | stiff with tight tolerance; needs a Jacobian |
TRBDF2(), KenCarp4() | stiff, large systems, cheap Jacobian |
AutoTsit5(Rosenbrock23()) | stiffness unknown or changing along the trajectory |
Euler(), RK4() | fixed step, reproducible output, or a paper's stated scheme |
Stiffness shows as a step count collapsing against tspan and a solve time far above the model's cost. Switching solver is the first move; before that, confirm the model is not the problem — a term that changes on a timescale 10^6 shorter than the phenomenon is stiff physics, and a smaller tolerance will not fix it.
using SparseDiffTools, Symbolics, SparseArrays
jac = Symbolics.jacobian_sparsity(lv!, zeros(2), [1.0, 1.0], [1.0, 1.0, 1.0, 1.0], 0.0)
f = ODEFunction(lv!; jac_prototype = float.(jac))
solve(ODEProblem(f, [1.0, 1.0], (0.0, 10.0), p), Rodas5P())Callbacks
A ContinuousCallback fires on a zero crossing of a scalar function; DiscreteCallback fires on a condition checked once per step; PeriodicCallback on a time grid. The one bug to avoid is a callback that leaves the state on the wrong side of its own condition, which fires the same event on every subsequent step — the solve slows to a crawl and the output repeats. Use terminate! to stop, and save_positions=(true,false) to record where it fired.
# Poincaré section: record every crossing of u[1] = 0, change nothing
section(u, t, integrator) = u[1]
record!(integrator) = nothing
cb = ContinuousCallback(section, record!, save_positions = (true, false))
# stop at a threshold
stop(u, t, integrator) = u[2] - 1e-6
cb_stop = ContinuousCallback(stop, terminate!)
solve(prob, Tsit5(), callback = CallbackSet(cb, cb_stop), save_everystep = false)Ensembles
prob_func(prob, i, repeat) = remake(prob; u0 = rand(2))
solve(EnsembleProblem(prob; prob_func), Tsit5(), EnsembleThreads(); trajectories = 100)Per-trajectory memory is the usual failure: EnsembleThreads allocates a solution only if save_everystep=true; for 10^5 trajectories, save reductions instead (save_everystep=false plus an output_func).
Sensitivity
ForwardDiffSensitivity | InterpolatingAdjoint | |
| parameters | fewer than ~100 | more than ~100 |
| time span | short | long |
| memory | O(N·p) | O(N) |
| typical use | small kinetic models | neural ODEs, UDEs |
solve(prob, Tsit5(); sensealg = ForwardDiffSensitivity())
solve(prob, Tsit5(); sensealg = InterpolatingAdjoint(autojacvec = ZygoteVJP()))Continuation
BifurcationKit.jl may fail to install on Julia 1.12 because MiniQhull does not build. Pin a Julia version where that dependency builds. nonlinear-dynamics carries the continuation and bifurcation workflow; the snippet below is the API shape.
using BifurcationKit
F(u, p) = @. u^3 - p.mu * u
prob = BifurcationProblem(F, [0.0], (mu = 0.0,), (@optic _.mu))
br = continuation(prob, PALC(), ContinuationPar(p_min = -1.0, p_max = 2.0, ds = 0.01))Traps
- Tolerance tighter than the model.
abstol=1e-14on a model whose parameters are known to 5% buys time, not accuracy. Set the tolerance from the error you can defend. - Fixed step for a stiff problem.
Euler()on a stiff system diverges or oscillates; the step size that works is the stability limit, not the accuracy limit. - Saving every step by default. A 10^6-step solve held in memory for a plot that needs 500 points; use
saveatorSavingCallback. - An event condition that is never exactly zero. With floating point,
u[1] == 0may never trigger; give the condition a sign change and let the solver interpolate. - Units in the parameters. A rate constant in the wrong unit makes a stiff system look non-stiff; dimensional analysis first, solver second.
Done when
Two solver families agree at ten times tighter tolerance, a conserved quantity holds to a stated tolerance, every callback fires at the expected state (and once), and the wall time is within an order of magnitude of the model's own cost times the step count.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

