# Solving delayed differential equations with Julia

**URL:** <https://discourse.julialang.org/t/solving-delayed-differential-equations-with-julia/30827>\
**Category:** General Usage\
**Created:** [November 7, 2019, 12:39pm UTC](https://discourse.julialang.org/t/solving-delayed-differential-equations-with-julia/30827 "2019-11-07T12:39:35Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luigi\_Marongiu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/luigi_marongiu/32/7909_2.png) [@Luigi\_Marongiu](https://discourse.julialang.org/u/Luigi_Marongiu)\
**Post date:** [November 7, 2019, 12:39pm UTC](https://discourse.julialang.org/t/solving-delayed-differential-equations-with-julia/30827/1 "2019-11-07T12:39:35Z")

</div>

Dear all,  
I would like to solve some delayed differential equations that look like this  
 ![form](https://global.discourse-cdn.com/julialang/original/3X/7/2/7262059fbdc0bbf47c403f22ccf5b64bb7548715.jpeg)  
where `t` is a fix time and `x` is a variable time point.  
I understand that there are specific packages that do this analysis, one being dde23 for matlab. I found [this one](https://github.com/JuliaDiffEq/DiffEqDocs.jl/blob/master/docs/src/solvers/dde_solve.md) for Julia. Are there other packages? And some introductory manual?  
Thank you

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [November 7, 2019, 1:07pm UTC](https://discourse.julialang.org/t/solving-delayed-differential-equations-with-julia/30827/2 "2019-11-07T13:07:30Z")

</div>

I recommend starting with the tutorial: [http://docs.juliadiffeq.org/latest/tutorials/dde\_example.html](http://docs.juliadiffeq.org/latest/tutorials/dde_example.html)

---

<div class="post-metadata">

**Author:** ![Luigi\_Marongiu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/luigi_marongiu/32/7909_2.png) [@Luigi\_Marongiu](https://discourse.julialang.org/u/Luigi_Marongiu)\
**Post date:** [November 22, 2019, 1:38pm UTC](https://discourse.julialang.org/t/solving-delayed-differential-equations-with-julia/30827/3 "2019-11-22T13:38:51Z")

</div>

Thank you, I did but I can’t understand the logic behind. For instance, in the manual you cite – [in relation to ordinary differential equations](https://docs.juliadiffeq.org/latest/tutorials/ode_example/) – they report that:

```julia
du/dt = f(u, p, t) 
u(t) = u₀exp(αt)

```

so, how could it be that one can simply create an object  
`f(u,p,t) = 1.01*u`  
and simp[ly solve it with

```julia
u0=1/2
tspan = (0.0,1.0)
prob = ODEProblem(f,u0,tspan)

```

And this is about simple ODE, let alone more complex stuff. But I am not sure if this is the right forum to discuss such issues.  
Thank you anyway.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [November 22, 2019, 3:34pm UTC](https://discourse.julialang.org/t/solving-delayed-differential-equations-with-julia/30827/4 "2019-11-22T15:34:11Z")

</div>

> [@Luigi\_Marongiu](#):
>
> And this is about simple ODE, let alone more complex stuff. But I am not sure if this is the right forum to discuss such issues.

I don’t understand your question.

---

<div class="post-metadata">

**Author:** ![sgjanssens](https://avatars.discourse-cdn.com/v4/letter/s/9f8e36/32.png) [@sgjanssens](https://discourse.julialang.org/u/sgjanssens)\
**Post date:** [November 22, 2019, 4:51pm UTC](https://discourse.julialang.org/t/solving-delayed-differential-equations-with-julia/30827/5 "2019-11-22T16:51:58Z")

</div>

Sorry, but I have difficulties understanding your equation to begin with.

It appears there is variable (time-dependent but not state-dependent) delay x (this may be confusing, as it is more common to use the symbols \tau or r for the delay) but I don’t understand what is the unknown, nor do I see a time-derivative anywhere. It looks like before you program anything, you may want to first write your equation such that it clearly has the form of a DDE with time-dependent delay.

(It is also important to understand that DDEs are quite unlike ODEs conceptually, in the sense that they require a piece of function (as opposed to an n-tuple of numbers) as the initial condition, but perhaps you knew that already.)

---

<div class="post-metadata">

**Author:** ![Luigi\_Marongiu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/luigi_marongiu/32/7909_2.png) [@Luigi\_Marongiu](https://discourse.julialang.org/u/Luigi_Marongiu)\
**Post date:** [November 22, 2019, 5:23pm UTC](https://discourse.julialang.org/t/solving-delayed-differential-equations-with-julia/30827/6 "2019-11-22T17:23:04Z")

</div>

Thank you, I did but I can’t understand the logic behind. For instance, in the manual you cite – [in relation to ordinary differential equations](https://docs.juliadiffeq.org/latest/tutorials/ode_example/) – they report that:

```julia
du/dt = f(u, p, t) 
u(t) = u₀exp(αt)

```

so, how could it be that one can simply create an object  
`f(u,p,t) = 1.01*u`  
and simp[ly solve it with  
u0=1/2  
tspan = (0.0,1.0)  
prob = ODEProblem(f,u0,tspan)

Well, is more an assertion: There is lot under the hood in this package. I am slowly studying how to use. My problem was more related with the lorenzian equations thus I am trying to work at that level. Thank you

---

<div class="post-metadata">

**Author:** ![Luigi\_Marongiu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/luigi_marongiu/32/7909_2.png) [@Luigi\_Marongiu](https://discourse.julialang.org/u/Luigi_Marongiu)\
**Post date:** [November 22, 2019, 5:26pm UTC](https://discourse.julialang.org/t/solving-delayed-differential-equations-with-julia/30827/7 "2019-11-22T17:26:01Z")

</div>

.t-x turns out was the value of these equations at that time point, not the difference in time as I though, which implies I need the solver to identify those values… starting point is the least of the problems.
