# Modelling & Simulations

**URL:** https://discourse.julialang.org/c/domain/models/21.md?page=10

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

**Page:** 11

---

## [How to reinit! an integrator in a non-allocating and consistent way?](https://discourse.julialang.org/t/how-to-reinit-an-integrator-in-a-non-allocating-and-consistent-way/127771)

<div class="topic-metadata">

**Author:** [@Bart\_van\_de\_Lint](https://discourse.julialang.org/u/Bart_van_de_Lint)\
**Replies:** 10\
**Last updated:** [April 9, 2025, 6:37pm UTC](https://discourse.julialang.org/t/how-to-reinit-an-integrator-in-a-non-allocating-and-consistent-way/127771 "2025-04-09T18:37:47Z")

</div>

I am trying to create a control function from a ModelingToolkit.jl model: f(x, u, p) → x\_next I want to do that by re-initializing the integrator with the current state x and input u, and then stepping the integrator: …

---

## [Using Catalyst and Symbolics/ModelingToolkit together](https://discourse.julialang.org/t/using-catalyst-and-symbolics-modelingtoolkit-together/127601)

<div class="topic-metadata">

**Author:** [@Menno](https://discourse.julialang.org/u/Menno)\
**Replies:** 7\
**Last updated:** [April 8, 2025, 1:00pm UTC](https://discourse.julialang.org/t/using-catalyst-and-symbolics-modelingtoolkit-together/127601 "2025-04-08T13:00:21Z")

</div>

Hi there! I have been very impressed by Catalyst and using it to solve (stochastic) differential equations, but have been having trouble using the generated equations for other tasks. More specifically, I have been tryin…

---

## [SciML to solve compound interest equation](https://discourse.julialang.org/t/sciml-to-solve-compound-interest-equation/106387)

<div class="topic-metadata">

**Author:** [@Nathan\_Boyer](https://discourse.julialang.org/u/Nathan_Boyer)\
**Replies:** 5\
**Last updated:** [April 7, 2025, 5:15pm UTC](https://discourse.julialang.org/t/sciml-to-solve-compound-interest-equation/106387 "2025-04-07T17:15:17Z")

</div>

I just went through the SciML tutorials and now am trying to apply them by building a calculator for solving the compound interest equation. I have two working implementations, but neither seems very convenient. What is …

---

## [Symbolics + Gröbner basis](https://discourse.julialang.org/t/symbolics-grobner-basis/127706)

<div class="topic-metadata">

**Author:** [@BLI](https://discourse.julialang.org/u/BLI)\
**Replies:** 24\
**Last updated:** [April 7, 2025, 1:15pm UTC](https://discourse.julialang.org/t/symbolics-grobner-basis/127706 "2025-04-07T13:15:20Z")

</div>

I’m trying to find the roots of some multivariable polynomials with parameters. Just to illustrate the problem, suppose I have 2 equations, say: 0 = x^2y + 2xy - a \\\\ 0 = xy - xy^3 So I try to do the following: using…

---

## [Estimate the relation of parameter to state variable with uncertainty quantification](https://discourse.julialang.org/t/estimate-the-relation-of-parameter-to-state-variable-with-uncertainty-quantification/127450)

<div class="topic-metadata">

**Author:** [@Jack\_cooper](https://discourse.julialang.org/u/Jack_cooper)\
**Replies:** 3\
**Last updated:** [April 7, 2025, 8:48am UTC](https://discourse.julialang.org/t/estimate-the-relation-of-parameter-to-state-variable-with-uncertainty-quantification/127450 "2025-04-07T08:48:05Z")

</div>

Hi, I am new to the SciML ecosystem, and I apologise if my question is too basic. I have a 1D differential equation system, dx/dt = f(x; p), where the parameter p is a function of the state variable. Given data for the s…

---

## [Is there a way to dynamically add/remove of reactions from ReactionSystem in catalyst](https://discourse.julialang.org/t/is-there-a-way-to-dynamically-add-remove-of-reactions-from-reactionsystem-in-catalyst/127411)

<div class="topic-metadata">

**Author:** [@atiyabzafar](https://discourse.julialang.org/u/atiyabzafar)\
**Replies:** 3\
**Last updated:** [April 7, 2025, 7:22am UTC](https://discourse.julialang.org/t/is-there-a-way-to-dynamically-add-remove-of-reactions-from-reactionsystem-in-catalyst/127411 "2025-04-07T07:22:05Z")

</div>

Hi I am trying to figure out a way to dynamically add/remove reactions once I have defined a ReactionSystem programmatically. Suppose I define the system using this function. function generate\_creation(n,MAT) # Cre…

---

## [Simulating the Spherical p=2 Spin Model with DifferentialEquations.jl](https://discourse.julialang.org/t/simulating-the-spherical-p-2-spin-model-with-differentialequations-jl/127640)

<div class="topic-metadata">

**Author:** [@mtarabolo](https://discourse.julialang.org/u/mtarabolo)\
**Replies:** 1\
**Last updated:** [April 5, 2025, 1:04pm UTC](https://discourse.julialang.org/t/simulating-the-spherical-p-2-spin-model-with-differentialequations-jl/127640 "2025-04-05T13:04:11Z")

</div>

Issue: Correctly Implementing the Spherical Constraint I am working on simulating the spherical p=2 spin model using the DifferentialEquations.jl package in Julia. The model consists of N coupled stochastic differential …

---

## [Saving and loading ODEProblems created by ModelingToolkit](https://discourse.julialang.org/t/saving-and-loading-odeproblems-created-by-modelingtoolkit/127629)

<div class="topic-metadata">

**Author:** [@Bill\_Holmes](https://discourse.julialang.org/u/Bill_Holmes)\
**Replies:** 2\
**Last updated:** [April 5, 2025, 1:03pm UTC](https://discourse.julialang.org/t/saving-and-loading-odeproblems-created-by-modelingtoolkit/127629 "2025-04-05T13:03:25Z")

</div>

Hello all. I have question about the saving and loading ODEProblems created from Modeling Toolkit (MTK) models. Specifically, when I create and MTK model, build an ODE problem from that, save the ODE problem using JLD2, …

---

## [Sensitivity of an SDE with non-diagonal noise](https://discourse.julialang.org/t/sensitivity-of-an-sde-with-non-diagonal-noise/127714)

<div class="topic-metadata">

**Author:** [@stochasticguy](https://discourse.julialang.org/u/stochasticguy)\
**Replies:** 2\
**Last updated:** [April 4, 2025, 9:17pm UTC](https://discourse.julialang.org/t/sensitivity-of-an-sde-with-non-diagonal-noise/127714 "2025-04-04T21:17:10Z")

</div>

Hi everyone, I’m simulating an SDE with non-diagonal noise and I’m trying to compute the gradient (using ForwardDiff) of a loss function that uses the SDE solution. When I try to compute the gradient the following error…

---

## [Reinit! doesn't work on MTK integrators](https://discourse.julialang.org/t/reinit-doesnt-work-on-mtk-integrators/127577)

<div class="topic-metadata">

**Author:** [@Bart\_van\_de\_Lint](https://discourse.julialang.org/u/Bart_van_de_Lint)\
**Replies:** 3\
**Last updated:** [April 3, 2025, 7:07pm UTC](https://discourse.julialang.org/t/reinit-doesnt-work-on-mtk-integrators/127577 "2025-04-03T19:07:47Z")

</div>

It seems like reinit! doesn’t work for ModelingToolkit systems. Is this true, what is the workaround and why don’t I get an error or warning? Trying to run this mwe shows that the integrator state is unchanged after rein…

---

## [Detecting pitchfork bifurcations from side branch](https://discourse.julialang.org/t/detecting-pitchfork-bifurcations-from-side-branch/127558)

<div class="topic-metadata">

**Author:** [@danielwe](https://discourse.julialang.org/u/danielwe)\
**Replies:** 4\
**Last updated:** [April 2, 2025, 8:37pm UTC](https://discourse.julialang.org/t/detecting-pitchfork-bifurcations-from-side-branch/127558 "2025-04-02T20:37:52Z")

</div>

@rveltz Is BifurcationKit.jl capable of detecting a pitchfork bifurcation when the continuation approaches along a side branch? I always use detect\_bifurcation=3 as you suggested on slack, and have spent more time than I…

---

## [@brownian vector?](https://discourse.julialang.org/t/brownian-vector/97728)

<div class="topic-metadata">

**Author:** [@bjarthur](https://discourse.julialang.org/u/bjarthur)\
**Replies:** 6\
**Last updated:** [March 28, 2025, 11:35am UTC](https://discourse.julialang.org/t/brownian-vector/97728 "2025-03-28T11:35:08Z")

</div>

is there a way to create a vector of brownian variables with @brownian, much like one can create vectors of regular variables with @variables? @variables x(t)\[1:N\] y(t)\[1:N\] # works @brownian beta # works @brownian …

---

## [Save ODE solution for specific values of one state variable](https://discourse.julialang.org/t/save-ode-solution-for-specific-values-of-one-state-variable/126168)

<div class="topic-metadata">

**Author:** [@afossa](https://discourse.julialang.org/u/afossa)\
**Replies:** 2\
**Last updated:** [March 27, 2025, 6:40pm UTC](https://discourse.julialang.org/t/save-ode-solution-for-specific-values-of-one-state-variable/126168 "2025-03-27T18:40:54Z")

</div>

Hello, I am using DifferentialEquations.jl to solve a system of ordinary differential equations (an ODEProblem) of the form du = f(u, p, t) where u is a vector. One component of u, say u\[1\], is monotonically increasing…

---

## [Modeling Toolkit (v8.76) - Change parameters by reference with remake](https://discourse.julialang.org/t/modeling-toolkit-v8-76-change-parameters-by-reference-with-remake/127350)

<div class="topic-metadata">

**Author:** [@Bill\_Holmes](https://discourse.julialang.org/u/Bill_Holmes)\
**Replies:** 2\
**Last updated:** [March 26, 2025, 1:53pm UTC](https://discourse.julialang.org/t/modeling-toolkit-v8-76-change-parameters-by-reference-with-remake/127350 "2025-03-26T13:53:57Z")

</div>

Hello all. I have a question about using remake on an ODEproblem constructed using modeling toolkit (MTK). I’ll note that I’m using MTK v8.76.0. I am aware that v9 introduces new structure referencing (Frequently Asked Q…

---

## [Alternative to systune in Julia](https://discourse.julialang.org/t/alternative-to-systune-in-julia/126583)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 9\
**Last updated:** [March 25, 2025, 8:20am UTC](https://discourse.julialang.org/t/alternative-to-systune-in-julia/126583 "2025-03-25T08:20:31Z")

</div>

Is there an alternative to the Matlab command systune in Julia? systune tunes fixed-structure control systems subject to both soft and hard design goals. systune can tune multiple fixed-order, fixed-structure control e…

---

## [Conditional exact integration in ODE solving](https://discourse.julialang.org/t/conditional-exact-integration-in-ode-solving/127267)

<div class="topic-metadata">

**Author:** [@BdeKoning](https://discourse.julialang.org/u/BdeKoning)\
**Replies:** 2\
**Last updated:** [March 22, 2025, 6:57pm UTC](https://discourse.julialang.org/t/conditional-exact-integration-in-ode-solving/127267 "2025-03-22T18:57:53Z")

</div>

Say in my ODE problem I have an equation like this: \\frac{\\text{d}u\_i}{\\text{d}t} = r(\\mathbf{u})A(t) Here A(t) is a known non-negative interpolation function and r(\\mathbf{u}) is what we call a ‘reduction factor’; it…

---

## [Gradual parameter changes via callbacks](https://discourse.julialang.org/t/gradual-parameter-changes-via-callbacks/127156)

<div class="topic-metadata">

**Author:** [@vh94](https://discourse.julialang.org/u/vh94)\
**Replies:** 3\
**Last updated:** [March 21, 2025, 5:58am UTC](https://discourse.julialang.org/t/gradual-parameter-changes-via-callbacks/127156 "2025-03-21T05:58:16Z")

</div>

Problem I’m trying to change the parameter of a dynamical system gradually. In the documentation for the DifferentialEquations library there is an emphasis on abrupt / instantaneous change - when explaining callbacks ; …

---

## [Recovery model Tsodyks and Markram with Sindy DataDrivenDiffEq.jl](https://discourse.julialang.org/t/recovery-model-tsodyks-and-markram-with-sindy-datadrivendiffeq-jl/127144)

<div class="topic-metadata">

**Author:** [@Sergey\_Novak](https://discourse.julialang.org/u/Sergey_Novak)\
**Replies:** 2\
**Last updated:** [March 20, 2025, 2:40pm UTC](https://discourse.julialang.org/t/recovery-model-tsodyks-and-markram-with-sindy-datadrivendiffeq-jl/127144 "2025-03-20T14:40:08Z")

</div>

Hello, is it possible to reconstruct the Tsodyks and Markram model using SINDY? If so, how do you correctly define candidates and what to do with such a nonlinearity as a function g (E, x, u, J, I0) = α \* log (1.0 + exp …

---

## [DAEProblem and ModelingToolkit.jl](https://discourse.julialang.org/t/daeproblem-and-modelingtoolkit-jl/127097)

<div class="topic-metadata">

**Author:** [@Bart\_van\_de\_Lint](https://discourse.julialang.org/u/Bart_van_de_Lint)\
**Replies:** 4\
**Last updated:** [March 19, 2025, 11:56am UTC](https://discourse.julialang.org/t/daeproblem-and-modelingtoolkit-jl/127097 "2025-03-19T11:56:31Z")

</div>

I am a bit confused: should we use DAEProblem(sys, du0, u0, tspan) or ODEProblem(sys, u0, tspan) from a differential-algebraic system using ModelingToolkit? Using ODEProblem does work in my case, but then I cannot use DA…

---

## [Can't retrieve agent.id even though it definitely exists](https://discourse.julialang.org/t/cant-retrieve-agent-id-even-though-it-definitely-exists/127035)

<div class="topic-metadata">

**Author:** [@SageAnastasi](https://discourse.julialang.org/u/SageAnastasi)\
**Replies:** 0\
**Last updated:** [March 17, 2025, 3:03am UTC](https://discourse.julialang.org/t/cant-retrieve-agent-id-even-though-it-definitely-exists/127035 "2025-03-17T03:03:23Z")

</div>

Hi everyone, I’m trying to adapt the Schelling segregation model to run on a network graph rather than a grid space. I’ve been working from the Schelling and Schoolyard tutorials. Apologies in advance, I’m sure there’s…

---

## [Quasi-static segmented tether model](https://discourse.julialang.org/t/quasi-static-segmented-tether-model/126810)

<div class="topic-metadata">

**Author:** [@Bart\_van\_de\_Lint](https://discourse.julialang.org/u/Bart_van_de_Lint)\
**Replies:** 10\
**Last updated:** [March 14, 2025, 9:47am UTC](https://discourse.julialang.org/t/quasi-static-segmented-tether-model/126810 "2025-03-14T09:47:10Z")

</div>

I want to make a quasi-static tether model of a segmented tether. This means that I want to use a nonlinear solver to find positions, such that the acceleration of the tether points is zero. For this I need to run a nonl…

---

## [Help with misbehaving ODE simulation](https://discourse.julialang.org/t/help-with-misbehaving-ode-simulation/126936)

<div class="topic-metadata">

**Author:** [@JonathanH](https://discourse.julialang.org/u/JonathanH)\
**Replies:** 1\
**Last updated:** [March 14, 2025, 12:43am UTC](https://discourse.julialang.org/t/help-with-misbehaving-ode-simulation/126936 "2025-03-14T00:43:24Z")

</div>

Hi all, I am having some issues with a set of ODEs I am simulating with DifferentialEquations.jl and am wondering if anyone can help. Basically, the code is simulating populations of bacteria and their viruses (phage) t…

---

## [AC voltage component: system is unbalanced](https://discourse.julialang.org/t/ac-voltage-component-system-is-unbalanced/126904)

<div class="topic-metadata">

**Author:** [@sasrigais](https://discourse.julialang.org/u/sasrigais)\
**Replies:** 3\
**Last updated:** [March 13, 2025, 4:47pm UTC](https://discourse.julialang.org/t/ac-voltage-component-system-is-unbalanced/126904 "2025-03-13T16:47:07Z")

</div>

Hi there! I am trying to implement an AC voltage component, similar to Voltage from the standard library. When I try to @mtkbuild the component on its own, I get an ExtraVariablesSystemException. However, when used in …

---

## [Reinit \`tdir\` in ODEIntegrator](https://discourse.julialang.org/t/reinit-tdir-in-odeintegrator/126865)

<div class="topic-metadata">

**Author:** [@ivborissov](https://discourse.julialang.org/u/ivborissov)\
**Replies:** 2\
**Last updated:** [March 12, 2025, 8:51pm UTC](https://discourse.julialang.org/t/reinit-tdir-in-odeintegrator/126865 "2025-03-12T20:51:59Z")

</div>

Hi @ChrisRackauckas , is there a way to change integration direction with reinit! when solving an ODE? Or the only way is to remake the ODEProblem? E.g.: using OrdinaryDiffEq prob = ODEProblem((du, u, p, t) -\> du\[1\] =…

---

## [ODE solution positivity for systems biology models](https://discourse.julialang.org/t/ode-solution-positivity-for-systems-biology-models/126601)

<div class="topic-metadata">

**Author:** [@homegnome0](https://discourse.julialang.org/u/homegnome0)\
**Replies:** 24\
**Last updated:** [March 12, 2025, 6:32pm UTC](https://discourse.julialang.org/t/ode-solution-positivity-for-systems-biology-models/126601 "2025-03-12T18:32:11Z")

</div>

In solving a system of biological ODEs, for certain parameter values I am getting solutions that “erroneously” go negative. However, I found this discussion on the DifferentialEquations.jl FAQ page: “The following set o…

---

## [DifferentialEquations.jl : supplied Jacobian solution takes more time and memory](https://discourse.julialang.org/t/differentialequations-jl-supplied-jacobian-solution-takes-more-time-and-memory/126761)

<div class="topic-metadata">

**Author:** [@Sushrut\_Deshpande](https://discourse.julialang.org/u/Sushrut_Deshpande)\
**Replies:** 12\
**Last updated:** [March 12, 2025, 11:35am UTC](https://discourse.julialang.org/t/differentialequations-jl-supplied-jacobian-solution-takes-more-time-and-memory/126761 "2025-03-12T11:35:22Z")

</div>

Hello, I want to supply the Jacobian to the ODE solver, it seems to me that on supplying the Jacobian the time and memory used by the solver is more than if I hadn’t supplied. I am using sparse matrices for memory effi…

---

## [How to linearize an MTK model with internal calls to a nonlinear solver](https://discourse.julialang.org/t/how-to-linearize-an-mtk-model-with-internal-calls-to-a-nonlinear-solver/126766)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 3\
**Last updated:** [March 10, 2025, 6:08pm UTC](https://discourse.julialang.org/t/how-to-linearize-an-mtk-model-with-internal-calls-to-a-nonlinear-solver/126766 "2025-03-10T18:08:28Z")

</div>

If I have an MTK model that contains one registered, numeric function, and this numeric function itself uses a nonlinear solver to find a solution… Can I still linearize the MTK model in the normal way?

---

## [Sundials KLU issue with Jacobian prototype](https://discourse.julialang.org/t/sundials-klu-issue-with-jacobian-prototype/126655)

<div class="topic-metadata">

**Author:** [@flothostre](https://discourse.julialang.org/u/flothostre)\
**Replies:** 2\
**Last updated:** [March 10, 2025, 8:25am UTC](https://discourse.julialang.org/t/sundials-klu-issue-with-jacobian-prototype/126655 "2025-03-10T08:25:41Z")

</div>

Hi everyone, I am currently encountering issues when solving large (2814 states) stiff DAE problems (energy system time domain simulations) in Sundials IDA with the KLU linear solver (to exploit the inherent sparsity of…

---

## [ModelingToolkitDesigner Example issue](https://discourse.julialang.org/t/modelingtoolkitdesigner-example-issue/126705)

<div class="topic-metadata">

**Author:** [@jaksaa](https://discourse.julialang.org/u/jaksaa)\
**Replies:** 1\
**Last updated:** [March 8, 2025, 8:10pm UTC](https://discourse.julialang.org/t/modelingtoolkitdesigner-example-issue/126705 "2025-03-08T20:10:49Z")

</div>

ModelingToolkitDesigner example: ModelingToolkitDesigner.jl/examples/electrical.jl at master · bradcarman/ModelingToolkitDesigner.jl · GitHub Copied the example into a file.jl Then did include(“file.jl”) The linking …

---

## [NonlinearSolve stalls when Jacobian is specified](https://discourse.julialang.org/t/nonlinearsolve-stalls-when-jacobian-is-specified/126659)

<div class="topic-metadata">

**Author:** [@clm](https://discourse.julialang.org/u/clm)\
**Replies:** 4\
**Last updated:** [March 7, 2025, 9:58pm UTC](https://discourse.julialang.org/t/nonlinearsolve-stalls-when-jacobian-is-specified/126659 "2025-03-07T21:58:50Z")

</div>

I’m currently trying to solve a non-linear system, but I get a stalled retcode when I specify a jacobian. Specifically, I’d trying to solve a discretized PDE using a home-made backward Euler stepper. The spatial domain …

[Previous page](https://discourse.julialang.org/c/domain/models/21.md?page=9)

[Next page](https://discourse.julialang.org/c/domain/models/21.md?page=11)
