From 0fed1d09d79681332230a276176de15e2f3b36af Mon Sep 17 00:00:00 2001 From: ChrisRackauckas Date: Wed, 23 Jul 2025 16:01:45 -0400 Subject: [PATCH] Document how to mutate parameters p in integrator (fixes #243) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add documentation explaining that parameters can be modified directly via `integrator.p = new_p`, unlike u and t which require setter functions. This addresses the user's question about how to change the differential equation parameters during integration, particularly in callbacks. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- docs/src/basics/integrator.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/src/basics/integrator.md b/docs/src/basics/integrator.md index 3b970c878..fb19fd951 100644 --- a/docs/src/basics/integrator.md +++ b/docs/src/basics/integrator.md @@ -144,6 +144,13 @@ As low-level alternative to the callbacks, one can use `set_t!`, `set_u!` and have efficient ways to modify `u` and `t`. In such case, `set_*!` are as inefficient as `reinit!`. +For modifying parameters `p`, you can directly assign to the field: +```julia +integrator.p = new_p +``` +Unlike `u` or `t`, changing `p` doesn't affect the solver's internal state or +accuracy, so it can be modified directly without a setter function. + ```@docs SciMLBase.set_t! SciMLBase.set_u!