# Modelling & Simulations

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

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

**Page:** 49

---

## [Package for sampling from a uniform distribution over a convex polytope?](https://discourse.julialang.org/t/package-for-sampling-from-a-uniform-distribution-over-a-convex-polytope/18598)

<div class="topic-metadata">

**Author:** [@ajkeith](https://discourse.julialang.org/u/ajkeith)\
**Replies:** 3\
**Last updated:** [April 22, 2022, 8:37am UTC](https://discourse.julialang.org/t/package-for-sampling-from-a-uniform-distribution-over-a-convex-polytope/18598 "2022-04-22T08:37:23Z")

</div>

Is there a Julia package for sampling from a uniform distribution over a convex polytope? I’m trying to sample a categorical distribution from an ambiguity set of categorical distributions subject to linear constraints.…

---

## [Easy plotting of vector valued function in Plots.jl](https://discourse.julialang.org/t/easy-plotting-of-vector-valued-function-in-plots-jl/79788)

<div class="topic-metadata">

**Author:** [@Joseph\_Bradley](https://discourse.julialang.org/u/Joseph_Bradley)\
**Replies:** 4\
**Last updated:** [April 21, 2022, 4:59pm UTC](https://discourse.julialang.org/t/easy-plotting-of-vector-valued-function-in-plots-jl/79788 "2022-04-21T16:59:28Z")

</div>

Hi, I’d like to plot a function from R -\> R^N in Plots.jl. My code is: using Plots N = 9 v₁ = ones(N) v₂ = \[1, -8, ones(N-2)...\] z₀ = 1.0 function z(t; v₁ = v₁, v₂ = v₂, z₀ = z₀) (z₀ / 9.0) .\* (v₁ - exp(-9.0\*t)\*v₂) …

---

## [ODE Integrator Function](https://discourse.julialang.org/t/ode-integrator-function/79756)

<div class="topic-metadata">

**Author:** [@BinaryBot](https://discourse.julialang.org/u/BinaryBot)\
**Replies:** 6\
**Last updated:** [April 21, 2022, 10:53am UTC](https://discourse.julialang.org/t/ode-integrator-function/79756 "2022-04-21T10:53:05Z")

</div>

My ODE runs from tspan(1,120). It needs an integrator function that can do the following: Store the solutions at timestep 2,3,4…120 (i.e integral numbers) in a list. Although step size does not have to be 1, it just h…

---

## [Problem simulating Matlab ODE15s in Julia](https://discourse.julialang.org/t/problem-simulating-matlab-ode15s-in-julia/79687)

<div class="topic-metadata">

**Author:** [@BinaryBot](https://discourse.julialang.org/u/BinaryBot)\
**Replies:** 8\
**Last updated:** [April 20, 2022, 5:28pm UTC](https://discourse.julialang.org/t/problem-simulating-matlab-ode15s-in-julia/79687 "2022-04-20T17:28:33Z")

</div>

Here is the code I have, using Pkg using PyCall using CSV; using DataFrames; using Dierckx;using DifferentialEquations;using LSODA;using MATLABDiffEq; using ParameterizedFunctions;using IfElse; p = \[ 1.35e-2 #k1 …

---

## [Replicating Matlab ode15s results in Julia](https://discourse.julialang.org/t/replicating-matlab-ode15s-results-in-julia/79280)

<div class="topic-metadata">

**Author:** [@BinaryBot](https://discourse.julialang.org/u/BinaryBot)\
**Replies:** 15\
**Last updated:** [April 19, 2022, 12:31pm UTC](https://discourse.julialang.org/t/replicating-matlab-ode15s-results-in-julia/79280 "2022-04-19T12:31:32Z")

</div>

I’m new to Julia and I have been working on ODE solvers for my first project .I recently got my hands onto some data which was generated using Matlab. I have been trying to replicate the results using the Julia Different…

---

## [Working around current MethodOfLines.jl known limitations](https://discourse.julialang.org/t/working-around-current-methodoflines-jl-known-limitations/79346)

<div class="topic-metadata">

**Author:** [@jenrei](https://discourse.julialang.org/u/jenrei)\
**Replies:** 4\
**Last updated:** [April 12, 2022, 4:25pm UTC](https://discourse.julialang.org/t/working-around-current-methodoflines-jl-known-limitations/79346 "2022-04-12T16:25:58Z")

</div>

Hi, I’m trying to solve the energy/heat equation with temperature dependent material properties (density, enthalpy and thermal conductivity). Therefore I’m running in the issues that are mentioned as (current) known limi…

---

## [\`@variables\` and \`@parameters\` macros not working on arrays](https://discourse.julialang.org/t/variables-and-parameters-macros-not-working-on-arrays/79252)

<div class="topic-metadata">

**Author:** [@markjholmes](https://discourse.julialang.org/u/markjholmes)\
**Replies:** 14\
**Last updated:** [April 11, 2022, 1:51pm UTC](https://discourse.julialang.org/t/variables-and-parameters-macros-not-working-on-arrays/79252 "2022-04-11T13:51:30Z")

</div>

I have Julia installed on two different computers and the code executes differently on each one despite having the same versions of VSCode, Julia, and installed packages (everything is the most recent release version). T…

---

## [Different solve options within ensemble simulations](https://discourse.julialang.org/t/different-solve-options-within-ensemble-simulations/79102)

<div class="topic-metadata">

**Author:** [@AndreaRH](https://discourse.julialang.org/u/AndreaRH)\
**Replies:** 2\
**Last updated:** [April 8, 2022, 12:17pm UTC](https://discourse.julialang.org/t/different-solve-options-within-ensemble-simulations/79102 "2022-04-08T12:17:31Z")

</div>

I have an EnsembleProblem. This allows me to remake the problem for each of the different simulations. However, I want to change the keyword arguments for solving the different trajectories of the ensemble problem. For i…

---

## [Differentiation of expressions involving arrays](https://discourse.julialang.org/t/differentiation-of-expressions-involving-arrays/78826)

<div class="topic-metadata">

**Author:** [@natema](https://discourse.julialang.org/u/natema)\
**Replies:** 4\
**Last updated:** [April 7, 2022, 8:42pm UTC](https://discourse.julialang.org/t/differentiation-of-expressions-involving-arrays/78826 "2022-04-07T20:42:46Z")

</div>

Hi. I’m a ModellingToolkit newbie (and DE in general). I wrote some code last December which now throws the error Differentiation of expressions involving arrays and array variables is not yet supported. I saw that rai…

---

## [How to determine conditions of bistability](https://discourse.julialang.org/t/how-to-determine-conditions-of-bistability/78431)

<div class="topic-metadata">

**Author:** [@Dragolonth](https://discourse.julialang.org/u/Dragolonth)\
**Replies:** 4\
**Last updated:** [April 7, 2022, 6:08am UTC](https://discourse.julialang.org/t/how-to-determine-conditions-of-bistability/78431 "2022-04-07T06:08:28Z")

</div>

Hello everyone! I’m new to Julia and would consider myself a beginner to programming in general. Currently, I am using Catalyst.jl to define a system of ODEs as a reaction network. I have the parameters and initial condi…

---

## [Solving differential equations with derivatives on both sides of the equation](https://discourse.julialang.org/t/solving-differential-equations-with-derivatives-on-both-sides-of-the-equation/79070)

<div class="topic-metadata">

**Author:** [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Replies:** 4\
**Last updated:** [April 5, 2022, 9:21pm UTC](https://discourse.julialang.org/t/solving-differential-equations-with-derivatives-on-both-sides-of-the-equation/79070 "2022-04-05T21:21:22Z")

</div>

I have two coupled, first order, non-linear ODEs that I’m trying to solve. However, both of the two equations contain additional derivatives on the right-hand sides of the equation (and there don’t seem to be any obvious…

---

## [Best way to cache data during DifferentialEquations.jl integration](https://discourse.julialang.org/t/best-way-to-cache-data-during-differentialequations-jl-integration/78996)

<div class="topic-metadata">

**Author:** [@josuagrw](https://discourse.julialang.org/u/josuagrw)\
**Replies:** 1\
**Last updated:** [April 5, 2022, 11:44am UTC](https://discourse.julialang.org/t/best-way-to-cache-data-during-differentialequations-jl-integration/78996 "2022-04-05T11:44:35Z")

</div>

I have a problem which could be written (not exactly) as \\dot u = \\min\_w f(u,w) Naturally, I would like use some previous value of \\dot u as the starting point for the optimization problem on the r.h.s. — I might even…

---

## [Calculating Jacobian from two matrices](https://discourse.julialang.org/t/calculating-jacobian-from-two-matrices/78966)

<div class="topic-metadata">

**Author:** [@Iddingsite](https://discourse.julialang.org/u/Iddingsite)\
**Replies:** 4\
**Last updated:** [April 5, 2022, 10:48am UTC](https://discourse.julialang.org/t/calculating-jacobian-from-two-matrices/78966 "2022-04-05T10:48:09Z")

</div>

Hi everyone, I would like to compute a Jacobian for one of my problem for a PDE, but I don’t have a function linking the unknown to my function. So I only have 2 matrices, 1 with the values of the function and 1 with th…

---

## [Method Error object of type AgentBasedModel is not callable](https://discourse.julialang.org/t/method-error-object-of-type-agentbasedmodel-is-not-callable/79014)

<div class="topic-metadata">

**Author:** [@imantha](https://discourse.julialang.org/u/imantha)\
**Replies:** 2\
**Last updated:** [April 4, 2022, 7:32pm UTC](https://discourse.julialang.org/t/method-error-object-of-type-agentbasedmodel-is-not-callable/79014 "2022-04-04T19:32:07Z")

</div>

Hi I am having the following error when I call the step!() or abmvideo!() functions and not sure what the cause of it is. Any ideas? ERROR: MethodError: objects of type AgentBasedModel{Agents.OSM.OpenStreetMapSpace, Uni…

---

## [Adaptive SDESolver yields "Warning: dt \<= dtmin. Aborting", unsure why, large non-adaptive dt works fine](https://discourse.julialang.org/t/adaptive-sdesolver-yields-warning-dt-dtmin-aborting-unsure-why-large-non-adaptive-dt-works-fine/78859)

<div class="topic-metadata">

**Author:** [@Torkel](https://discourse.julialang.org/u/Torkel)\
**Replies:** 5\
**Last updated:** [April 4, 2022, 4:20pm UTC](https://discourse.julialang.org/t/adaptive-sdesolver-yields-warning-dt-dtmin-aborting-unsure-why-large-non-adaptive-dt-works-fine/78859 "2022-04-04T16:20:26Z")

</div>

I have a simple model, which I am trying to simulate, however, I am getting ┌ Warning: dt \<= dtmin. Aborting. There is either an error in your model specification or the true solution is unstable. └ @ SciMLBase /home/SL…

---

## [How to calculate derivative by Lagrange interpolation](https://discourse.julialang.org/t/how-to-calculate-derivative-by-lagrange-interpolation/74905)

<div class="topic-metadata">

**Author:** [@manoj.centura](https://discourse.julialang.org/u/manoj.centura)\
**Replies:** 5\
**Last updated:** [April 4, 2022, 4:11pm UTC](https://discourse.julialang.org/t/how-to-calculate-derivative-by-lagrange-interpolation/74905 "2022-04-04T16:11:42Z")

</div>

hi All, is there a pkg to calculate derivative at untabulated points using langrange interpolation? Thanks M

---

## [Help me outperform Matlab in numerical solution of semidiscretized PDE system as much as possible](https://discourse.julialang.org/t/help-me-outperform-matlab-in-numerical-solution-of-semidiscretized-pde-system-as-much-as-possible/76777)

<div class="topic-metadata">

**Author:** [@RobertS](https://discourse.julialang.org/u/RobertS)\
**Replies:** 26\
**Last updated:** [March 31, 2022, 7:30pm UTC](https://discourse.julialang.org/t/help-me-outperform-matlab-in-numerical-solution-of-semidiscretized-pde-system-as-much-as-possible/76777 "2022-03-31T19:30:44Z")

</div>

I am new to Julia and I am considering to adopt it in my professional life, where I often have to solve systems of partial differential equations (often mixed with algebraic and ordinary differential equations). I typic…

---

## [Slow backward gradients in ODEs](https://discourse.julialang.org/t/slow-backward-gradients-in-odes/78333)

<div class="topic-metadata">

**Author:** [@deismic](https://discourse.julialang.org/u/deismic)\
**Replies:** 7\
**Last updated:** [March 31, 2022, 10:59am UTC](https://discourse.julialang.org/t/slow-backward-gradients-in-odes/78333 "2022-03-31T10:59:16Z")

</div>

Hi all, I am new to Julia and I am trying to solve an ODE and obtain its gradients wrt parameters p. The ODE is the Hodgkin-Huxley model, a standard model in neuroscience (full ODE at the end of this message). I can so…

---

## [Koopman inference fails for simple example while SINDy works fine](https://discourse.julialang.org/t/koopman-inference-fails-for-simple-example-while-sindy-works-fine/78706)

<div class="topic-metadata">

**Author:** [@sdwfrost](https://discourse.julialang.org/u/sdwfrost)\
**Replies:** 1\
**Last updated:** [March 30, 2022, 11:00am UTC](https://discourse.julialang.org/t/koopman-inference-fails-for-simple-example-while-sindy-works-fine/78706 "2022-03-30T11:00:17Z")

</div>

Hi All, I’m trying to put together a DataDrivenDiffEq.jl example for my demo system of an SIR epidemiological model. using OrdinaryDiffEq using DataDrivenDiffEq using ModelingToolkit function sir\_ode(u,p,t) (s,i,r…

---

## [Cvodes error](https://discourse.julialang.org/t/cvodes-error/78175)

<div class="topic-metadata">

**Author:** [@Yinmin\_Liu](https://discourse.julialang.org/u/Yinmin_Liu)\
**Replies:** 1\
**Last updated:** [March 21, 2022, 12:28am UTC](https://discourse.julialang.org/t/cvodes-error/78175 "2022-03-21T00:28:31Z")

</div>

Hi, I am trying to solve a very large stiff system with the CVODE\_BDF() solver. When I apply the Jacobian-free solver by setting linear\_solver =: GMRES, it magically solved my problem with about 20 sec, which I believe …

---

## [Nonparametric functions for time-varying parameters in ODE models?](https://discourse.julialang.org/t/nonparametric-functions-for-time-varying-parameters-in-ode-models/78137)

<div class="topic-metadata">

**Author:** [@sdwfrost](https://discourse.julialang.org/u/sdwfrost)\
**Replies:** 1\
**Last updated:** [March 20, 2022, 11:33am UTC](https://discourse.julialang.org/t/nonparametric-functions-for-time-varying-parameters-in-ode-models/78137 "2022-03-20T11:33:47Z")

</div>

Dear All, I’m interested in having an ODE model where the parameters change over time specified by some nonparametric function e.g. splines, or at least some sort of basis function over time, etc. so I can get a flexibl…

---

## [ModelingToolkit: Some questions on usage & best practices](https://discourse.julialang.org/t/modelingtoolkit-some-questions-on-usage-best-practices/77426)

<div class="topic-metadata">

**Author:** [@RobertS](https://discourse.julialang.org/u/RobertS)\
**Replies:** 5\
**Last updated:** [March 20, 2022, 8:49am UTC](https://discourse.julialang.org/t/modelingtoolkit-some-questions-on-usage-best-practices/77426 "2022-03-20T08:49:55Z")

</div>

Based on an earlier discussion here on discourse formulated a physical system in Modeling toolkit. The system consists of a discretized 1D PDE, ODEs and an algebraic equation. The physical nature of the system is further…

---

## [ModelingToolkit: Building a DAEProblem and solving it with IDA with KLU & Jacobian usage](https://discourse.julialang.org/t/modelingtoolkit-building-a-daeproblem-and-solving-it-with-ida-with-klu-jacobian-usage/77814)

<div class="topic-metadata">

**Author:** [@RobertS](https://discourse.julialang.org/u/RobertS)\
**Replies:** 3\
**Last updated:** [March 20, 2022, 8:41am UTC](https://discourse.julialang.org/t/modelingtoolkit-building-a-daeproblem-and-solving-it-with-ida-with-klu-jacobian-usage/77814 "2022-03-20T08:41:13Z")

</div>

I have coded an MTK system that I build a DAEProblem from. I am now trying to find out how to solve that problem using Sundials IDA with KLU as linear solver. As far as I know, this requires that the Jacobian matrix is g…

---

## [Gillespie simulations: don't deepcopy(JumpProblem)](https://discourse.julialang.org/t/gillespie-simulations-dont-deepcopy-jumpproblem/78073)

<div class="topic-metadata">

**Author:** [@levasco](https://discourse.julialang.org/u/levasco)\
**Replies:** 9\
**Last updated:** [March 18, 2022, 4:10pm UTC](https://discourse.julialang.org/t/gillespie-simulations-dont-deepcopy-jumpproblem/78073 "2022-03-18T16:10:04Z")

</div>

Example from the docs. It seems that deepcopying a JumpProblem object causes each copy to be solved with the same seed. Is this known? using DifferentialEquations using Catalyst sir\_model = @reaction\_network begin β…

---

## [Systems Dynamics in Julia?](https://discourse.julialang.org/t/systems-dynamics-in-julia/73882)

<div class="topic-metadata">

**Author:** [@rpmuller](https://discourse.julialang.org/u/rpmuller)\
**Replies:** 11\
**Last updated:** [March 18, 2022, 12:41pm UTC](https://discourse.julialang.org/t/systems-dynamics-in-julia/73882 "2022-03-18T12:41:34Z")

</div>

Spending a lot of time on the winter break reading Donella Meadows’ books (Thinking in Systems, Limits to Growth and sequels). Seems like a natural extension of the DiffEq.jl framework. Has anyone started anything along …

---

## [Optimal control - minimum time manouvering](https://discourse.julialang.org/t/optimal-control-minimum-time-manouvering/75967)

<div class="topic-metadata">

**Author:** [@FedeClaudi](https://discourse.julialang.org/u/FedeClaudi)\
**Replies:** 5\
**Last updated:** [March 11, 2022, 5:02pm UTC](https://discourse.julialang.org/t/optimal-control-minimum-time-manouvering/75967 "2022-03-11T17:02:39Z")

</div>

Hey everyone, I’m trying to use Julia to solve a non-linear optimal control problem, the “minimum time manouvering” problem for (simulated) race cars (Casanova 2000, Van Koutrik 2015). Briefly, you have a set of differ…

---

## [Social Media Mapping](https://discourse.julialang.org/t/social-media-mapping/77605)

<div class="topic-metadata">

**Author:** [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Replies:** 0\
**Last updated:** [March 8, 2022, 7:25pm UTC](https://discourse.julialang.org/t/social-media-mapping/77605 "2022-03-08T19:25:18Z")

</div>

Is there anyone that has experience making maps of social networks, by friends or by posts?

---

## [Default norm used in ODE error control](https://discourse.julialang.org/t/default-norm-used-in-ode-error-control/70995)

<div class="topic-metadata">

**Author:** [@Bernard\_GODARD](https://discourse.julialang.org/u/Bernard_GODARD)\
**Replies:** 4\
**Last updated:** [March 8, 2022, 1:47pm UTC](https://discourse.julialang.org/t/default-norm-used-in-ode-error-control/70995 "2022-03-08T13:47:41Z")

</div>

The error control in DifferentialEquations using the default internal norm is as follow: Compute tolerance on i-th component: tolerance\_i = absoluteTolerance\_i + relativeTolerance\_i \* max( \\lvert previousState\_i \\rver…

---

## [Storing stationary points during solving](https://discourse.julialang.org/t/storing-stationary-points-during-solving/77258)

<div class="topic-metadata">

**Author:** [@sdwfrost](https://discourse.julialang.org/u/sdwfrost)\
**Replies:** 5\
**Last updated:** [March 2, 2022, 7:59pm UTC](https://discourse.julialang.org/t/storing-stationary-points-during-solving/77258 "2022-03-02T19:59:10Z")

</div>

In our library of SIR models (see e.g. https://github.com/epirecipes/sir-julia/blob/master/markdown/ode/ode.md), I’m trying to store the maximum of one of the state variables (I); I don’t want to just calculate the maxim…

---

## [Help with a variation of the electrical components' example](https://discourse.julialang.org/t/help-with-a-variation-of-the-electrical-components-example/77099)

<div class="topic-metadata">

**Author:** [@vgg](https://discourse.julialang.org/u/vgg)\
**Replies:** 4\
**Last updated:** [February 27, 2022, 8:02pm UTC](https://discourse.julialang.org/t/help-with-a-variation-of-the-electrical-components-example/77099 "2022-02-27T20:02:46Z")

</div>

Hello, I have been doing my first tests with ModelingToolkit and when I tried to modify the acausal components example by adding other types of voltage source I had some problems that I don’t quite understand. In the f…

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

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