# Modelling & Simulations

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

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

**Page:** 38

---

## [MTK & Linearization](https://discourse.julialang.org/t/mtk-linearization/95803)

<div class="topic-metadata">

**Author:** [@BLI](https://discourse.julialang.org/u/BLI)\
**Replies:** 26\
**Last updated:** [March 23, 2023, 11:29am UTC](https://discourse.julialang.org/t/mtk-linearization/95803 "2023-03-23T11:29:34Z")

</div>

MTK documentation case I’m looking at the linearization example in the MTK documentation: using ModelingToolkit @variables t x(t)=0 y(t)=0 u(t)=0 r(t)=0 @parameters kp = 1 D = Differential(t) eqs = \[u ~ kp \* (r - y) # …

---

## [MTK and Jacobian](https://discourse.julialang.org/t/mtk-and-jacobian/96075)

<div class="topic-metadata">

**Author:** [@BLI](https://discourse.julialang.org/u/BLI)\
**Replies:** 5\
**Last updated:** [March 23, 2023, 11:22am UTC](https://discourse.julialang.org/t/mtk-and-jacobian/96075 "2023-03-23T11:22:14Z")

</div>

I have an unbalanced/partial model consisting of 2 differential equations, 11 algebraic equations, and 17 unknowns/states. I want to compute the Jacobian of the model. I have 3 questions regarding the calculate\_jacobian …

---

## [DynamicalSystems: dynamic rule evaluates to nonzero but trajectory stays at initial condition](https://discourse.julialang.org/t/dynamicalsystems-dynamic-rule-evaluates-to-nonzero-but-trajectory-stays-at-initial-condition/96481)

<div class="topic-metadata">

**Author:** [@cjoshliu](https://discourse.julialang.org/u/cjoshliu)\
**Replies:** 3\
**Last updated:** [March 22, 2023, 10:25pm UTC](https://discourse.julialang.org/t/dynamicalsystems-dynamic-rule-evaluates-to-nonzero-but-trajectory-stays-at-initial-condition/96481 "2023-03-22T22:25:02Z")

</div>

Hi, I’m new to Julia and trying to find fixed points of an s-species generalized Lotka-Volterra model using DynamicalSystems. My model is d\_t\\vec{u}=\\vec{\\lambda}+\\vec{r}\\cdot\\vec{u}\\cdot (1-\\hat{\\alpha}\\vec{u}) where \\…

---

## [How to solve a Markov decision process with randomness](https://discourse.julialang.org/t/how-to-solve-a-markov-decision-process-with-randomness/96426)

<div class="topic-metadata">

**Author:** [@Jian\_ZUO](https://discourse.julialang.org/u/Jian_ZUO)\
**Replies:** 0\
**Last updated:** [March 22, 2023, 12:24am UTC](https://discourse.julialang.org/t/how-to-solve-a-markov-decision-process-with-randomness/96426 "2023-03-22T00:24:21Z")

</div>

Hi, I have a Markov decision process as follows: states: S1, S2; the increment of S1 follows a Gamma law, i.e. S1(t+d)-S1(t) ~ gamma(alpha, beta), S1 has a fixed range of zero to a failure threshold FT (thus the transi…

---

## [How to optimize Jacobian ForwardDiff.jl](https://discourse.julialang.org/t/how-to-optimize-jacobian-forwarddiff-jl/96177)

<div class="topic-metadata">

**Author:** [@Sergey\_Novak](https://discourse.julialang.org/u/Sergey_Novak)\
**Replies:** 2\
**Last updated:** [March 20, 2023, 8:20am UTC](https://discourse.julialang.org/t/how-to-optimize-jacobian-forwarddiff-jl/96177 "2023-03-20T08:20:41Z")

</div>

Hello, I manual calculate Jacobian for the system function TM(u, p, t) U(y) = p\[8\] + p\[9\] / ( 1.0 + exp( -50.0 \* (y - p\[7\]) ) ) σ(x) = 1.0 / ( 1.0 + exp( -20.0 \* (x-p\[6\]) ) ) du1 = (-u\[1\] + p\[1\] \* log( 1.0 +…

---

## [High allocations count for TwoPointBVProblem in DifferentialEquations.jl](https://discourse.julialang.org/t/high-allocations-count-for-twopointbvproblem-in-differentialequations-jl/96296)

<div class="topic-metadata">

**Author:** [@Hawkes](https://discourse.julialang.org/u/Hawkes)\
**Replies:** 4\
**Last updated:** [March 19, 2023, 11:22am UTC](https://discourse.julialang.org/t/high-allocations-count-for-twopointbvproblem-in-differentialequations-jl/96296 "2023-03-19T11:22:52Z")

</div>

Hi, I’m currently trying to port some simulation code from Python to Julia. The Python version uses scipy’s solve\_bvp function to solve a two point boundary value problem. I am using DifferentialEquations.jl to accompl…

---

## [RNG in DiscreteProblem solver](https://discourse.julialang.org/t/rng-in-discreteproblem-solver/95929)

<div class="topic-metadata">

**Author:** [@sdwfrost](https://discourse.julialang.org/u/sdwfrost)\
**Replies:** 3\
**Last updated:** [March 18, 2023, 10:48am UTC](https://discourse.julialang.org/t/rng-in-discreteproblem-solver/95929 "2023-03-18T10:48:46Z")

</div>

Hi everyone, I have a DiscreteProblem that uses a random number generator, and I’d like to make it reproducible. In the solver for SDEProblems, I can specify a seed (if not an RNG) - do I need to compose a new init/step!…

---

## [Solving ODEs in parallel on a supercomputer](https://discourse.julialang.org/t/solving-odes-in-parallel-on-a-supercomputer/95637)

<div class="topic-metadata">

**Author:** [@Nick1](https://discourse.julialang.org/u/Nick1)\
**Replies:** 8\
**Last updated:** [March 18, 2023, 4:01am UTC](https://discourse.julialang.org/t/solving-odes-in-parallel-on-a-supercomputer/95637 "2023-03-18T04:01:01Z")

</div>

Hi everyone, I would like to solve ODEs in parallel on a supercomputer. I can use one or more nodes and multiple cores per node. There is also the option for node sharing. The job scheduler for the supercomputer is slur…

---

## [Parallelize GSA on continuous outputs](https://discourse.julialang.org/t/parallelize-gsa-on-continuous-outputs/95964)

<div class="topic-metadata">

**Author:** [@xztt](https://discourse.julialang.org/u/xztt)\
**Replies:** 12\
**Last updated:** [March 16, 2023, 5:29pm UTC](https://discourse.julialang.org/t/parallelize-gsa-on-continuous-outputs/95964 "2023-03-16T17:29:51Z")

</div>

Hi there, I am just wondering how I could adapt the GSA example in the docs such that it performs Sobol analysis on the continuous outputs instead of the discrete outputs. sol\[1,:\] & sol\[2,:\] I have tried multiple diff…

---

## [Help with optimizing a particle filter in SciML](https://discourse.julialang.org/t/help-with-optimizing-a-particle-filter-in-sciml/96138)

<div class="topic-metadata">

**Author:** [@sdwfrost](https://discourse.julialang.org/u/sdwfrost)\
**Replies:** 8\
**Last updated:** [March 16, 2023, 3:48pm UTC](https://discourse.julialang.org/t/help-with-optimizing-a-particle-filter-in-sciml/96138 "2023-03-16T15:48:31Z")

</div>

Hi everyone, I’m trying to put together a demonstration of a very simple particle filter for my repository https://github.com/epirecipes/sir-julia. This involves: Setting up an array of simulations. Simulating for a s…

---

## [Fixedpoints DynamicalSystems.jl](https://discourse.julialang.org/t/fixedpoints-dynamicalsystems-jl/96004)

<div class="topic-metadata">

**Author:** [@Sergey\_Novak](https://discourse.julialang.org/u/Sergey_Novak)\
**Replies:** 2\
**Last updated:** [March 13, 2023, 2:05pm UTC](https://discourse.julialang.org/t/fixedpoints-dynamicalsystems-jl/96004 "2023-03-13T14:05:47Z")

</div>

Hello, how can i automaticaly calculate Jacobian? I have next system and manual calculate Jacobian is hard Code: function TM(u, p, t) U(y) = p\[8\] + p\[9\] / ( 1.0 + exp( -50.0 \* (y - p\[7\]) ) ) σ(x) = 1.0 / ( 1…

---

## [Find homoclinic DifferentialEquations.jl, DynamicalSystems.jl](https://discourse.julialang.org/t/find-homoclinic-differentialequations-jl-dynamicalsystems-jl/95800)

<div class="topic-metadata">

**Author:** [@Sergey\_Novak](https://discourse.julialang.org/u/Sergey_Novak)\
**Replies:** 17\
**Last updated:** [March 13, 2023, 5:46am UTC](https://discourse.julialang.org/t/find-homoclinic-differentialequations-jl-dynamicalsystems-jl/95800 "2023-03-13T05:46:24Z")

</div>

Hello, I’m trying to find a homoclinic orbit. To do this, I calculate a very long trajectory, and then calculate the minimum distance between all points of the trajectory and a fixed point. How can I optimize this? Frag…

---

## [ControlSystemIdentification](https://discourse.julialang.org/t/controlsystemidentification/95794)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 12\
**Last updated:** [March 10, 2023, 1:18pm UTC](https://discourse.julialang.org/t/controlsystemidentification/95794 "2023-03-10T13:18:07Z")

</div>

Hello, I am trying out the package ControlSystemIdentification. It looks very good, each step very well explained! One question: In the example Temperature control · ControlSystemIdentification Documentation you are u…

---

## [SciMLSensitivity.jl : adjoint\_sensitivities and CVODE\_BDF crashes for medium sized stiff ODE model](https://discourse.julialang.org/t/scimlsensitivity-jl-adjoint-sensitivities-and-cvode-bdf-crashes-for-medium-sized-stiff-ode-model/95667)

<div class="topic-metadata">

**Author:** [@sebapersson](https://discourse.julialang.org/u/sebapersson)\
**Replies:** 11\
**Last updated:** [March 9, 2023, 11:35pm UTC](https://discourse.julialang.org/t/scimlsensitivity-jl-adjoint-sensitivities-and-cvode-bdf-crashes-for-medium-sized-stiff-ode-model/95667 "2023-03-09T23:35:43Z")

</div>

We have recently done some benchmarks to test the performance of DifferentialEquations.jl for parameter estimation for ODE models in the field of system biology. Overall, DifferentialEquations has performed great, but we…

---

## [Catalyst.jl: Algebraically relate two species](https://discourse.julialang.org/t/catalyst-jl-algebraically-relate-two-species/95762)

<div class="topic-metadata">

**Author:** [@Theodore\_Rieger](https://discourse.julialang.org/u/Theodore_Rieger)\
**Replies:** 2\
**Last updated:** [March 9, 2023, 1:45am UTC](https://discourse.julialang.org/t/catalyst-jl-algebraically-relate-two-species/95762 "2023-03-09T01:45:40Z")

</div>

Using Catalyst.jl (DSL) to develop a model with pharmacology. The drug concentration is tracked in milligrams, but the pharmacology requires an algebraic transformation to ng/mL-unbound (multiplication by a few parameter…

---

## [Is the choice of integrator significant for NeuralODE solving?](https://discourse.julialang.org/t/is-the-choice-of-integrator-significant-for-neuralode-solving/95645)

<div class="topic-metadata">

**Author:** [@srikumarks](https://discourse.julialang.org/u/srikumarks)\
**Replies:** 1\
**Last updated:** [March 8, 2023, 1:49pm UTC](https://discourse.julialang.org/t/is-the-choice-of-integrator-significant-for-neuralode-solving/95645 "2023-03-08T13:49:43Z")

</div>

For directly solving known ODEs, of course the choice of integrator is significant. However, when learning a network that’s part of an ODE, it isn’t clear to me whether the integrator matters, or should matter. Does it …

---

## [In-place functions in definition of ODEProblem (DifferentialEquations)](https://discourse.julialang.org/t/in-place-functions-in-definition-of-odeproblem-differentialequations/30029)

<div class="topic-metadata">

**Author:** [@zdenek\_hurak](https://discourse.julialang.org/u/zdenek_hurak)\
**Replies:** 9\
**Last updated:** [March 8, 2023, 12:08pm UTC](https://discourse.julialang.org/t/in-place-functions-in-definition-of-odeproblem-differentialequations/30029 "2023-03-08T12:08:21Z")

</div>

I am struggling with something as basic as definition of a function for ODEProblem using DifferentialEquations package: In Example 1 in the documentation for the package, the ODE is defined by a function on the right ha…

---

## [Replication of \*Universal Differential Equations for Scientific Machine Learning\* for Lotka Volterra](https://discourse.julialang.org/t/replication-of-universal-differential-equations-for-scientific-machine-learning-for-lotka-volterra/95695)

<div class="topic-metadata">

**Author:** [@Stefano\_Giampiccolo](https://discourse.julialang.org/u/Stefano_Giampiccolo)\
**Replies:** 1\
**Last updated:** [March 8, 2023, 4:16am UTC](https://discourse.julialang.org/t/replication-of-universal-differential-equations-for-scientific-machine-learning-for-lotka-volterra/95695 "2023-03-08T04:16:36Z")

</div>

Hi everyone, I’m trying to replicate the results of Scenario 1 Lotka Volterra from the repository GitHub - ChrisRackauckas/universal\_differential\_equations: Repository for the Universal Differential Equations for Scient…

---

## [Request for contributions: PDESystemLibrary.jl - A library of systems of symbolic partial differential equations](https://discourse.julialang.org/t/request-for-contributions-pdesystemlibrary-jl-a-library-of-systems-of-symbolic-partial-differential-equations/95639)

<div class="topic-metadata">

**Author:** [@xtalax](https://discourse.julialang.org/u/xtalax)\
**Replies:** 2\
**Last updated:** [March 7, 2023, 8:42pm UTC](https://discourse.julialang.org/t/request-for-contributions-pdesystemlibrary-jl-a-library-of-systems-of-symbolic-partial-differential-equations/95639 "2023-03-07T20:42:46Z")

</div>

Announcing PDESystemLibrary.jl, a library of symbolically defined PDESystems using ModelingToolkit.jl. We have a few (over 400) systems already included as a start, with more being added all the time. We really want to …

---

## [ODE with heterogeneous input through RecursiveArrayTools](https://discourse.julialang.org/t/ode-with-heterogeneous-input-through-recursivearraytools/95625)

<div class="topic-metadata">

**Author:** [@christianhvejsel](https://discourse.julialang.org/u/christianhvejsel)\
**Replies:** 2\
**Last updated:** [March 6, 2023, 8:26pm UTC](https://discourse.julialang.org/t/ode-with-heterogeneous-input-through-recursivearraytools/95625 "2023-03-06T20:26:46Z")

</div>

Hi all I am trying to solve a first-order ODE with initial conditions input as a heterogeneous array using of RecursiveArrayTools.jl https://docs.sciml.ai/DiffEqDocs/stable/features/diffeq\_arrays/#ArrayPartitions. I ca…

---

## [Mathematical validity of using SDE solver schemes for custom NoiseProcess(es) in DifferentialEquations.jl](https://discourse.julialang.org/t/mathematical-validity-of-using-sde-solver-schemes-for-custom-noiseprocess-es-in-differentialequations-jl/95025)

<div class="topic-metadata">

**Author:** [@tom-plaa](https://discourse.julialang.org/u/tom-plaa)\
**Replies:** 4\
**Last updated:** [March 6, 2023, 1:01pm UTC](https://discourse.julialang.org/t/mathematical-validity-of-using-sde-solver-schemes-for-custom-noiseprocess-es-in-differentialequations-jl/95025 "2023-03-06T13:01:51Z")

</div>

As we know, DifferentialEquations.jl has the amazing feature of allowing us to define our own NoiseProcess object and use all the solving interface with it. My question here is more related to the mathematical validity o…

---

## [Unit testing of MTK sub-models](https://discourse.julialang.org/t/unit-testing-of-mtk-sub-models/95558)

<div class="topic-metadata">

**Author:** [@jondavis847](https://discourse.julialang.org/u/jondavis847)\
**Replies:** 3\
**Last updated:** [March 6, 2023, 11:29am UTC](https://discourse.julialang.org/t/unit-testing-of-mtk-sub-models/95558 "2023-03-06T11:29:12Z")

</div>

Hello. I am curious about the expected behavior of MTK when composing large models from sub-models. I’m hoping to better identify and understand which sub-models I’ve designed poorly. Questions : Sometimes when I ma…

---

## [Differential equation becomes unstable when training mixed neural ODE](https://discourse.julialang.org/t/differential-equation-becomes-unstable-when-training-mixed-neural-ode/61461)

<div class="topic-metadata">

**Author:** [@bkuwahara](https://discourse.julialang.org/u/bkuwahara)\
**Replies:** 7\
**Last updated:** [March 5, 2023, 6:11am UTC](https://discourse.julialang.org/t/differential-equation-becomes-unstable-when-training-mixed-neural-ode/61461 "2023-03-05T06:11:46Z")

</div>

I’m trying to use a neural network to simulate the equation for the predator population in the Lotka-Volterra model: function lotka\_volterra(du,u,p,t) x, y = u α, β = (1.5,1.0) du\[1\] = dx = α\*x - β\*x\*y du\[2\] = N…

---

## [Calculating displacement vectors between Agents](https://discourse.julialang.org/t/calculating-displacement-vectors-between-agents/95458)

<div class="topic-metadata">

**Author:** [@Niall](https://discourse.julialang.org/u/Niall)\
**Replies:** 3\
**Last updated:** [March 4, 2023, 7:07pm UTC](https://discourse.julialang.org/t/calculating-displacement-vectors-between-agents/95458 "2023-03-04T19:07:15Z")

</div>

Hi. I’m having problems (re-)implementing the Flocking model in Agents. Whenever I run it, flocks tend to bounce off the supposedly periodic boundaries, and when I analyse this more closely, the individual agents ‘stick’…

---

## [Spline fit from DataInterpolations erroring out with ModelingToolkit symbolic derivative](https://discourse.julialang.org/t/spline-fit-from-datainterpolations-erroring-out-with-modelingtoolkit-symbolic-derivative/95417)

<div class="topic-metadata">

**Author:** [@aditya-sengupta](https://discourse.julialang.org/u/aditya-sengupta)\
**Replies:** 4\
**Last updated:** [March 4, 2023, 6:40pm UTC](https://discourse.julialang.org/t/spline-fit-from-datainterpolations-erroring-out-with-modelingtoolkit-symbolic-derivative/95417 "2023-03-04T18:40:38Z")

</div>

I’m trying to take a ModelingToolkit symbolic derivative of a variable whose values I’m getting with a DataInterpolations spline, and it’s unable to evaluate the derivative of a constant so I can’t solve the system. MWE: …

---

## [Structural\_simplify unexpected ERROR when applied twice in a row](https://discourse.julialang.org/t/structural-simplify-unexpected-error-when-applied-twice-in-a-row/95540)

<div class="topic-metadata">

**Author:** [@halejulia](https://discourse.julialang.org/u/halejulia)\
**Replies:** 2\
**Last updated:** [March 4, 2023, 2:47pm UTC](https://discourse.julialang.org/t/structural-simplify-unexpected-error-when-applied-twice-in-a-row/95540 "2023-03-04T14:47:18Z")

</div>

I mentioned this on slack, but I took me a while to create an MWE, so I’m posting it here again. Here is the MWE: using ModelingToolkit @variables t u(t)\[1:2\] D=Differential(t) eqs = \[u\[1\] ~ 1 D…

---

## [StochasticDiffEq Tau-Leaping maxiters](https://discourse.julialang.org/t/stochasticdiffeq-tau-leaping-maxiters/95517)

<div class="topic-metadata">

**Author:** [@arnold-c](https://discourse.julialang.org/u/arnold-c)\
**Replies:** 10\
**Last updated:** [March 4, 2023, 5:49am UTC](https://discourse.julialang.org/t/stochasticdiffeq-tau-leaping-maxiters/95517 "2023-03-04T05:49:13Z")

</div>

I’m relatively new to Julia and JumpProcesses.jl, so apologies if this is somewhat basic, but I’m having an issue trying to convert the example SIR model with tau-leaping from density-dependent to frequency dependent i.e…

---

## [How to solve PDAEs (incorporate mass matrix into PDE solver)](https://discourse.julialang.org/t/how-to-solve-pdaes-incorporate-mass-matrix-into-pde-solver/95301)

<div class="topic-metadata">

**Author:** [@anh](https://discourse.julialang.org/u/anh)\
**Replies:** 5\
**Last updated:** [February 28, 2023, 1:23pm UTC](https://discourse.julialang.org/t/how-to-solve-pdaes-incorporate-mass-matrix-into-pde-solver/95301 "2023-02-28T13:23:21Z")

</div>

I am trying to solve a system of 1st order linear partial differential equations with a constraint on two out of three of my dependent variables (to enforce population conservation). I am familiar with DAEs and the asso…

---

## [MTK: scaling of variables in plot](https://discourse.julialang.org/t/mtk-scaling-of-variables-in-plot/94303)

<div class="topic-metadata">

**Author:** [@BLI](https://discourse.julialang.org/u/BLI)\
**Replies:** 3\
**Last updated:** [February 28, 2023, 12:41pm UTC](https://discourse.julialang.org/t/mtk-scaling-of-variables-in-plot/94303 "2023-02-28T12:41:28Z")

</div>

Suppose the solution sol from simulating an MTK model contains state x and observable variable y. I can then plot x with either of the following commands: plot(sol, idxs = x) # or plot(sol, idxs = \[x\]) If I want to pl…

---

## [Reports of Sundials' Death are Greatly Exaggerated?](https://discourse.julialang.org/t/reports-of-sundials-death-are-greatly-exaggerated/95286)

<div class="topic-metadata">

**Author:** [@anodos](https://discourse.julialang.org/u/anodos)\
**Replies:** 6\
**Last updated:** [February 28, 2023, 10:17am UTC](https://discourse.julialang.org/t/reports-of-sundials-death-are-greatly-exaggerated/95286 "2023-02-28T10:17:07Z")

</div>

Apologies for the tongue-in-cheek title. According to this discussion, native QNDF julia solvers now consistently outperform CVODE\_BDF on the test suite. However, my experience solving reasonably stiff sets of ~100’s…

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

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