Logo : Numerical Integration

Numerical Integration

Communauté
HeshamFS
numerical-integration

Sélectionnez et configurez des méthodes d’intégration temporelle pour les simulations d’EDO et d’EDP : choisissez parmi les familles Runge-Kutta explicite, BDF, Rosenbrock et Adams, définissez des tolérances d’erreur relatives et absolues, mettez en œuvre un contrôle adaptatif du pas avec des régulateurs P/PI, planifiez un découpage opérateur IMEX pour les termes mixtes raides et non raides, et estimez les erreurs de découpage. À utiliser pour choisir un intégrateur pour une nouvelle simulation, diagnostiquer des rejets de pas ou des problèmes de tolérance, configurer un découpage opérateur pour des problèmes de champ de phase ou de réaction-diffusion, ou décider entre une intégration temporelle explicite et implicite, même si l’utilisateur dit simplement « mon solveur rejette sans cesse des pas » ou « quelle méthode d’EDO dois-je utiliser ? ».

Add to TypingMind

Présentation

ÉditeurHeshamFS
Dépôtmaterials-simulation-skills
Nom de la compétencenumerical-integration
Étoiles
83
Forks
6
Fichiers inclus
13
LicenceApache-2.0
Liens
  • Instructions en Markdown

    Un fichier SKILL.md que le modèle charge à la demande : il ne consomme donc des tokens que lorsqu’une demande correspond réellement à la compétence.

  • Compatible avec tous les LLM

    Les compétences IA sont rédigées en Markdown et non sous forme de code propre à un fournisseur. Elles fonctionnent donc avec GPT, Claude, Gemini, Grok ou un modèle local.

  • Fichiers inclus : 13

    Des scripts, des gabarits et des références que le modèle peut consulter pendant son travail. Les fichiers sont en lecture seule et ne sont jamais exécutés.

  • Open source

    Publiée par HeshamFS sur GitHub. Consultez les sources avant de l’installer.

Installation

Installez la compétence IA Numerical Integration dans TypingMind pour l’utiliser avec n’importe quel LLM, ou ajoutez-la à un autre agent capable de lire SKILL.md.

1

Installer dans TypingMind

TypingMind installe une compétence directement depuis son dossier GitHub : l’application lit SKILL.md, regroupe les fichiers de ressources et enregistre le tout localement.

  1. Ouvrez l’application et accédez à Plugins → Compétences.
  2. Choisissez « Installer depuis GitHub ».
  3. Copiez l’URL ci-dessous, qui pointe vers le dossier de la compétence, puis collez-la et confirmez.
    https://github.com/HeshamFS/materials-simulation-skills/tree/main/skills/core-numerical/numerical-integration
  4. Activez la compétence dans chaque discussion où vous souhaitez pouvoir l’utiliser.
Plugins → Compétences → Ajouter une compétence → Via une URL GitHub, puis collez l’URL du dossier et appuyez sur Continuer.
2

Installer dans un autre agent

Tout agent capable de lire le format Agent Skills peut utiliser cette compétence : copiez le dossier dans le répertoire des compétences de cet agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/HeshamFS/materials-simulation-skills.git /tmp/materials-simulation-skills
mkdir -p .claude/skills
cp -r /tmp/materials-simulation-skills/skills/core-numerical/numerical-integration .claude/skills/numerical-integration
Redémarrez Claude Code après la copie pour que la nouvelle compétence soit prise en compte.

Utilisez cette compétence dans TypingMind

Activez Numerical Integration dans n’importe quelle discussion TypingMind et le modèle s’occupe du reste. Le nom et la description de la compétence figurent dans le prompt système. Dès qu’une demande correspond, le modèle charge lui-même l’intégralité des instructions : vous n’avez jamais à l’invoquer manuellement, et elle ne consomme aucun token tant qu’elle n’est pas utilisée.

Le modèle charge automatiquement Numerical Integration dès qu’une demande correspond à cette compétence.

Compatible avec tous les modèles IA

Les compétences IA sont de simples instructions Markdown, et non du code propre à un fournisseur. Ainsi, la compétence Numerical Integration n’est pas liée au modèle pour lequel elle a été conçue. Installez-la une seule fois dans TypingMind et utilisez-la avec GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ou un modèle local que vous exécutez vous-même, le tout avec vos propres clés API.

  • Chargée uniquement en cas de besoin

    Le prompt système ne contient que le nom et la description. Les instructions sont récupérées à la première demande correspondante : une compétence inutilisée ne coûte donc rien.

  • Changez de modèle en cours de discussion

    La compétence étant constituée d’instructions et non de code, elle reste fonctionnelle lorsque vous changez de modèle : le nouveau modèle lit le même fichier SKILL.md.

Instructions de la compétence

Voici le contenu de SKILL.md que le modèle charge. Lisez-le avant l’installation : une compétence contient des instructions que votre modèle suivra.

Numerical Integration

Goal

Provide a reliable workflow to select integrators, set tolerances, and manage adaptive time stepping for time-dependent simulations.

Requirements

  • Python 3.10+
  • NumPy (for some scripts)
  • No heavy dependencies for core functionality

Inputs to Gather

InputDescriptionExample
Problem typeODE/PDE, stiff/non-stiffstiff PDE
Jacobian availableCan compute ∂f/∂u?yes
Target accuracyDesired error level1e-6
ConstraintsMemory, implicit allowed?implicit OK
Time scaleCharacteristic time1e-3 s

Decision Guidance

Choosing an Integrator

Is the problem stiff?
├── YES → Is Jacobian available?
│   ├── YES → Use Rosenbrock or BDF
│   └── NO → Use BDF with numerical Jacobian
└── NO → Is high accuracy needed?
    ├── YES → Use RK45 or DOP853
    └── NO → Use RK4 or Adams-Bashforth

Stiff vs Non-Stiff Detection

SymptomLikely StiffAction
dt shrinks to tiny valuesYesSwitch to implicit
Eigenvalues span many decadesYesUse BDF/Radau
Smooth solution, reasonable dtNoStay explicit

Script Outputs (JSON Fields)

ScriptKey Outputs
scripts/error_norm.pyerror_norm, scale_min, scale_max
scripts/adaptive_step_controller.pyaccept, dt_next, factor
scripts/integrator_selector.pyrecommended, alternatives, notes
scripts/imex_split_planner.pyimplicit_terms, explicit_terms, splitting_strategy
scripts/splitting_error_estimator.pyerror_estimate, substeps

Workflow

  1. Classify stiffness - Check eigenvalue spread or use stiffness_detector
  2. Choose tolerances - See references/tolerance_guidelines.md
  3. Select integrator - Run scripts/integrator_selector.py
  4. Compute error norms - Use scripts/error_norm.py for step acceptance
  5. Adapt step size - Use scripts/adaptive_step_controller.py
  6. Plan IMEX/splitting - If mixed stiff/nonstiff, use scripts/imex_split_planner.py
  7. Validate convergence - Repeat with tighter tolerances

Conversational Workflow Example

User: I'm solving the Allen-Cahn equation with a stiff double-well potential. What integrator should I use?

Agent workflow:

  1. Check integrator options:
    bash
    python3 scripts/integrator_selector.py --stiff --jacobian-available --accuracy high --json
  2. Plan the IMEX splitting (diffusion implicit, reaction explicit):
    bash
    python3 scripts/imex_split_planner.py --stiff-terms diffusion --nonstiff-terms reaction --coupling weak --json
  3. Recommend: Use IMEX-BDF2 with diffusion term implicit, double-well reaction explicit.

Pre-Integration Checklist

  • Identify stiffness and dominant time scales
  • Set rtol/atol consistent with physics and units
  • Confirm integrator compatibility with stiffness
  • Use error norm to accept/reject steps
  • Verify convergence with tighter tolerance run

CLI Examples

bash
# Select integrator for stiff problem with Jacobian
python3 scripts/integrator_selector.py --stiff --jacobian-available --accuracy high --json

# Compute scaled error norm
python3 scripts/error_norm.py --error 0.01,0.02 --solution 1.0,2.0 --rtol 1e-3 --atol 1e-6 --json

# Adaptive step control with PI controller
python3 scripts/adaptive_step_controller.py --dt 1e-2 --error-norm 0.8 --order 4 --controller pi --json

# Plan IMEX splitting
python3 scripts/imex_split_planner.py --stiff-terms diffusion,elastic --nonstiff-terms reaction --coupling strong --json

# Estimate splitting error
python3 scripts/splitting_error_estimator.py --dt 1e-4 --scheme strang --commutator-norm 50 --target-error 1e-6 --json

Error Handling

ErrorCauseResolution
rtol must be a non-negative finite number / atol must be a non-negative finite numberInvalid tolerancesUse non-negative finite values
error_norm must be finite and non-negativeNegative or non-finite error normCheck error computation
scale must be positive; with min_scale=0 ensure atol>0 or rtol*|y|>0All scale entries collapsed to 0 (e.g. rtol=0, atol=0, default min_scale=0)Set atol>0, rtol>0, or --min-scale > 0
argument --controller: invalid choice: ... (choose from p, pi)Invalid controller typeUse p or pi
Provide at least one stiff or non-stiff termEmpty term listSpecify stiff or nonstiff terms

Interpretation Guidance

Error Norm Values

Error NormMeaningAction
< 1.0Step acceptableAccept, maybe increase dt
≈ 1.0At tolerance boundaryAccept with current dt
> 1.0Step rejectedReject, reduce dt

Controller Selection

ControllerCLI valuePropertiesBest For
P (elementary / integral)p (default)Simple, some overshootNon-stiff, moderate accuracy
PI (proportional-integral)piSmooth, robust (requires --prev-error)General use

PID control is described in references/error_control.md for reference only; the adaptive_step_controller.py CLI implements p and pi controllers.

IMEX Strategy

CouplingStrategy
WeakSimple operator splitting
ModerateStrang splitting
StrongFully coupled IMEX-RK

Verification checklist

  • Recorded the scaled error_norm (and scale_min/scale_max) from scripts/error_norm.py and confirmed scale_min > 0, so no component reduced to atol-only scaling by accident.
  • Confirmed each accepted step has error_norm <= accept_threshold (default 1.0) per scripts/adaptive_step_controller.py; logged any accept: false steps and the resulting dt_next/factor rather than forcing the step through.
  • For the PI controller, supplied --prev-error and verified controller_used reported pi (not the silent p fallback that occurs when --prev-error is omitted).
  • Ran scripts/integrator_selector.py with the actual --stiff/--jacobian-available/--accuracy flags matching the problem and recorded recommended plus the notes (e.g. the "expect smaller dt" warning for stiff-without-implicit).
  • For operator splitting, recorded error_estimate, substeps, and dt_effective from scripts/splitting_error_estimator.py and confirmed error_estimate <= target-error after substepping, using the correct --scheme order (lie=1, strang=2).
  • Ran the convergence validation (Workflow step 7): repeated with tighter rtol/atol and confirmed the solution change is below the target accuracy, rather than trusting a single tolerance run.

Common pitfalls & rationalizations

Tempting shortcutWhy it's wrong / what to do
"I picked an implicit/BDF method, so any dt is fine."Unconditional stability is not accuracy; large dt still inflates temporal error. Check error_norm against the accept threshold and run the tighter-tolerance convergence check (Workflow step 7).
"error_norm came back < 1, so the step and the whole run are correct."The norm only certifies the local step under the chosen rtol/atol. A loose tolerance passes every step while the global solution is wrong — tighten tolerances and confirm convergence before trusting results.
"I'll use the PI controller for smoother stepping" but omit --prev-error.Without --prev-error the script silently falls back to the P controller (controller_used: p). You get no PI benefit. Pass the previous accepted error_norm and verify controller_used: pi.
"Strang vs Lie splitting won't matter much here."Splitting error scales as commutator_norm * dt^(order+1) with order 1 (lie) vs 2 (strang). For a nonzero commutator the schemes differ by a full power of dt — run splitting_error_estimator.py with the actual --commutator-norm and --target-error instead of guessing.
"The selector recommended IMEX/RK-Chebyshev, so I'll just run explicitly without a Jacobian."That branch fires only for stiff problems without implicit solves and the script warns "expect smaller dt." Read the notes: provide a Jacobian/Jv product and use BDF/Radau if implicit solves are feasible.
"It ran to the final time without crashing, so the integration is valid."Completion is not correctness. Verify step acceptance (error_norm <= threshold), splitting error within target-error, and convergence under tighter tolerances; for conservative problems pass --conservative to imex_split_planner.py and check conserved quantities.

Security

Input Validation

  • All numeric inputs (dt, rtol, atol, error_norm, stiffness_ratio, commutator_norm, etc.) are validated as finite numbers at the function boundary
  • imex_split_planner.py validates term names against [a-zA-Z_][a-zA-Z0-9_ -]* with length and count limits, preventing injection payloads in user-supplied term lists
  • Comma-separated value lists are capped at 100,000 entries to prevent resource exhaustion
  • Numeric bounds enforced: dimension capped at 10 billion, order at 20, stiffness_ratio at 1e30
  • --controller is validated against a fixed allowlist (p, pi)
  • --scheme is validated against known splitting schemes (lie, strang)

File Access

  • Scripts read no external files; all inputs are provided via CLI arguments
  • Scripts write only to stdout (JSON output); no files are created unless the agent explicitly uses the Write tool

Tool Restrictions

  • Read: Used to inspect script source, references, and user configuration files
  • Write: Used to save integrator recommendations or splitting plans; writes are scoped to the user's working directory
  • Grep/Glob: Used to locate relevant files and search references
  • The skill's allowed-tools excludes Bash to prevent the agent from executing arbitrary commands when processing user-provided inputs

Safety Measures

  • No eval(), exec(), or dynamic code generation
  • All subprocess calls use explicit argument lists (no shell=True)
  • Reduced tool surface (no Bash) limits the agent to read/write operations only
  • Term names are sanitized before use, preventing shell metacharacter injection

Limitations

  • No automatic stiffness detection: Use stiffness_detector from numerical-stability
  • Splitting assumes separability: Terms must be cleanly separable
  • Jacobian requirement: Some methods need analytical or numerical Jacobian

References

  • references/method_catalog.md - Integrator options and properties
  • references/tolerance_guidelines.md - Choosing rtol/atol
  • references/error_control.md - Error norm and adaptation formulas
  • references/imex_guidelines.md - Stiff/non-stiff splitting
  • references/splitting_catalog.md - Operator splitting patterns
  • references/multiphase_field_patterns.md - Phase-field specific splits

Version History

  • v1.2.3 (2026-10-19): Compute Euclidean error norms without avoidable squaring overflow or underflow.

  • v1.2.2 (2026-06-24): Added Verification checklist and Common pitfalls & rationalizations sections grounding step acceptance, PI controller usage, integrator selection, and splitting-error checks in the scripts' actual outputs

  • v1.2.0 (2026-06-23): Fixed PI controller coefficient/sign to standard form, fixed error_norm scale-collapse crash, corrected error-message and controller documentation to match the scripts

  • v1.1.0 (2024-12-24): Enhanced documentation, decision guidance, examples

  • v1.0.0: Initial release with 5 integration scripts

Fichiers inclus

Le modèle lit ces fichiers à la demande lorsque la compétence est chargée. Ils sont accessibles en lecture et ne sont jamais exécutés.

Foire aux questions

À quoi sert la compétence IA Numerical Integration ?

Sélectionnez et configurez des méthodes d’intégration temporelle pour les simulations d’EDO et d’EDP : choisissez parmi les familles Runge-Kutta explicite, BDF, Rosenbrock et Adams, définissez des tolérances d’erreur relatives et absolues, mettez en œuvre un contrôle adaptatif du pas avec des régulateurs P/PI, planifiez un découpage opérateur IMEX pour les termes mixtes raides et non raides, et estimez les erreurs de découpage. À utiliser pour choisir un intégrateur pour une nouvelle simulation, diagnostiquer des rejets de pas ou des problèmes de tolérance, configurer un découpage opérateur...

Pourquoi utiliser Numerical Integration sur TypingMind ?

Parce que vous l’installez une seule fois pour l’utiliser avec n’importe quel modèle. Numerical Integration se compose de simples instructions en Markdown plutôt que de code propre à un fournisseur. La même compétence fonctionne donc avec GPT-5, Claude, Gemini, Grok ou un modèle local, et vous pouvez changer de modèle en cours de discussion sans perturber son fonctionnement. TypingMind utilise vos propres clés API : vous payez donc directement les fournisseurs plutôt qu’un abonnement par siège, et vos compétences et discussions restent dans votre propre espace de stockage.

Comment installer Numerical Integration dans TypingMind ?

Dans TypingMind, ouvrez Plugins → Compétences → Installer depuis GitHub et collez https://github.com/HeshamFS/materials-simulation-skills/tree/main/skills/core-numerical/numerical-integration. TypingMind lit le fichier SKILL.md, regroupe les fichiers associés et installe le tout sous forme de compétence que vous pouvez activer pour chaque discussion.

Quels modèles d’IA peuvent utiliser Numerical Integration ?

N’importe quel modèle que vous connectez dans TypingMind. Les compétences IA sont de simples instructions en Markdown, et non du code propre à un fournisseur. GPT, Claude, Gemini, Grok et les modèles locaux peuvent donc tous charger cette compétence lorsqu’une demande lui correspond.

Combien de modèles d’IA puis-je utiliser avec Numerical Integration ?

Autant que vous le souhaitez. Vous pouvez utiliser Numerical Integration avec tout modèle qui prend en charge les compétences : GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama et bien d’autres, le tout dans TypingMind avec vos propres clés API.

La compétence IA Numerical Integration est-elle gratuite ?

Oui. Cette compétence est publiée sur GitHub par HeshamFS sous licence Apache-2.0. Vous ne payez que votre propre fournisseur d’IA pour les tokens utilisés.

Que sont les compétences IA ?

Une compétence IA est un ensemble d’instructions réutilisables qui apprend à un modèle d’IA à accomplir une tâche précise. Elle suit le format ouvert Agent Skills : un fichier SKILL.md contenant un nom et une description, ainsi que les éventuels scripts, gabarits ou fichiers de référence dont le modèle peut avoir besoin. Le modèle ne lit les instructions que lorsque votre demande correspond à la compétence. Une compétence installée ne coûte donc rien tant qu’elle n’est pas utilisée.

En quoi les compétences IA diffèrent-elles des plugins ou des serveurs MCP ?

Un plugin ou un serveur MCP fournit au modèle de nouveaux outils à appeler : du code qui s’exécute quelque part et renvoie un résultat. Une compétence IA lui apporte plutôt des connaissances et une méthode : comment aborder une tâche, quelles étapes suivre et à quoi ressemble un bon résultat. Les compétences sont de simples instructions en Markdown. Elles ne nécessitent donc ni serveur, ni clé API, ni environnement d’exécution, et fonctionnent avec n’importe quel modèle.

Tout voir

Créez votre propre espace de travail IA dès maintenant

Abonnez-vous à notre newsletter pour être informé des nouvelles fonctionnalités et des prochains cadeaux à gagner 👇