# Delay Differential Equations does not provide any solution

**URL:** <https://discourse.julialang.org/t/delay-differential-equations-does-not-provide-any-solution/96769>\
**Category:** General Usage\
**Tags:** question, error, differentialequation\
**Created:** [March 29, 2023, 10:04am UTC](https://discourse.julialang.org/t/delay-differential-equations-does-not-provide-any-solution/96769 "2023-03-29T10:04:23Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![pclus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pclus/32/48129_2.png) [@pclus](https://discourse.julialang.org/u/pclus)\
**Post date:** [March 29, 2023, 10:04am UTC](https://discourse.julialang.org/t/delay-differential-equations-does-not-provide-any-solution/96769/1 "2023-03-29T10:04:23Z")

</div>

I am trying to use DifferentialEquations.jl to solve a delay differential equation.  
However, I fail to reproduce [the example provided in the documentation](https://docs.sciml.ai/DiffEqDocs/stable/tutorials/dde_example/). I copy here the code of the example:

```julia
using DifferentialEquations
function bc_model(du,u,h,p,t)
  p0,q0,v0,d0,p1,q1,v1,d1,d2,beta0,beta1,tau = p
  hist3 = h(p, t-tau)[3]
  du[1] = (v0/(1+beta0*(hist3^2))) * (p0 - q0)*u[1] - d0*u[1]
  du[2] = (v0/(1+beta0*(hist3^2))) * (1 - p0 + q0)*u[1] +
          (v1/(1+beta1*(hist3^2))) * (p1 - q1)*u[2] - d1*u[2]
  du[3] = (v1/(1+beta1*(hist3^2))) * (1 - p1 + q1)*u[2] - d2*u[3]
end

h(p, t) = ones(3)
tau = 1
lags = [tau]
p0 = 0.2; q0 = 0.3; v0 = 1; d0 = 5
p1 = 0.2; q1 = 0.3; v1 = 1; d1 = 1
d2 = 1; beta0 = 1; beta1 = 1
p = (p0,q0,v0,d0,p1,q1,v1,d1,d2,beta0,beta1,tau)
tspan = (0.0,10.0)
u0 = [1.0,1.0,1.0]

prob = DDEProblem(bc_model,u0,h,tspan,p; constant_lags=lags)
alg = MethodOfSteps(Tsit5())
sol = solve(prob,alg)

```

This is supposed to give the solution integrated over `tspan`, but instead I get:

```julia
retcode: Default
Interpolation: specialized 4th order "free" interpolation
t: 1-element Vector{Float64}:
 0.0
u: 1-element Vector{Vector{Float64}}:
 [1.0, 1.0, 1.0]

```

I do not know how to solve the issue, it looks system specific, since the code is the same from the example. I tried to update the `DifferentialEquations` package with `pkg> update DifferentialEquations`, but I got the same result.

Any help will be appreciated, thanks!

---

<div class="post-metadata">

**Author:** ![DanielVandH](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/danielvandh/32/31134_2.png) [@DanielVandH](https://discourse.julialang.org/u/DanielVandH)\
**Post date:** [March 29, 2023, 10:41am UTC](https://discourse.julialang.org/t/delay-differential-equations-does-not-provide-any-solution/96769/2 "2023-03-29T10:41:31Z")

</div>

When I run your code, it works:

```julia
julia> using DifferentialEquations
       function bc_model(du,u,h,p,t)
         p0,q0,v0,d0,p1,q1,v1,d1,d2,beta0,beta1,tau = p
         hist3 = h(p, t-tau)[3]
         du[1] = (v0/(1+beta0*(hist3^2))) * (p0 - q0)*u[1] - d0*u[1]
         du[2] = (v0/(1+beta0*(hist3^2))) * (1 - p0 + q0)*u[1] +
                 (v1/(1+beta1*(hist3^2))) * (p1 - q1)*u[2] - d1*u[2]
         du[3] = (v1/(1+beta1*(hist3^2))) * (1 - p1 + q1)*u[2] - d2*u[3]
       end

       h(p, t) = ones(3)
       tau = 1
       lags = [tau]
       p0 = 0.2; q0 = 0.3; v0 = 1; d0 = 5
       p1 = 0.2; q1 = 0.3; v1 = 1; d1 = 1
       d2 = 1; beta0 = 1; beta1 = 1
       p = (p0,q0,v0,d0,p1,q1,v1,d1,d2,beta0,beta1,tau)
       tspan = (0.0,10.0)
       u0 = [1.0,1.0,1.0]

       prob = DDEProblem(bc_model,u0,h,tspan,p; constant_lags=lags)
       alg = MethodOfSteps(Tsit5())
       sol = solve(prob,alg)
retcode: Success
Interpolation: specialized 4th order "free" interpolation
t: 40-element Vector{Float64}:
  0.0
  0.05836370738671701
  0.12916108569539597
  0.21568702493539388
  0.31476012203954973
  0.42647876001237145
  0.5486009950019299
  0.6801498148290146
  0.8195261166349427
  0.9657507075079192
  1.0
  1.103945249125462
  1.1889713924683045
  1.3068791130791304
  1.4265100474451162
  ⋮
  4.0
  4.4496182069424535
  4.954793370438921
  5.0
  5.294570151715627
  5.637340314503988
  6.0
  6.465321265034228
  6.9807287937908855
  7.578753298968584
  8.241987232937237
  8.98383276855844
  9.794183131169206
 10.0
u: 40-element Vector{Vector{Float64}}:
 [1.0, 1.0, 1.0]
 [0.7447276972023367, 0.9674847415959038, 0.9739922644849844]
 [0.520865690149123, 0.9216176741982295, 0.9429345997713768]
 [0.33647961749786465, 0.860710765286255, 0.9053954304799672]
 [0.20402080446565815, 0.7893156306081849, 0.8627636946755286]
 [0.11605349292143427, 0.710940127223295, 0.8151154583589272]
 [0.06263661020799872, 0.6308046470869514, 0.7637408792490028]
 [0.03223510074296827, 0.5524928215361826, 0.7096033440842167]
 [0.01594663432245627, 0.47891242866857714, 0.654067407727854]
 [0.007620742290428411, 0.41158157168839415, 0.5982822197402151]
 [0.0064103562958189595, 0.39717276688745007, 0.5856252064346273]
 [0.0037919268480705306, 0.35633736118381737, 0.5487073922673725]
 [0.0024675106956094984, 0.32595725300932393, 0.5202749814350449]
 [0.0013594954886150064, 0.2879318058947559, 0.4832823717500593]
 [0.000742273383034329, 0.2537554121549729, 0.44842619881041823]
 ⋮
 [1.8604899421169303e-9, 0.015580097871373575, 0.07582169081549973]
 [2.945240907209338e-10, 0.009509072612829088, 0.053084099435442685]
 [5.916357176748074e-11, 0.005457695747422803, 0.03511215171816447]
 [4.698267809934584e-11, 0.0051930757438740345, 0.03381747966733331]
 [1.0618951337118308e-11, 0.003756298740343366, 0.026418510589087903]
 [1.9479598719208864e-12, 0.0025766300373552546, 0.0197374598472333]
 [3.3296189152665293e-13, 0.001729122637428431, 0.014435113877197158]
 [5.5064416255269584e-14, 0.0010364504244003874, 0.009606890211128613]
 [1.1838460929002524e-14, 0.0005879461631044232, 0.006079732552649997]
 [5.109127121132652e-15, 0.0003045520635702376, 0.003549648850830764]
 [4.075064652637717e-15, 0.0001468398691910801, 0.0019394744851741882]
 [6.623872359855281e-15, 6.493848650511485e-5, 0.0009786579729539678]
 [1.912280041308691e-14, 2.6637039533047875e-5, 0.0004599558275824244]
 [6.69983491663282e-15, 2.1240382256782126e-5, 0.0003792544387315653]

```

What version of DifferentialEquations are you using (see `] st`)?

---

<div class="post-metadata">

**Author:** ![pclus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pclus/32/48129_2.png) [@pclus](https://discourse.julialang.org/u/pclus)\
**Post date:** [March 29, 2023, 11:16am UTC](https://discourse.julialang.org/t/delay-differential-equations-does-not-provide-any-solution/96769/3 "2023-03-29T11:16:41Z")

</div>

Good to know that I did not mess copying the code…now the mystery is why it does not work in my computer.

Result of `] st`:

```julia
  [bcd4f6db] DelayDiffEq v5.37.0
  [0c46a032] DifferentialEquations v7.1.0

```

---

<div class="post-metadata">

**Author:** ![DanielVandH](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/danielvandh/32/31134_2.png) [@DanielVandH](https://discourse.julialang.org/u/DanielVandH)\
**Post date:** [March 29, 2023, 11:35am UTC](https://discourse.julialang.org/t/delay-differential-equations-does-not-provide-any-solution/96769/4 "2023-03-29T11:35:29Z")

</div>

Interesting. Even works for me on v7.1. Absent any copying errors on your end, I’m not sure what it could be then.

---

<div class="post-metadata">

**Author:** ![pclus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pclus/32/48129_2.png) [@pclus](https://discourse.julialang.org/u/pclus)\
**Post date:** [March 29, 2023, 1:18pm UTC](https://discourse.julialang.org/t/delay-differential-equations-does-not-provide-any-solution/96769/5 "2023-03-29T13:18:16Z")

</div>

I have reinstalled Julia from scratch and now it works. I assume the main problem was that I was using version 1.7.1 of Julia. Now I am using the latest v1.8.5. This has been painful though, since I have to reinstall all the packages I was using.

---

<div class="post-metadata">

**Author:** ![pclus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pclus/32/48129_2.png) [@pclus](https://discourse.julialang.org/u/pclus)\
**Post date:** [April 18, 2023, 3:55pm UTC](https://discourse.julialang.org/t/delay-differential-equations-does-not-provide-any-solution/96769/6 "2023-04-18T15:55:59Z")

</div>

Well, it no longer works. I just got the same problem I had in my original post, although I am using Julia 1.8.5. When I updated Julia it worked fine for a while, but now I am back to step one. I guess Julia or package versions are not the problem, or at least not entirely…

---

<div class="post-metadata">

**Author:** ![josuagrw](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/josuagrw/32/1015_2.png) [@josuagrw](https://discourse.julialang.org/u/josuagrw)\
**Post date:** [April 18, 2023, 4:00pm UTC](https://discourse.julialang.org/t/delay-differential-equations-does-not-provide-any-solution/96769/7 "2023-04-18T16:00:20Z")

</div>

Next time, you can copy the environment in your `.julia/environments` directory, e.g., from `v1.7` to `v1.8`. Then simply run `]update`. So far that has worked very well for me.

---

<div class="post-metadata">

**Author:** ![pclus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pclus/32/48129_2.png) [@pclus](https://discourse.julialang.org/u/pclus)\
**Post date:** [April 21, 2023, 10:22am UTC](https://discourse.julialang.org/t/delay-differential-equations-does-not-provide-any-solution/96769/8 "2023-04-21T10:22:44Z")

</div>

The source of the problem has an incompatibility with the Multitaper package that I had installed, and now everything should be solved. You can follow the entire story in the issue I raised: [DDE does not provide any solution (example from docs) · Issue #266 · SciML/DelayDiffEq.jl · GitHub](https://github.com/SciML/DelayDiffEq.jl/issues/266)
