# Modelling & Simulations

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

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

**Page:** 30

---

## [Descretization Failed - Method of Lines](https://discourse.julialang.org/t/descretization-failed-method-of-lines/105720)

<div class="topic-metadata">

**Author:** [@emmabottomley](https://discourse.julialang.org/u/emmabottomley)\
**Replies:** 1\
**Last updated:** [November 17, 2023, 4:19pm UTC](https://discourse.julialang.org/t/descretization-failed-method-of-lines/105720 "2023-11-17T16:19:25Z")

</div>

Hello, I’ve been having issues with my code related to the descretization step. I tried taking the derivative of a fraction Dx(S(t,x)/(p-2L(t,x))) but I got this error, SO I decided to use the quotient rule to expand t…

---

## [Stiff methods throw \`Cannot create a dual over scalar type ComplexF64\` in \`SDEProblem\`](https://discourse.julialang.org/t/stiff-methods-throw-cannot-create-a-dual-over-scalar-type-complexf64-in-sdeproblem/106321)

<div class="topic-metadata">

**Author:** [@ymardoukhi](https://discourse.julialang.org/u/ymardoukhi)\
**Replies:** 4\
**Last updated:** [November 17, 2023, 7:15am UTC](https://discourse.julialang.org/t/stiff-methods-throw-cannot-create-a-dual-over-scalar-type-complexf64-in-sdeproblem/106321 "2023-11-17T07:15:02Z")

</div>

I am solving the following von Neumann master equation with a stochastic term \\dot{\\rho} = -i\[H(t), \\rho\] where \[., .\] is the commutator operator and H(t) is given by H(t) = s(t)\\hat{\\sigma\_x} + \\hat{\\sigma\_z} W\_t s…

---

## [MonteCarloMeasurements & MTK, again](https://discourse.julialang.org/t/montecarlomeasurements-mtk-again/106205)

<div class="topic-metadata">

**Author:** [@BLI](https://discourse.julialang.org/u/BLI)\
**Replies:** 3\
**Last updated:** [November 14, 2023, 2:45pm UTC](https://discourse.julialang.org/t/montecarlomeasurements-mtk-again/106205 "2023-11-14T14:45:42Z")

</div>

I’m trying to use MonteCarloMeasurements with MTK. I have some problems wrt. (i) the number of particles, and (ii) interpretation/presentation of the results. Here is a simple RC circuit example: using Plots, LaTeXStri…

---

## [ComponentArray of ArrayPartition](https://discourse.julialang.org/t/componentarray-of-arraypartition/106048)

<div class="topic-metadata">

**Author:** [@sand](https://discourse.julialang.org/u/sand)\
**Replies:** 9\
**Last updated:** [November 11, 2023, 9:56am UTC](https://discourse.julialang.org/t/componentarray-of-arraypartition/106048 "2023-11-11T09:56:56Z")

</div>

Hello, I am trying to use a ArrayPartition inside a ComponentArray. Here is a MRE: using ComponentArrays using RecursiveArrayTools var1 = ArrayPartition(randn(10), randn(10)); var2 = ComponentArray(a=randn(10), b=…

---

## [Boundary conditions (?) in MethodOfLines.jl PDE](https://discourse.julialang.org/t/boundary-conditions-in-methodoflines-jl-pde/91725)

<div class="topic-metadata">

**Author:** [@sdwfrost](https://discourse.julialang.org/u/sdwfrost)\
**Replies:** 23\
**Last updated:** [November 8, 2023, 4:36pm UTC](https://discourse.julialang.org/t/boundary-conditions-in-methodoflines-jl-pde/91725 "2023-11-08T16:36:14Z")

</div>

Hi everyone, I’m trying out the new capability to deal with integrals in MethodOfLines.jl (in the new main, v0.7.6). I’m trying to simply expand an ODE example into a PDE. For those of you interested, the ODE is a simpl…

---

## [Molly.jl: AD with Enyzme returns 0 gradient](https://discourse.julialang.org/t/molly-jl-ad-with-enyzme-returns-0-gradient/105835)

<div class="topic-metadata">

**Author:** [@dan\_k](https://discourse.julialang.org/u/dan_k)\
**Replies:** 4\
**Last updated:** [November 7, 2023, 3:48am UTC](https://discourse.julialang.org/t/molly-jl-ad-with-enyzme-returns-0-gradient/105835 "2023-11-07T03:48:34Z")

</div>

I am trying to use Enzyme.jl with Molly.jl to differentiate a MD Simulation with respect to some parameters. Unfortunately my program returns only gradients of magnitude 0. ( This has also been posted to Molly.jl: AD wi…

---

## [\[suggestions\] A Way to find fixed points of coupledODE with a parameter that's sqrt function](https://discourse.julialang.org/t/suggestions-a-way-to-find-fixed-points-of-coupledode-with-a-parameter-thats-sqrt-function/105858)

<div class="topic-metadata">

**Author:** [@hisacro](https://discourse.julialang.org/u/hisacro)\
**Replies:** 6\
**Last updated:** [November 6, 2023, 7:16pm UTC](https://discourse.julialang.org/t/suggestions-a-way-to-find-fixed-points-of-coupledode-with-a-parameter-thats-sqrt-function/105858 "2023-11-06T19:16:28Z")

</div>

Hello I’m trying to find fixed points of 2 coupled oscillator and one of the parameter is defined as sqrt (function of phase space variables) here’s the exact system, using DynamicalSystems, Plots, ChaosTools function…

---

## [Q: Symbolics.jl | How to convert symbolic multivariate polynomial to DynamicPolynomials type?](https://discourse.julialang.org/t/q-symbolics-jl-how-to-convert-symbolic-multivariate-polynomial-to-dynamicpolynomials-type/105618)

<div class="topic-metadata">

**Author:** [@Audrius-St](https://discourse.julialang.org/u/Audrius-St)\
**Replies:** 4\
**Last updated:** [November 5, 2023, 3:29am UTC](https://discourse.julialang.org/t/q-symbolics-jl-how-to-convert-symbolic-multivariate-polynomial-to-dynamicpolynomials-type/105618 "2023-11-05T03:29:16Z")

</div>

Hello, How would one go about converting symbolic multivariate polynomials generated in Symbolics.jl to DynamicPolynomials.jl type? The end goal is fast numerical evaluation of multivariate polynomials using FixedPol…

---

## [DifferentialEquations & DynamicalSystems: Converting output Vector{Vector{Float64}} to StateSpaceSet](https://discourse.julialang.org/t/differentialequations-dynamicalsystems-converting-output-vector-vector-float64-to-statespaceset/105793)

<div class="topic-metadata">

**Author:** [@MvanSteenbergen](https://discourse.julialang.org/u/MvanSteenbergen)\
**Replies:** 2\
**Last updated:** [November 6, 2023, 3:06am UTC](https://discourse.julialang.org/t/differentialequations-dynamicalsystems-converting-output-vector-vector-float64-to-statespaceset/105793 "2023-11-06T03:06:34Z")

</div>

I edited the post and added my steps below Hey, I am having compatibility issues with the DynamicalSystems and DifferentialEquations packages. I have implemented the following rule set using the DifferentialEquations …

---

## [DiscreteCallback does not trigger as expected](https://discourse.julialang.org/t/discretecallback-does-not-trigger-as-expected/105816)

<div class="topic-metadata">

**Author:** [@christianhvejsel](https://discourse.julialang.org/u/christianhvejsel)\
**Replies:** 6\
**Last updated:** [November 5, 2023, 8:21pm UTC](https://discourse.julialang.org/t/discretecallback-does-not-trigger-as-expected/105816 "2023-11-05T20:21:46Z")

</div>

I am testing whether DiscreteCallback could be used instead of ContinuousCallback. For testing purposes I modified the ContinuousCallback bouncing ball example from the documentation: Bouncing ball ContinuousCallback exa…

---

## [ModelingToolkit | Error with uncertain parameters using Measurements.jl](https://discourse.julialang.org/t/modelingtoolkit-error-with-uncertain-parameters-using-measurements-jl/105701)

<div class="topic-metadata">

**Author:** [@fabianmueller](https://discourse.julialang.org/u/fabianmueller)\
**Replies:** 7\
**Last updated:** [November 2, 2023, 6:46pm UTC](https://discourse.julialang.org/t/modelingtoolkit-error-with-uncertain-parameters-using-measurements-jl/105701 "2023-11-02T18:46:22Z")

</div>

Hello! :slight\_smile: Lately I am always getting an error when simulating a ModelingToolkit.jl model with uncertain parameters from Measurements.jl. I have the feeling that this worked before and the error especially ca…

---

## [Geometric Constraints and Collision Detection](https://discourse.julialang.org/t/geometric-constraints-and-collision-detection/105695)

<div class="topic-metadata">

**Author:** [@InesP](https://discourse.julialang.org/u/InesP)\
**Replies:** 0\
**Last updated:** [November 2, 2023, 12:20pm UTC](https://discourse.julialang.org/t/geometric-constraints-and-collision-detection/105695 "2023-11-02T12:20:13Z")

</div>

Hey :blush: I have a few questions about the Agents.jl and collision implementation. I am using the Agents.jl library to model crowd dynamics in closed and geometrically constrained spaces. My first approach to this pro…

---

## [Converting a symbolic transfer function to a TransferFunction](https://discourse.julialang.org/t/converting-a-symbolic-transfer-function-to-a-transferfunction/103740)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 16\
**Last updated:** [November 2, 2023, 8:34am UTC](https://discourse.julialang.org/t/converting-a-symbolic-transfer-function-to-a-transferfunction/103740 "2023-11-02T08:34:36Z")

</div>

Hello, any idea how to convert the following transfer function: julia\> res (-9.770075179266223e-8(s^4) - 2.543931256784638e-6(s^5) - 3.198336516372632e-5(s^6) - 0.00019354918819587642(s^7) - 0.000453357561824716(s^8)) …

---

## [Best Discrete Simulation Learning path](https://discourse.julialang.org/t/best-discrete-simulation-learning-path/105132)

<div class="topic-metadata">

**Author:** [@ameresv](https://discourse.julialang.org/u/ameresv)\
**Replies:** 3\
**Last updated:** [November 2, 2023, 12:15am UTC](https://discourse.julialang.org/t/best-discrete-simulation-learning-path/105132 "2023-11-02T00:15:50Z")

</div>

Hi folks! I seek suggestions for the best learning path of Discrete Simulation in Julia. Is there any book that you could suggest? I find that there are two packages: DiscreteEvents.jl and Simulate.jl; which is the mo…

---

## [DifferentialEquations: Gaussian error term in one of the equations makes it extremely slow (and error prone)](https://discourse.julialang.org/t/differentialequations-gaussian-error-term-in-one-of-the-equations-makes-it-extremely-slow-and-error-prone/105647)

<div class="topic-metadata">

**Author:** [@MvanSteenbergen](https://discourse.julialang.org/u/MvanSteenbergen)\
**Replies:** 2\
**Last updated:** [November 1, 2023, 12:02pm UTC](https://discourse.julialang.org/t/differentialequations-gaussian-error-term-in-one-of-the-equations-makes-it-extremely-slow-and-error-prone/105647 "2023-11-01T12:02:45Z")

</div>

Hey! For my thesis, I’m trying to implement this model in Julia, using the DifferentialEquations.jl package. I’ve made a rule based on a set of coupled differential equations to simulate some data. I have no previous k…

---

## [Speed of ApproxFun.jl solution to Screened Poisson in cylindrical coordinates](https://discourse.julialang.org/t/speed-of-approxfun-jl-solution-to-screened-poisson-in-cylindrical-coordinates/105565)

<div class="topic-metadata">

**Author:** [@parb](https://discourse.julialang.org/u/parb)\
**Replies:** 2\
**Last updated:** [October 30, 2023, 8:26pm UTC](https://discourse.julialang.org/t/speed-of-approxfun-jl-solution-to-screened-poisson-in-cylindrical-coordinates/105565 "2023-10-30T20:26:28Z")

</div>

The examples of ApproxFun.jl examples solutions are fascinating and powerful, and I’d love to figure out the best performance for solving the homogeneous screened Poisson equation but in cylindrical coordinates (with cir…

---

## [MethodError: no method matching \*(::ODESystem, ::Float64)](https://discourse.julialang.org/t/methoderror-no-method-matching-odesystem-float64/105532)

<div class="topic-metadata">

**Author:** [@aoifehealy](https://discourse.julialang.org/u/aoifehealy)\
**Replies:** 1\
**Last updated:** [October 29, 2023, 11:18am UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-odesystem-float64/105532 "2023-10-29T11:18:47Z")

</div>

Hi there, I am trying to model a 3 element windkessel circuit (see below) using modelingtoolkit By code is as following: using ModelingToolkit using Plots using DifferentialEquations @variables t D = Differential(t)…

---

## [How to get PDE solutions when doing foward time steps](https://discourse.julialang.org/t/how-to-get-pde-solutions-when-doing-foward-time-steps/105419)

<div class="topic-metadata">

**Author:** [@aplund](https://discourse.julialang.org/u/aplund)\
**Replies:** 2\
**Last updated:** [October 28, 2023, 11:06pm UTC](https://discourse.julialang.org/t/how-to-get-pde-solutions-when-doing-foward-time-steps/105419 "2023-10-28T23:06:38Z")

</div>

I’ve been trying to get the hang of solving DEs in Julia (i.e. new user). As a simple task, I tried to set up a 1-d Schrödinger equation and perform a time evolution. Here’s my effort so far: using ModelingToolkit usi…

---

## [Possible to adaptively shrink number of state variables/ODEs?](https://discourse.julialang.org/t/possible-to-adaptively-shrink-number-of-state-variables-odes/105507)

<div class="topic-metadata">

**Author:** [@differentialoperator](https://discourse.julialang.org/u/differentialoperator)\
**Replies:** 2\
**Last updated:** [October 28, 2023, 10:26pm UTC](https://discourse.julialang.org/t/possible-to-adaptively-shrink-number-of-state-variables-odes/105507 "2023-10-28T22:26:14Z")

</div>

I’m solving an ODE system adaptively in time (eg RK23). At minimum, I’m solving for the evolution of 10 coupled state variables so I have 10 (coupled non-linear) ODEs that are solved from some initial time to final time.…

---

## [Specifying which parameter to solve for in an ODE](https://discourse.julialang.org/t/specifying-which-parameter-to-solve-for-in-an-ode/105518)

<div class="topic-metadata">

**Author:** [@aoifehealy](https://discourse.julialang.org/u/aoifehealy)\
**Replies:** 1\
**Last updated:** [October 28, 2023, 6:29pm UTC](https://discourse.julialang.org/t/specifying-which-parameter-to-solve-for-in-an-ode/105518 "2023-10-28T18:29:02Z")

</div>

Hi there, I’m new to Julia and modelingtoolkit, and I am trying to use it to implement a 2 element windkessel model consisting of a capacitor and resistor in parallel My code is as follows: using ModelingToolkit using …

---

## [MTK: PDEs & Collocation/weighted residual method](https://discourse.julialang.org/t/mtk-pdes-collocation-weighted-residual-method/105241)

<div class="topic-metadata">

**Author:** [@BLI](https://discourse.julialang.org/u/BLI)\
**Replies:** 6\
**Last updated:** [October 28, 2023, 4:29pm UTC](https://discourse.julialang.org/t/mtk-pdes-collocation-weighted-residual-method/105241 "2023-10-28T16:29:33Z")

</div>

I’m trying to dig up some past knowledge on the “weighted residual method” – it seems to be quite similar to PINN. How can I make the following more elegant? To exemplify, I consider a co-current heat exchanger: \\frac…

---

## [DifferentialEquations 2nd order ODE interpolation for position](https://discourse.julialang.org/t/differentialequations-2nd-order-ode-interpolation-for-position/105409)

<div class="topic-metadata">

**Author:** [@rwalters31](https://discourse.julialang.org/u/rwalters31)\
**Replies:** 2\
**Last updated:** [October 28, 2023, 9:38am UTC](https://discourse.julialang.org/t/differentialequations-2nd-order-ode-interpolation-for-position/105409 "2023-10-28T09:38:28Z")

</div>

I am modeling simple projectile motion using the DifferentialEquations.jl package. I have read in the documentation that you can interpolate based on time to get an answer for an exact time. Instead of time I have been…

---

## [How to write equations less redundant](https://discourse.julialang.org/t/how-to-write-equations-less-redundant/105320)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 3\
**Last updated:** [October 25, 2023, 6:39pm UTC](https://discourse.julialang.org/t/how-to-write-equations-less-redundant/105320 "2023-10-25T18:39:57Z")

</div>

How can this code be written less redundant? if lin @parameters a=eq.a\_bar b=eq.b\_bar eqs = \[D(ω) ~ (Pr - Pg) / (J \* ω), D(Uest) ~ Ku \* e\_p, r\_ω ~ Uest \* λnom / R, …

---

## [Issue MethodOfLines.jl Burger equation with periodic BCs](https://discourse.julialang.org/t/issue-methodoflines-jl-burger-equation-with-periodic-bcs/104277)

<div class="topic-metadata">

**Author:** [@mleprovost](https://discourse.julialang.org/u/mleprovost)\
**Replies:** 5\
**Last updated:** [October 25, 2023, 5:55pm UTC](https://discourse.julialang.org/t/issue-methodoflines-jl-burger-equation-with-periodic-bcs/104277 "2023-10-25T17:55:13Z")

</div>

Hello, I would like to solve the 1D inviscid Burgers equation \\frac{\\partial u(x,t)}{\\partial t} + \\frac{1}{2} \\frac{\\partial u(x,t)^2}{\\partial x} = 0 with periodic BCs on \[0,1\], i.e. u(0, t) = u(1,t), using MethodOfLi…

---

## [ExtraVariablesSystemException when using structural\_simplify in Modelingtoolkit](https://discourse.julialang.org/t/extravariablessystemexception-when-using-structural-simplify-in-modelingtoolkit/105351)

<div class="topic-metadata">

**Author:** [@aoifehealy](https://discourse.julialang.org/u/aoifehealy)\
**Replies:** 2\
**Last updated:** [October 25, 2023, 10:50am UTC](https://discourse.julialang.org/t/extravariablessystemexception-when-using-structural-simplify-in-modelingtoolkit/105351 "2023-10-25T10:50:42Z")

</div>

Hi there, I’m new to julia (and Modelingtoolkit), and am trying to replicate a simple 2 element Windkessel model (capacitor and resistor in parallel). my code is as follows: using ModelingToolkit using Plots using Diffe…

---

## [Change value of parameter and u0 after init ODEProblem DifferentialEquations.jl](https://discourse.julialang.org/t/change-value-of-parameter-and-u0-after-init-odeproblem-differentialequations-jl/105120)

<div class="topic-metadata">

**Author:** [@Sergey\_Novak](https://discourse.julialang.org/u/Sergey_Novak)\
**Replies:** 8\
**Last updated:** [October 24, 2023, 1:01pm UTC](https://discourse.julialang.org/t/change-value-of-parameter-and-u0-after-init-odeproblem-differentialequations-jl/105120 "2023-10-24T13:01:14Z")

</div>

Hello! How can I change the parameter value and initial conditions after initialization ODEProblem? I tried to change u0 using prob.u0 = newu0 But I got a warning Warning: Mutation of ODEProblem detected. SciMLBase v…

---

## [Symbols and variables](https://discourse.julialang.org/t/symbols-and-variables/105306)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 6\
**Last updated:** [October 23, 2023, 6:03pm UTC](https://discourse.julialang.org/t/symbols-and-variables/105306 "2023-10-23T18:03:35Z")

</div>

The following code fails: using ModelingToolkit @variables t @syms ω(t) Pgc(t) @variables R a b ρ U J A s struct Equilibrium a\_bar b\_bar pg\_bar # generator power ω\_bar # rotor speed end mutable…

---

## [Can NeuralPDE use neural nets with more than 1 outputs?](https://discourse.julialang.org/t/can-neuralpde-use-neural-nets-with-more-than-1-outputs/105163)

<div class="topic-metadata">

**Author:** [@Knud\_Sorensen](https://discourse.julialang.org/u/Knud_Sorensen)\
**Replies:** 2\
**Last updated:** [October 23, 2023, 1:59pm UTC](https://discourse.julialang.org/t/can-neuralpde-use-neural-nets-with-more-than-1-outputs/105163 "2023-10-23T13:59:47Z")

</div>

Hi. In the following code, I would like to use one neural net with 3 outputs instead of 3 neural nets with 1 output each. I got errors when I try. Is it possible ? All the example I have seen use different nets for diff…

---

## [Linearization with ModelingToolkit gives different results](https://discourse.julialang.org/t/linearization-with-modelingtoolkit-gives-different-results/105131)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 8\
**Last updated:** [October 23, 2023, 12:48pm UTC](https://discourse.julialang.org/t/linearization-with-modelingtoolkit-gives-different-results/105131 "2023-10-23T12:48:53Z")

</div>

Using the methods linearize\_symbolic and linearize gives different results, even though the results should be the same. Could be a bug in my code, or in ModelingToolkit. I share the code here, even though it is still pre…

---

## [Help with modifying SciML Missing Physics UDE example](https://discourse.julialang.org/t/help-with-modifying-sciml-missing-physics-ude-example/104773)

<div class="topic-metadata">

**Author:** [@BenWhip](https://discourse.julialang.org/u/BenWhip)\
**Replies:** 2\
**Last updated:** [October 20, 2023, 10:04pm UTC](https://discourse.julialang.org/t/help-with-modifying-sciml-missing-physics-ude-example/104773 "2023-10-20T22:04:02Z")

</div>

Hello all, I’ve made some minor modifications to the code from Automatically Discover Missing Physics by Embedding Machine Learning into Differential Equations · Overview of Julia's SciML My goal is to expose unknown p…

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

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