# Modelling & Simulations

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

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

**Page:** 58

---

## [Julia code for 1-D discrete system](https://discourse.julialang.org/t/julia-code-for-1-d-discrete-system/54403)

<div class="topic-metadata">

**Author:** [@mukherji](https://discourse.julialang.org/u/mukherji)\
**Replies:** 4\
**Last updated:** [February 2, 2021, 3:36am UTC](https://discourse.julialang.org/t/julia-code-for-1-d-discrete-system/54403 "2021-02-02T03:36:24Z")

</div>

I have a relatively straightforward one-dimensional discrete system that is a variation of the logistic equation. I cannot figure out how to create my own function in Julia. For example, how do I model x(t+1) = p\[1\]+p\[2…

---

## [4D plotting](https://discourse.julialang.org/t/4d-plotting/54138)

<div class="topic-metadata">

**Author:** [@Ruchitha\_Kumar](https://discourse.julialang.org/u/Ruchitha_Kumar)\
**Replies:** 8\
**Last updated:** [January 31, 2021, 7:03pm UTC](https://discourse.julialang.org/t/4d-plotting/54138 "2021-01-31T19:03:12Z")

</div>

How to plot a 4D graph in julia? Can someone please help with this? Thanks in advance

---

## [Importance of offset](https://discourse.julialang.org/t/importance-of-offset/54170)

<div class="topic-metadata">

**Author:** [@Ruchitha\_Kumar](https://discourse.julialang.org/u/Ruchitha_Kumar)\
**Replies:** 3\
**Last updated:** [January 29, 2021, 10:54am UTC](https://discourse.julialang.org/t/importance-of-offset/54170 "2021-01-29T10:54:07Z")

</div>

What does the offset 20 signify in the below code? using ModelingToolkit @variables x y z @parameters a b c ----Define a nonlinear system eqs = \[0 ~ - y - (z+20), 0 ~ x + a \* y, 0 ~ b + (z+20) \* (x - c)\] ns = Non…

---

## [DifferentialEquations.jl solution object: save\_idxs and interpolation](https://discourse.julialang.org/t/differentialequations-jl-solution-object-save-idxs-and-interpolation/54030)

<div class="topic-metadata">

**Author:** [@cdwhite](https://discourse.julialang.org/u/cdwhite)\
**Replies:** 3\
**Last updated:** [January 27, 2021, 11:55am UTC](https://discourse.julialang.org/t/differentialequations-jl-solution-object-save-idxs-and-interpolation/54030 "2021-01-27T11:55:25Z")

</div>

Hello, I’m trying to solve a largeish number of largeish systems of linear differential equations. I ultimately only care about one component from each equation, so save\_idxs in principle should be exactly what I want: …

---

## [ModelingToolkit.jl periodic callbacks -- discrete controllers and model transitions from events](https://discourse.julialang.org/t/modelingtoolkit-jl-periodic-callbacks-discrete-controllers-and-model-transitions-from-events/53933)

<div class="topic-metadata">

**Author:** [@Allan\_Baker](https://discourse.julialang.org/u/Allan_Baker)\
**Replies:** 2\
**Last updated:** [January 27, 2021, 1:19am UTC](https://discourse.julialang.org/t/modelingtoolkit-jl-periodic-callbacks-discrete-controllers-and-model-transitions-from-events/53933 "2021-01-27T01:19:42Z")

</div>

How would one use the ModelingToolkit to model a physical system but interface it to a discrete controller? I don’t see this in any of the examples? (But maybe I’m not looking in the right spot.) Is it just a callback…

---

## [VectorContinuousCallback creating too many time steps?](https://discourse.julialang.org/t/vectorcontinuouscallback-creating-too-many-time-steps/53940)

<div class="topic-metadata">

**Author:** [@jonniedie](https://discourse.julialang.org/u/jonniedie)\
**Replies:** 1\
**Last updated:** [January 26, 2021, 1:32pm UTC](https://discourse.julialang.org/t/vectorcontinuouscallback-creating-too-many-time-steps/53940 "2021-01-26T13:32:54Z")

</div>

I have a VectorContinuousCallback of four variables. As you can see below, things are pretty monotonic and should be relatively straightforward for rootfinding. For some reason, though, my simulation is taking a few …

---

## [Performance comparision for equivalent DiffEqFlux models](https://discourse.julialang.org/t/performance-comparision-for-equivalent-diffeqflux-models/53804)

<div class="topic-metadata">

**Author:** [@Kevin\_Kleinbeck](https://discourse.julialang.org/u/Kevin_Kleinbeck)\
**Replies:** 3\
**Last updated:** [January 23, 2021, 7:28am UTC](https://discourse.julialang.org/t/performance-comparision-for-equivalent-diffeqflux-models/53804 "2021-01-23T07:28:19Z")

</div>

Hello, I am considering these 3 ODEs function minimalModelNonAlloc!(D, u, p, t) M = p v = 0.2 .\* ones(length(u)) D .= v - M \* u.^3 - u.^5 return nothing end function minimalModelAlloc(u, p, t) M = p v = 0.2 .\* …

---

## [Create random numbers into a same array](https://discourse.julialang.org/t/create-random-numbers-into-a-same-array/53766)

<div class="topic-metadata">

**Author:** [@Xijiang\_Yu](https://discourse.julialang.org/u/Xijiang_Yu)\
**Replies:** 2\
**Last updated:** [January 22, 2021, 8:33am UTC](https://discourse.julialang.org/t/create-random-numbers-into-a-same-array/53766 "2021-01-22T08:33:06Z")

</div>

Is there any way to create random numbers into a same array? I am simulating using rand(n) ~1M times, i.e. to determine snp allele to drop into the next generation. This causes a lot of allocations. Or is there some bet…

---

## [ModelingToolkit.jl: ERROR: LoadError: UndefVarError: Sym not defined](https://discourse.julialang.org/t/modelingtoolkit-jl-error-loaderror-undefvarerror-sym-not-defined/53569)

<div class="topic-metadata">

**Author:** [@grheadrick](https://discourse.julialang.org/u/grheadrick)\
**Replies:** 4\
**Last updated:** [January 22, 2021, 2:33am UTC](https://discourse.julialang.org/t/modelingtoolkit-jl-error-loaderror-undefvarerror-sym-not-defined/53569 "2021-01-22T02:33:24Z")

</div>

I’m just getting started with SciML and am looking at ModelingToolkit.jl. The macros work: @variables x y But in docs there is a macro free usage . The above code should also be equivalent to: x = Num(Sym{Float64}(:x)…

---

## [Numerical questions about spatially varying parameters for ParallelStencil.jl](https://discourse.julialang.org/t/numerical-questions-about-spatially-varying-parameters-for-parallelstencil-jl/53558)

<div class="topic-metadata">

**Author:** [@ziyiyin97](https://discourse.julialang.org/u/ziyiyin97)\
**Replies:** 4\
**Last updated:** [January 20, 2021, 4:44am UTC](https://discourse.julialang.org/t/numerical-questions-about-spatially-varying-parameters-for-parallelstencil-jl/53558 "2021-01-20T04:44:42Z")

</div>

Hi developers for ParallelStencil.jl, Hope you stepped into the new year with ease. I have experienced with your julia software in a while, thanks to your clear documentation and workflow! I have a couple of questions …

---

## [Simulated Method of Moments / Indirect inference: how might ModelingToolkit be extended to provide convenient user inteface?](https://discourse.julialang.org/t/simulated-method-of-moments-indirect-inference-how-might-modelingtoolkit-be-extended-to-provide-convenient-user-inteface/53395)

<div class="topic-metadata">

**Author:** [@croberts](https://discourse.julialang.org/u/croberts)\
**Replies:** 16\
**Last updated:** [January 19, 2021, 5:39pm UTC](https://discourse.julialang.org/t/simulated-method-of-moments-indirect-inference-how-might-modelingtoolkit-be-extended-to-provide-convenient-user-inteface/53395 "2021-01-19T17:39:55Z")

</div>

I am looking to estimate a simulated method of moments model. The most similar thread on SMM is from 2019 but does not settle issues: The most similar thread is: Global optimization: Simulated Method of Moments . Julia…

---

## [Kanai-Tajimi Process (seismic simulation)](https://discourse.julialang.org/t/kanai-tajimi-process-seismic-simulation/53553)

<div class="topic-metadata">

**Author:** [@Frederic\_Gilt](https://discourse.julialang.org/u/Frederic_Gilt)\
**Replies:** 0\
**Last updated:** [January 18, 2021, 6:15pm UTC](https://discourse.julialang.org/t/kanai-tajimi-process-seismic-simulation/53553 "2021-01-18T18:15:25Z")

</div>

Dear All, I am a basic user of Julia and was wondering if it’s possible to achieve simulations of mechanical structures facing seismic input modeled with Kanai-Tajami process There is a cool description of such kind of…

---

## [Help me to model and optimize an alternative wind turbine](https://discourse.julialang.org/t/help-me-to-model-and-optimize-an-alternative-wind-turbine/51532)

<div class="topic-metadata">

**Author:** [@Impressium](https://discourse.julialang.org/u/Impressium)\
**Replies:** 6\
**Last updated:** [January 15, 2021, 7:58pm UTC](https://discourse.julialang.org/t/help-me-to-model-and-optimize-an-alternative-wind-turbine/51532 "2021-01-15T19:58:59Z")

</div>

Heyy best community :slight\_smile: I’ve got this idea for a long time but didn’t had the time to share and visualize it. But here it is :smiley: I modeled it in a steady state and got: …

---

## [Second derivative of shape functions in JuAFEM](https://discourse.julialang.org/t/second-derivative-of-shape-functions-in-juafem/53160)

<div class="topic-metadata">

**Author:** [@FrootLoops](https://discourse.julialang.org/u/FrootLoops)\
**Replies:** 3\
**Last updated:** [January 12, 2021, 8:56am UTC](https://discourse.julialang.org/t/second-derivative-of-shape-functions-in-juafem/53160 "2021-01-12T08:56:23Z")

</div>

Hi, is there already a implemented function, which computes the second derivatives of the shape function at a given point? I am working with PDEs of higher-order and therefore need high order derivates of the used ansa…

---

## [DiffEq tolerances on ContinuousCallbacks?](https://discourse.julialang.org/t/diffeq-tolerances-on-continuouscallbacks/53181)

<div class="topic-metadata">

**Author:** [@klaff](https://discourse.julialang.org/u/klaff)\
**Replies:** 7\
**Last updated:** [January 12, 2021, 6:49am UTC](https://discourse.julialang.org/t/diffeq-tolerances-on-continuouscallbacks/53181 "2021-01-12T06:49:12Z")

</div>

I’m troubleshooting some friction models and trying to understand what I’m seeing. I’ve made a MWE by taking the bouncing ball model from the DiffEq docs and changing the coefficient of restitution to 0.1 instead of 1.0 …

---

## [Can ContinuousCallbacks in DifferentialEquations.jl be used to watch parameters?](https://discourse.julialang.org/t/can-continuouscallbacks-in-differentialequations-jl-be-used-to-watch-parameters/52674)

<div class="topic-metadata">

**Author:** [@klaff](https://discourse.julialang.org/u/klaff)\
**Replies:** 10\
**Last updated:** [January 2, 2021, 5:49am UTC](https://discourse.julialang.org/t/can-continuouscallbacks-in-differentialequations-jl-be-used-to-watch-parameters/52674 "2021-01-02T05:49:34Z")

</div>

I’m trying to use a VectorContinuousCallback to handle friction and end stops. Some of the conditions are not based on the state variables u but on a value stuffed into a field of the parameters p. Code: using Differen…

---

## [ANN MinimallyDisruptiveCurves.jl](https://discourse.julialang.org/t/ann-minimallydisruptivecurves-jl/47874)

<div class="topic-metadata">

**Author:** [@Dhruva2](https://discourse.julialang.org/u/Dhruva2)\
**Replies:** 5\
**Last updated:** [December 30, 2020, 10:46am UTC](https://discourse.julialang.org/t/ann-minimallydisruptivecurves-jl/47874 "2020-12-30T10:46:07Z")

</div>

Hi all, I thought I would crosspost my package announcement here. The package implements a recent algorithm for regional sensitivity analysis of models with many parameters. Any models, as long as there is a differe…

---

## [Beginning to compare LTSpice and Julia Diff Eq](https://discourse.julialang.org/t/beginning-to-compare-ltspice-and-julia-diff-eq/51988)

<div class="topic-metadata">

**Author:** [@klaff](https://discourse.julialang.org/u/klaff)\
**Replies:** 8\
**Last updated:** [December 30, 2020, 12:08am UTC](https://discourse.julialang.org/t/beginning-to-compare-ltspice-and-julia-diff-eq/51988 "2020-12-30T00:08:33Z")

</div>

I’ve been doing mixed simulations (some electronics, some physics, some digital control) for a bit and wrote up a little Pluto notebook comparing a tank circuit simulation in LTSpice and using DiffEq. I was surprised at …

---

## [Is it possible to use Julia as a co-simulator in conjunction to PSCAD/EMTDC or MATLAB](https://discourse.julialang.org/t/is-it-possible-to-use-julia-as-a-co-simulator-in-conjunction-to-pscad-emtdc-or-matlab/52516)

<div class="topic-metadata">

**Author:** [@anchasatish](https://discourse.julialang.org/u/anchasatish)\
**Replies:** 2\
**Last updated:** [December 29, 2020, 2:10pm UTC](https://discourse.julialang.org/t/is-it-possible-to-use-julia-as-a-co-simulator-in-conjunction-to-pscad-emtdc-or-matlab/52516 "2020-12-29T14:10:41Z")

</div>

I want to use Julia programming for running optimization of the system whose dynamic modeling is made in EMTDC/PSCAD, or MATLAB, i.e., optimization problem solved in Julia and output of this optimization solution is give…

---

## [DDE too stiff? Required tolerances are too slow](https://discourse.julialang.org/t/dde-too-stiff-required-tolerances-are-too-slow/52259)

<div class="topic-metadata">

**Author:** [@ANasc](https://discourse.julialang.org/u/ANasc)\
**Replies:** 4\
**Last updated:** [December 24, 2020, 4:51am UTC](https://discourse.julialang.org/t/dde-too-stiff-required-tolerances-are-too-slow/52259 "2020-12-24T04:51:49Z")

</div>

Hi, I have a system of DDEs that model host-parasite dynamics in a seasonal environment and I am having some issues because (I think) the equations are so stiff. Basically, when the number of hosts S is too high (\> abou…

---

## [Numerical continuation and periodic orbits](https://discourse.julialang.org/t/numerical-continuation-and-periodic-orbits/51580)

<div class="topic-metadata">

**Author:** [@cadojo](https://discourse.julialang.org/u/cadojo)\
**Replies:** 11\
**Last updated:** [December 19, 2020, 3:08pm UTC](https://discourse.julialang.org/t/numerical-continuation-and-periodic-orbits/51580 "2020-12-19T15:08:07Z")

</div>

Apologies if this question is poorly worded, I’m very new to numerical continuation and nonlinear frequency analysis. I have a nonlinear system of ODEs, and I’d like to numerically find periodic solutions for a changing …

---

## [DifferentialEquations error: "Event repeated at the same time"](https://discourse.julialang.org/t/differentialequations-error-event-repeated-at-the-same-time/51830)

<div class="topic-metadata">

**Author:** [@Bastien](https://discourse.julialang.org/u/Bastien)\
**Replies:** 12\
**Last updated:** [December 16, 2020, 6:38pm UTC](https://discourse.julialang.org/t/differentialequations-error-event-repeated-at-the-same-time/51830 "2020-12-16T18:38:01Z")

</div>

Hi, I’m trying to reproduce results presented in Roup et al. where a verge and foliot mechanism used in clocks is simulated. I tried to use a VectorContinuousCallback to determine the times at which collision events hap…

---

## [In-place allocations in DifferentialEquations](https://discourse.julialang.org/t/in-place-allocations-in-differentialequations/51813)

<div class="topic-metadata">

**Author:** [@oeyd](https://discourse.julialang.org/u/oeyd)\
**Replies:** 9\
**Last updated:** [December 14, 2020, 7:59pm UTC](https://discourse.julialang.org/t/in-place-allocations-in-differentialequations/51813 "2020-12-14T19:59:15Z")

</div>

I am wondering why the code below allocates as much memory as it does despite using an in-place function definition. Is this normal or is there a way to avoid these allocations? using DifferentialEquations function ode…

---

## [How to use EnsembleDistributed() in DifferentialEquations.jl](https://discourse.julialang.org/t/how-to-use-ensembledistributed-in-differentialequations-jl/51642)

<div class="topic-metadata">

**Author:** [@jmmm](https://discourse.julialang.org/u/jmmm)\
**Replies:** 2\
**Last updated:** [December 11, 2020, 10:07am UTC](https://discourse.julialang.org/t/how-to-use-ensembledistributed-in-differentialequations-jl/51642 "2020-12-11T10:07:48Z")

</div>

I was following a tutorial in Stochastic Differential Equations · DifferentialEquations.jl (sciml.ai) and tried to modify it to use EnsembleDistributed() to speed up MC simulations. This is from the tutorial: using Dif…

---

## [DiffEq and SVector](https://discourse.julialang.org/t/diffeq-and-svector/51541)

<div class="topic-metadata">

**Author:** [@klaff](https://discourse.julialang.org/u/klaff)\
**Replies:** 16\
**Last updated:** [December 10, 2020, 11:11pm UTC](https://discourse.julialang.org/t/diffeq-and-svector/51541 "2020-12-10T23:11:57Z")

</div>

Hello, I’ve been rereading some of the docs and tutorials in SciML and in particular this Optimizing DiffEq Code, and tried using StaticArrays as in the lorenz example, but on a problem of my own. In my case, the execut…

---

## [\[Solved\] Time evaluation issue in a non-autonomous ODE](https://discourse.julialang.org/t/solved-time-evaluation-issue-in-a-non-autonomous-ode/51458)

<div class="topic-metadata">

**Author:** [@Wen-Wei\_Tseng](https://discourse.julialang.org/u/Wen-Wei_Tseng)\
**Replies:** 2\
**Last updated:** [December 8, 2020, 2:09pm UTC](https://discourse.julialang.org/t/solved-time-evaluation-issue-in-a-non-autonomous-ode/51458 "2020-12-08T14:09:22Z")

</div>

Hello everyone, I found a weird situation that a time-dependent parameter seemed to be ignored in my calcium dynamics model. After some trimming, I had an MWE here. Any suggestions/corrections are welcome. Edit: solved …

---

## [ModelingToolkit variable with Distributions.cdf()](https://discourse.julialang.org/t/modelingtoolkit-variable-with-distributions-cdf/51434)

<div class="topic-metadata">

**Author:** [@jmmm](https://discourse.julialang.org/u/jmmm)\
**Replies:** 4\
**Last updated:** [December 8, 2020, 3:36am UTC](https://discourse.julialang.org/t/modelingtoolkit-variable-with-distributions-cdf/51434 "2020-12-08T03:36:20Z")

</div>

Hi, I am new to Julia and trying out the ModelingToolking package. I have a basic understanding of the type system and the dynamic dispatch, but couldn’t figure out why this didn’t work. This works perfectly - almost m…

---

## [CoolProp fluid property database reinforces its availability for Julia users](https://discourse.julialang.org/t/coolprop-fluid-property-database-reinforces-its-availability-for-julia-users/1325)

<div class="topic-metadata">

**Author:** [@DANA-Laboratory](https://discourse.julialang.org/u/DANA-Laboratory)\
**Replies:** 27\
**Last updated:** [December 2, 2020, 3:38am UTC](https://discourse.julialang.org/t/coolprop-fluid-property-database-reinforces-its-availability-for-julia-users/1325 "2020-12-02T03:38:03Z")

</div>

CoolProp, Is an open-source, cross-platform, reference-quality fluid property database that mirrors many of the functionalities of REFPROP. The codebase is written in C++ and wrappers are available for Python and C#. A …

---

## [Local sensitivities via ForwardSensitivity from DifferentialEquations in optimization with AD](https://discourse.julialang.org/t/local-sensitivities-via-forwardsensitivity-from-differentialequations-in-optimization-with-ad/50286)

<div class="topic-metadata">

**Author:** [@moesphere](https://discourse.julialang.org/u/moesphere)\
**Replies:** 2\
**Last updated:** [December 2, 2020, 1:47am UTC](https://discourse.julialang.org/t/local-sensitivities-via-forwardsensitivity-from-differentialequations-in-optimization-with-ad/50286 "2020-12-02T01:47:24Z")

</div>

I am trying to optimize local sensitivities of an ode problem using ODEForwardSensitivityProblem from the DifferentialEquations suite, but the last line throws a TypeError. I am using forward sensitivites as the ode sys…

---

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

<div class="topic-metadata">

**Author:** [@contradict](https://discourse.julialang.org/u/contradict)\
**Replies:** 2\
**Last updated:** [November 28, 2020, 4:11am UTC](https://discourse.julialang.org/t/error-while-using-modelingtoolkit/50881 "2020-11-28T04:11:58Z")

</div>

I am building a model of a pneumatic system with ModelingToolkit and have gotten stuck. I have a not-very-minimal example of the error in this gist. I haven’t been able to trim it down any more and preserve the error. H…

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

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