# Modelling & Simulations

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

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

**Page:** 36

---

## [Obtaining readable polynomial chaos surrogate model using Surrogates.jl](https://discourse.julialang.org/t/obtaining-readable-polynomial-chaos-surrogate-model-using-surrogates-jl/99431)

<div class="topic-metadata">

**Author:** [@kakarot0108](https://discourse.julialang.org/u/kakarot0108)\
**Replies:** 1\
**Last updated:** [May 26, 2023, 1:09pm UTC](https://discourse.julialang.org/t/obtaining-readable-polynomial-chaos-surrogate-model-using-surrogates-jl/99431 "2023-05-26T13:09:37Z")

</div>

Hi all, I am trying to develop a polynomial chaos surrogate using Surrogates.jl. Let’s say we have the following surrogate model: poly = PolynomialChaosSurrogate(x, y, lower\_bound, upper\_bound, op = SurrogatesPolyChaos…

---

## [New to ModelingToolkit, problems trying to include derivatives on RHS of ODESystem](https://discourse.julialang.org/t/new-to-modelingtoolkit-problems-trying-to-include-derivatives-on-rhs-of-odesystem/99062)

<div class="topic-metadata">

**Author:** [@markjholmes](https://discourse.julialang.org/u/markjholmes)\
**Replies:** 5\
**Last updated:** [May 26, 2023, 12:10pm UTC](https://discourse.julialang.org/t/new-to-modelingtoolkit-problems-trying-to-include-derivatives-on-rhs-of-odesystem/99062 "2023-05-26T12:10:41Z")

</div>

I’m trying to model a biological system of a population, N, and a trait, X. The rate of change of the population, \\frac{dN}{dt}, depends on some nonlinear function that is governed by some dynamic trait of the populatio…

---

## [MethodOfLines discretization error: missing initial conditions](https://discourse.julialang.org/t/methodoflines-discretization-error-missing-initial-conditions/98828)

<div class="topic-metadata">

**Author:** [@A\_09](https://discourse.julialang.org/u/A_09)\
**Replies:** 8\
**Last updated:** [May 25, 2023, 2:38pm UTC](https://discourse.julialang.org/t/methodoflines-discretization-error-missing-initial-conditions/98828 "2023-05-25T14:38:41Z")

</div>

I have developed a code for solving differential equations and I have been trying to solve it using the ModelingToolkit package and the MethodOfLines: begin @parameters t, r, x \`@variables T(…) Dr=Differential(r) Drr…

---

## [Solving different parts of state vector with different schemes/solvers](https://discourse.julialang.org/t/solving-different-parts-of-state-vector-with-different-schemes-solvers/99305)

<div class="topic-metadata">

**Author:** [@p\_f](https://discourse.julialang.org/u/p_f)\
**Replies:** 1\
**Last updated:** [May 24, 2023, 12:06am UTC](https://discourse.julialang.org/t/solving-different-parts-of-state-vector-with-different-schemes-solvers/99305 "2023-05-24T00:06:20Z")

</div>

Hi all, I hope this question finds you well. I have two state vectors X1 and X2 that comprise my total state X = \[X1; X2\]. X1 evolves according to dX1 = f(X1,X2) and X2 evolves according to dX2 = g(X2) - h(X1,X2,dX1) …

---

## [Metalog Distributions](https://discourse.julialang.org/t/metalog-distributions/99259)

<div class="topic-metadata">

**Author:** [@vshesh](https://discourse.julialang.org/u/vshesh)\
**Replies:** 0\
**Last updated:** [May 23, 2023, 5:16am UTC](https://discourse.julialang.org/t/metalog-distributions/99259 "2023-05-23T05:16:55Z")

</div>

Hi, I am looking to use Metalog Distributions (1 1 The Three Types of Probability Distributions - YouTube) in a project I’m working on. Are there any packages that have implemented them (including fitting to data, and …

---

## [ABM performance tips](https://discourse.julialang.org/t/abm-performance-tips/99146)

<div class="topic-metadata">

**Author:** [@sea\_slug](https://discourse.julialang.org/u/sea_slug)\
**Replies:** 5\
**Last updated:** [May 22, 2023, 11:07pm UTC](https://discourse.julialang.org/t/abm-performance-tips/99146 "2023-05-22T23:07:17Z")

</div>

I have a mainly complete ABM built using Agents.jl (awesome package!) which functions as I want (albeit with placeholder parameters) now I am at the point I want to improve the performance of the model, but I am struggli…

---

## [Designing a band pass filter with modeling toolkit](https://discourse.julialang.org/t/designing-a-band-pass-filter-with-modeling-toolkit/99118)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 5\
**Last updated:** [May 22, 2023, 6:51am UTC](https://discourse.julialang.org/t/designing-a-band-pass-filter-with-modeling-toolkit/99118 "2023-05-22T06:51:49Z")

</div>

What is the best way to design a band pass filter in the continues domain using modelling toolkit? Some hints how to do it in Python: Butterworth Bandpass — SciPy Cookbook documentation Update: OK, I can design a filte…

---

## [How to create ASCII equations](https://discourse.julialang.org/t/how-to-create-ascii-equations/99180)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 4\
**Last updated:** [May 21, 2023, 8:33pm UTC](https://discourse.julialang.org/t/how-to-create-ascii-equations/99180 "2023-05-21T20:33:06Z")

</div>

In the documentation of ModelingToolkit I find a lot of ASCII equations, e.g. k ─────── sT + 1 Is there a way to generate this ascii art automatically? I looked at latexify, but I did not find an option to generate …

---

## [Solving unbounded problem by NeuralPDE](https://discourse.julialang.org/t/solving-unbounded-problem-by-neuralpde/99169)

<div class="topic-metadata">

**Author:** [@Ethan\_Tran](https://discourse.julialang.org/u/Ethan_Tran)\
**Replies:** 6\
**Last updated:** [May 21, 2023, 6:36pm UTC](https://discourse.julialang.org/t/solving-unbounded-problem-by-neuralpde/99169 "2023-05-21T18:36:45Z")

</div>

I would like to solve an unbounded problem in PDE format by NeuralPDE. The domains of the problem is x belong \[0;inf) and y belong real number (R) please help me on how could I implement these domains in Julia and whet…

---

## [Strange results when using seed kwarg in solve function](https://discourse.julialang.org/t/strange-results-when-using-seed-kwarg-in-solve-function/99128)

<div class="topic-metadata">

**Author:** [@stochasticguy](https://discourse.julialang.org/u/stochasticguy)\
**Replies:** 2\
**Last updated:** [May 20, 2023, 12:58pm UTC](https://discourse.julialang.org/t/strange-results-when-using-seed-kwarg-in-solve-function/99128 "2023-05-20T12:58:13Z")

</div>

Hi everyone, First of all I wanted to congratulate you all for this amazing community. I’m having issues with the solution of a Stochastic Differential Equation (SDE) when passing the seed kwarg to the solve method. W…

---

## [Zerocrossing detection with ModelingToolkit](https://discourse.julialang.org/t/zerocrossing-detection-with-modelingtoolkit/99150)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 1\
**Last updated:** [May 20, 2023, 8:22am UTC](https://discourse.julialang.org/t/zerocrossing-detection-with-modelingtoolkit/99150 "2023-05-20T08:22:19Z")

</div>

I Simulink many components have the option to turn “zero crossing detection” on or off, which has a large influence on the simulation time, stability and accuracy. How is this issue handled in ModelingToolkit?

---

## [Periodic Callback and Sensitivity](https://discourse.julialang.org/t/periodic-callback-and-sensitivity/99057)

<div class="topic-metadata">

**Author:** [@Guido\_Ballabio](https://discourse.julialang.org/u/Guido_Ballabio)\
**Replies:** 5\
**Last updated:** [May 19, 2023, 8:40pm UTC](https://discourse.julialang.org/t/periodic-callback-and-sensitivity/99057 "2023-05-19T20:40:30Z")

</div>

I am trying to use DiffEq and SciML sensitivity to build NN controllers for physical systems. Usually everything works, however this time I need to design a fixed-frequency controller so I’ve reached to PeriodCallback w…

---

## [Minimising DifferentialEquations GPU memory allocation](https://discourse.julialang.org/t/minimising-differentialequations-gpu-memory-allocation/99050)

<div class="topic-metadata">

**Author:** [@Tommy\_Fischer](https://discourse.julialang.org/u/Tommy_Fischer)\
**Replies:** 8\
**Last updated:** [May 19, 2023, 10:08am UTC](https://discourse.julialang.org/t/minimising-differentialequations-gpu-memory-allocation/99050 "2023-05-19T10:08:46Z")

</div>

I’m simulating the Gross-Pitaevskii Equation for a three-dimensional array with M^3 values, and am running into some issues with GPU memory for large M values. In short, I’m wondering if there is anything more I can do t…

---

## [How to apply a symbolic equation on a vector?](https://discourse.julialang.org/t/how-to-apply-a-symbolic-equation-on-a-vector/98988)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 3\
**Last updated:** [May 17, 2023, 8:51pm UTC](https://discourse.julialang.org/t/how-to-apply-a-symbolic-equation-on-a-vector/98988 "2023-05-17T20:51:35Z")

</div>

I have the following code: using ModelingToolkit, OrdinaryDiffEq, DataInterpolations, Plots Cp=\[0.024384377390186646,0.03811829845979822,0.05731175742000688,0.0803120051369546,0.10526323380995135,0.1312349486430945, …

---

## [Using Catalyst with DynamicalSystems](https://discourse.julialang.org/t/using-catalyst-with-dynamicalsystems/98965)

<div class="topic-metadata">

**Author:** [@Dragolonth](https://discourse.julialang.org/u/Dragolonth)\
**Replies:** 4\
**Last updated:** [May 17, 2023, 3:49pm UTC](https://discourse.julialang.org/t/using-catalyst-with-dynamicalsystems/98965 "2023-05-17T15:49:25Z")

</div>

Hi all. I currently have a large ODE system that I’ve defined as a reaction network using Catalyst. I was wondering if it would be possible to essentially put this reaction network into DynamicalSystems to find the attra…

---

## [Error using ModelingToolkit](https://discourse.julialang.org/t/error-using-modelingtoolkit/98947)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 6\
**Last updated:** [May 16, 2023, 8:55pm UTC](https://discourse.julialang.org/t/error-using-modelingtoolkit/98947 "2023-05-16T20:55:28Z")

</div>

If I run the following code: using ModelingToolkit, OrdinaryDiffEq, DataInterpolations Cp=\[0.024384377390186646,0.03811829845979822,0.05731175742000688,0.0803120051369546,0.10526323380995135,0.1312349486430945, 0.1…

---

## [Help with speeding up large ODE system from ModelingToolkit](https://discourse.julialang.org/t/help-with-speeding-up-large-ode-system-from-modelingtoolkit/98903)

<div class="topic-metadata">

**Author:** [@sdwfrost](https://discourse.julialang.org/u/sdwfrost)\
**Replies:** 3\
**Last updated:** [May 16, 2023, 3:38pm UTC](https://discourse.julialang.org/t/help-with-speeding-up-large-ode-system-from-modelingtoolkit/98903 "2023-05-16T15:38:38Z")

</div>

Hi everyone, I’m trying to speed up the following ODE system, which is a backward-in-space discretization of a set of PDEs, which I’m generating using ModelingToolkit.jl. The bottleneck is in the construction of the sys…

---

## [How can I print an ODESystem](https://discourse.julialang.org/t/how-can-i-print-an-odesystem/98924)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 2\
**Last updated:** [May 16, 2023, 12:37pm UTC](https://discourse.julialang.org/t/how-can-i-print-an-odesystem/98924 "2023-05-16T12:37:21Z")

</div>

Using ModelingToolkit I created and simplified a system of equations. If I try to print it I get: julia\> sys Model sys with 2 equations States (2): ω(t) ωˍt(t) Parameters (4): J R A ρ Incidence matrix:2×3 Sp…

---

## [How to implement a lookup-table in ModellingToolkit](https://discourse.julialang.org/t/how-to-implement-a-lookup-table-in-modellingtoolkit/98912)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 3\
**Last updated:** [May 16, 2023, 10:24am UTC](https://discourse.julialang.org/t/how-to-implement-a-lookup-table-in-modellingtoolkit/98912 "2023-05-16T10:24:05Z")

</div>

Hello, I want to implement a wind turbine model using ModelingToolkit. The core model consists of only three differential equations, but it includes a lookup-table for the power coefficient. What is the best way to i…

---

## [Callback in Optimization.jl](https://discourse.julialang.org/t/callback-in-optimization-jl/98551)

<div class="topic-metadata">

**Author:** [@Avec](https://discourse.julialang.org/u/Avec)\
**Replies:** 2\
**Last updated:** [May 16, 2023, 3:40am UTC](https://discourse.julialang.org/t/callback-in-optimization-jl/98551 "2023-05-16T03:40:42Z")

</div>

Hi all, I am trying to use Optimization.jl package together with GCMAES.jl. The solve function of Optimization.jl should accept a callback function, but I am not able to make it work. Here is a MWE using Optimization, O…

---

## [Is there a way to access a value of a variable in the previous steptime?](https://discourse.julialang.org/t/is-there-a-way-to-access-a-value-of-a-variable-in-the-previous-steptime/98867)

<div class="topic-metadata">

**Author:** [@HamzaKh99](https://discourse.julialang.org/u/HamzaKh99)\
**Replies:** 1\
**Last updated:** [May 15, 2023, 3:38pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-access-a-value-of-a-variable-in-the-previous-steptime/98867 "2023-05-15T15:38:40Z")

</div>

Hello! I’m trying to access the value of a variable in the previous step time to use it afterward, I’m using discrete\_events() for that, but is there a simple way to do it?

---

## [ODE Parameter Estimation Using NLopt.jl](https://discourse.julialang.org/t/ode-parameter-estimation-using-nlopt-jl/98825)

<div class="topic-metadata">

**Author:** [@a\_lasko](https://discourse.julialang.org/u/a_lasko)\
**Replies:** 6\
**Last updated:** [May 14, 2023, 3:04pm UTC](https://discourse.julialang.org/t/ode-parameter-estimation-using-nlopt-jl/98825 "2023-05-14T15:04:03Z")

</div>

Good day. I’m new to Julia and using different sources implemented optimization procedure of Predator-Prey ODE system (2 possible models): using ProgressBars, Distributions, DelimitedFiles, DifferentialEquations, DiffE…

---

## [Best random number generator for Monte Carlo simulations](https://discourse.julialang.org/t/best-random-number-generator-for-monte-carlo-simulations/98318)

<div class="topic-metadata">

**Author:** [@steve1313](https://discourse.julialang.org/u/steve1313)\
**Replies:** 12\
**Last updated:** [May 12, 2023, 2:48pm UTC](https://discourse.julialang.org/t/best-random-number-generator-for-monte-carlo-simulations/98318 "2023-05-12T14:48:15Z")

</div>

I often write small Monte Carlo simulations to solve difficult probability problems. What’s the best (fastest, most accurate) RNG for this type of use?

---

## [Variable rate jump stops matching birth-death theory](https://discourse.julialang.org/t/variable-rate-jump-stops-matching-birth-death-theory/98609)

<div class="topic-metadata">

**Author:** [@freddie090](https://discourse.julialang.org/u/freddie090)\
**Replies:** 2\
**Last updated:** [May 11, 2023, 11:06am UTC](https://discourse.julialang.org/t/variable-rate-jump-stops-matching-birth-death-theory/98609 "2023-05-11T11:06:37Z")

</div>

I saw that a mixed birth-death ODE-jump process I was using wasn’t behaving as expected. Following some investigation, it appears that when I switch the rates from being ‘ConstantRateJump’ to ‘VariableRateJump’ the birt…

---

## [Discrete systems in MTK](https://discourse.julialang.org/t/discrete-systems-in-mtk/98602)

<div class="topic-metadata">

**Author:** [@HamzaKh99](https://discourse.julialang.org/u/HamzaKh99)\
**Replies:** 1\
**Last updated:** [May 10, 2023, 12:00pm UTC](https://discourse.julialang.org/t/discrete-systems-in-mtk/98602 "2023-05-10T12:00:08Z")

</div>

Hello everyone! I’m trying to do a discrete system example, using Difference and Differential functions, when I create the ODEProblem without structural\_simplify() I get the results I want. \`using ModelingToolkit usin…

---

## [How to optimize multiple ODEs at once?](https://discourse.julialang.org/t/how-to-optimize-multiple-odes-at-once/98194)

<div class="topic-metadata">

**Author:** [@Luigi\_Marongiu](https://discourse.julialang.org/u/Luigi_Marongiu)\
**Replies:** 2\
**Last updated:** [May 10, 2023, 8:39am UTC](https://discourse.julialang.org/t/how-to-optimize-multiple-odes-at-once/98194 "2023-05-10T08:39:05Z")

</div>

Hello, I have a set of several ODEs to describe the interaction between six bacteria and six phages (one for bacterium). Collectively, I have 18 equations with 7 parameters. What is the approach to finding the values o…

---

## [What does the "maxiters" solver option do?](https://discourse.julialang.org/t/what-does-the-maxiters-solver-option-do/37376)

<div class="topic-metadata">

**Author:** [@donkeysaddle](https://discourse.julialang.org/u/donkeysaddle)\
**Replies:** 19\
**Last updated:** [May 9, 2023, 8:26am UTC](https://discourse.julialang.org/t/what-does-the-maxiters-solver-option-do/37376 "2023-05-09T08:26:45Z")

</div>

New to Numerical Analysis, so please excuse the rookie question and forgive me if this has been discussed somewhere else, I couldn’t find it. According to the documentation: maxiters : Maximum number of iterations be…

---

## [Understanding Symbolic Regression?](https://discourse.julialang.org/t/understanding-symbolic-regression/93587)

<div class="topic-metadata">

**Author:** [@BLI](https://discourse.julialang.org/u/BLI)\
**Replies:** 3\
**Last updated:** [May 7, 2023, 12:43am UTC](https://discourse.julialang.org/t/understanding-symbolic-regression/93587 "2023-05-07T00:43:33Z")

</div>

I’m trying to understand how to use the SymbolicRegression package in Julia. I’ve read through the thesis by Minnebo and Stijven from 2011 (referenced in Wikipedia), where they talk about “operators” vs. “terminals”. In…

---

## [Vector Equations with ModelingToolkit and MethodOfLines (Updated Syntax)](https://discourse.julialang.org/t/vector-equations-with-modelingtoolkit-and-methodoflines-updated-syntax/98254)

<div class="topic-metadata">

**Author:** [@johnb](https://discourse.julialang.org/u/johnb)\
**Replies:** 3\
**Last updated:** [May 4, 2023, 3:40pm UTC](https://discourse.julialang.org/t/vector-equations-with-modelingtoolkit-and-methodoflines-updated-syntax/98254 "2023-05-04T15:40:51Z")

</div>

I have attempted to update some code to the preferred updated syntax u(..)\[1:n\] since u\[1:n\](..) is slated for deprecation. When I modify this in the code, I get a new error. I have attached an example problem from adap…

---

## [Rodas4 using dual number for time with autodiff=false](https://discourse.julialang.org/t/rodas4-using-dual-number-for-time-with-autodiff-false/98256)

<div class="topic-metadata">

**Author:** [@p\_f](https://discourse.julialang.org/u/p_f)\
**Replies:** 2\
**Last updated:** [May 3, 2023, 2:52pm UTC](https://discourse.julialang.org/t/rodas4-using-dual-number-for-time-with-autodiff-false/98256 "2023-05-03T14:52:12Z")

</div>

When the right hand side function has a time dependence, Rodas4 gives dual number method errors, when other solvers (e.g. QBDF) do not. I thought that autodiff was the use-case for dual numbers, but Rodas4 uses dual numb…

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

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