Skip to content

Commit ae0c4ac

Browse files
update DDEProblems to have no parameters
1 parent 9e643f5 commit ae0c4ac

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

src/dde_premade_problems.jl

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function f_1delay(::Type{Val{:analytic}}, u₀, p, t)
4747
end
4848

4949
build_prob_dde_1delay(u₀, ::T=u₀) where {T} =
50-
DDEProblem(f_1delay, t->[zero(u₀)], [u₀], (zero(T), T(10)), [oneunit(T)])
50+
DDEProblem(f_1delay, t->[zero(u₀)], [u₀], (zero(T), T(10)), nothing, [oneunit(T)])
5151

5252
"""
5353
prob_dde_1delay
@@ -81,12 +81,12 @@ function f_1delay_notinplace(u, h, p, t)
8181
- h(t - oneunit(t)) ./ oneunit(t)
8282
end
8383

84-
f_1delay_notinplace(::Type{Val{:analytic}}, t, u0) = f_1delay(Val{:analytic}, t, u0)
84+
f_1delay_notinplace(::Type{Val{:analytic}}, u0, p, t) = f_1delay(Val{:analytic}, u0, p, t)
8585

8686
#### Vectorized history function
8787

8888
build_prob_dde_1delay_notinplace(u₀, ::T=u₀) where {T} =
89-
DDEProblem(f_1delay_notinplace, t->[zero(u₀)], [u₀], (zero(T), T(10)), [oneunit(T)])
89+
DDEProblem(f_1delay_notinplace, t->[zero(u₀)], [u₀], (zero(T), T(10)), nothing, [oneunit(T)])
9090

9191
"""
9292
prob_dde_1delay_notinplace
@@ -99,7 +99,7 @@ prob_dde_1delay_notinplace = build_prob_dde_1delay_notinplace(1.0)
9999
#### Scalar history function
100100

101101
build_prob_dde_1delay_scalar_notinplace(u₀, ::T=u₀) where {T} =
102-
DDEProblem(f_1delay_notinplace, t -> zero(u₀), u₀, (zero(T), T(10)), [oneunit(T)])
102+
DDEProblem(f_1delay_notinplace, t -> zero(u₀), u₀, (zero(T), T(10)), nothing, [oneunit(T)])
103103

104104
"""
105105
prob_dde_1delay_scalar_notinplace
@@ -113,7 +113,7 @@ prob_dde_1delay_scalar_notinplace = build_prob_dde_1delay_scalar_notinplace(1.0)
113113

114114
### In-place function
115115

116-
function f_2delays(du::T, u, h, p, t) where T
116+
function f_2delays(du, u, h, p, t::T) where T
117117
du[1] = (- h(t - T(1//3))[1] - h(t - T(1//5))[1]) / oneunit(t)
118118
end
119119

@@ -154,7 +154,7 @@ function f_2delays(::Type{Val{:analytic}}, u₀, p, t)
154154
end
155155

156156
build_prob_dde_2delays(u₀, ::T=u₀) where {T} =
157-
DDEProblem(f_2delays, t -> [zero(u₀)], [u₀], (zero(T), oneunit(T)), [T(1//3), T(1//5)])
157+
DDEProblem(f_2delays, t -> [zero(u₀)], [u₀], (zero(T), oneunit(T)), nothing, [T(1//3), T(1//5)])
158158

159159
"""
160160
prob_dde_2delays
@@ -184,18 +184,18 @@ prob_dde_2delays = build_prob_dde_2delays(1.0)
184184

185185
### Not in-place function
186186

187-
function f_2delays_notinplace(u::T, h, p, t) where T
187+
function f_2delays_notinplace(u, h, p, t::T) where T
188188
(- h(t - T(1//3)) .- h(t - T(1//5))) ./ oneunit(t)
189189
end
190190

191-
f_2delays_notinplace(::Type{Val{:analytic}}, t, u0) =
192-
f_2delays(Val{:analytic}, t, u0)
191+
f_2delays_notinplace(::Type{Val{:analytic}}, u0, p, t) =
192+
f_2delays(Val{:analytic}, u0, p, t)
193193

194194
#### Vectorized history function
195195

196196
build_prob_dde_2delays_notinplace(u₀, ::T=u₀) where {T} =
197197
DDEProblem(f_2delays_notinplace, t -> [zero(u₀)], [u₀], (zero(T), oneunit(T)),
198-
[T(1//3), T(1//5)])
198+
nothing, [T(1//3), T(1//5)])
199199

200200
"""
201201
prob_dde_2delays_notinplace
@@ -209,7 +209,7 @@ prob_dde_2delays_notinplace = build_prob_dde_2delays_notinplace(1.0)
209209

210210
build_prob_dde_2delays_scalar_notinplace(u₀, ::T=u₀) where {T} =
211211
DDEProblem(f_2delays_notinplace, t -> zero(u₀), u₀, (zero(T), oneunit(T)),
212-
[T(1//3), T(1//5)])
212+
nothing, [T(1//3), T(1//5)])
213213

214214
"""
215215
prob_dde_2delays_scalar_notinplace
@@ -225,12 +225,12 @@ prob_dde_2delays_scalar_notinplace = build_prob_dde_2delays_scalar_notinplace(1.
225225

226226
### In-place function
227227

228-
function f_1delay_long(du::T, u, h, p, t) where T
228+
function f_1delay_long(du, u, h, p, t::T) where T
229229
du[1] = (- h(t - T(1//5))[1] + u[1]) / oneunit(t)
230230
end
231231

232232
build_prob_dde_1delay_long(u₀, ::T=u₀) where {T} =
233-
DDEProblem(f_1delay_long, t -> [zero(u₀)], [u₀], (zero(T), T(100)), [T(1//5)])
233+
DDEProblem(f_1delay_long, t -> [zero(u₀)], [u₀], (zero(T), T(100)), nothing, [T(1//5)])
234234

235235
"""
236236
prob_dde_1delay_long
@@ -258,13 +258,13 @@ prob_dde_1delay_long = build_prob_dde_1delay_long(1.0)
258258

259259
### Not in-place function
260260

261-
function f_1delay_long_notinplace(u::T, h, p, t) where T
261+
function f_1delay_long_notinplace(u, h, p, t::T) where T
262262
(- h(t - T(1//5)) .+ u ) ./ oneunit(t)
263263
end
264264

265265
build_prob_dde_1delay_long_notinplace(u₀, ::T=u₀) where {T} =
266266
DDEProblem(f_1delay_long_notinplace, t -> [zero(u₀)], [u₀], (zero(T), T(100)),
267-
[T(1//5)])
267+
nothing, [T(1//5)])
268268

269269
"""
270270
prob_dde_1delay_long_notinplace
@@ -275,7 +275,7 @@ in-place function.
275275
prob_dde_1delay_long_notinplace = build_prob_dde_1delay_long_notinplace(1.0)
276276

277277
build_prob_dde_1delay_long_scalar_notinplace(u₀, ::T=u₀) where {T} =
278-
DDEProblem(f_1delay_long_notinplace, t -> zero(u₀), u₀, (zero(T), T(100)), [T(1//5)])
278+
DDEProblem(f_1delay_long_notinplace, t -> zero(u₀), u₀, (zero(T), T(100)), nothing, [T(1//5)])
279279

280280
"""
281281
prob_dde_1delay_long_scalar_notinplace
@@ -289,12 +289,12 @@ prob_dde_1delay_long_scalar_notinplace = build_prob_dde_1delay_long_scalar_notin
289289

290290
### In-place function
291291

292-
function f_2delays_long(du::T, u, h, p, t) where T
292+
function f_2delays_long(du, u, h, p, t::T) where T
293293
du[1] = (- h(t - T(1//3))[1] - h(t - T(1//5))[1]) / oneunit(t)
294294
end
295295

296296
build_prob_dde_2delays_long(u₀, ::T=u₀) where {T} =
297-
DDEProblem(f_2delays_long, t -> [zero(u₀)], [u₀], (zero(T), T(100)), [T(1//3), T(1//5)])
297+
DDEProblem(f_2delays_long, t -> [zero(u₀)], [u₀], (zero(T), T(100)), nothing, [T(1//3), T(1//5)])
298298

299299
"""
300300
prob_dde_2delays_long
@@ -322,15 +322,15 @@ prob_dde_2delays_long = build_prob_dde_2delays_long(1.0)
322322

323323
### Not in-place function
324324

325-
function f_2delays_long_notinplace(u::T, h, p, t) where T
325+
function f_2delays_long_notinplace(u, h, p, t::T) where T
326326
(- h(t - T(1//3)) .- h(t - T(1//5))) ./ oneunit(t)
327327
end
328328

329329
#### Vectorized history function
330330

331331
build_prob_dde_2delays_long_notinplace(u₀, ::T=u₀) where {T} =
332332
DDEProblem(f_2delays_long_notinplace, t -> [zero(u₀)], [u₀], (zero(T), T(100)),
333-
[T(1//3), T(1//5)])
333+
nothing, [T(1//3), T(1//5)])
334334

335335
"""
336336
prob_dde_2delays_long_notinplace
@@ -344,7 +344,7 @@ prob_dde_2delays_long_notinplace = build_prob_dde_2delays_long_notinplace(1.0)
344344

345345
build_prob_dde_2delays_long_scalar_notinplace(u₀, ::T=u₀) where {T} =
346346
DDEProblem(f_2delays_long_notinplace, t -> zero(u₀), u₀, (zero(T), T(100)),
347-
[T(1//3), T(1//5)])
347+
nothing, [T(1//3), T(1//5)])
348348

349349
"""
350350
prob_dde_2delays_long_scalar_notinplace
@@ -370,7 +370,7 @@ end
370370
Model of blood production with constant delay (M. C. Mackey and L. Glass, Oscillation and
371371
chaos in physiological control systems, 1977).
372372
"""
373-
prob_dde_mackey = DDEProblem(f_dde_mackey, t -> [0.5], [0.5], (0.0, 500.0), [14])
373+
prob_dde_mackey = DDEProblem(f_dde_mackey, t -> [0.5], [0.5], (0.0, 500.0), nothing, [14])
374374

375375
function f_dde_wheldon(du, u, h, p, t)
376376
du[1] = 1.1/(1 + sqrt(10)*(h(t-20)[1])^(5/4)) - 10*u[1]/(1 + 40*u[2])
@@ -402,7 +402,7 @@ DDE with vanishing time dependent delay at ``t = 1`` (K. W. Neves, Automatic int
402402
of functional differential equations: An approach, 1975).
403403
"""
404404
prob_dde_neves_1 = DDEProblem(f_dde_neves1, t -> [log(t)], [log(0.1)], (0.1, 10.), [],
405-
[(t, u) -> t - exp(1 - 1/t)])
405+
nothing, [(t, u) -> t - exp(1 - 1/t)])
406406

407407
function f_dde_neves_thompson(du, u, h, p, t)
408408
if h(t/2)[1] < 0
@@ -447,7 +447,7 @@ u(t) = 1
447447
for ``t \\leq 0``.
448448
"""
449449
prob_dde_neves_thompson = DDEProblem(f_dde_neves_thompson, t -> [1.], [1.], (0., 2*log(66)),
450-
[], [(t, u) -> t/2])
450+
nothing, [], [(t, u) -> t/2])
451451

452452
function f_dde_paul1(du, u, h, p, t)
453453
du[1] = - 2*h(t - 1 - abs(u[1]))[1]*(1 - u[1]^2)
@@ -471,7 +471,7 @@ u(t) = 1/2
471471
472472
for ``t \\leq 0``.
473473
"""
474-
prob_dde_paul1 = DDEProblem(f_dde_paul1, t -> [0.5], [0.5], (0., 30.), [],
474+
prob_dde_paul1 = DDEProblem(f_dde_paul1, t -> [0.5], [0.5], (0., 30.), nothing, [],
475475
[(t, u) -> 1 + abs(u[1])])
476476

477477
function f_dde_paul2(du, u, h, p, t)
@@ -485,7 +485,7 @@ end
485485
486486
DDE with state dependent delay (C. A. H. Paul, A test set of functional differential equations, 1994).
487487
"""
488-
prob_dde_paul2 = DDEProblem(f_dde_paul2, t -> [1; 0.5], [1; 0.5], (0., 30.), [],
488+
prob_dde_paul2 = DDEProblem(f_dde_paul2, t -> [1; 0.5], [1; 0.5], (0., 30.), nothing, [],
489489
[(t, u) -> u[2]])
490490

491491
function build_prob_dde_mahaffy(tspan, h, σ₀, T₁, γ, Q, k, a, K, r)
@@ -495,7 +495,7 @@ function build_prob_dde_mahaffy(tspan, h, σ₀, T₁, γ, Q, k, a, K, r)
495495
du[3] = 1 - Q*exp*u[3])/(σ₀*h(t-T₁-u[3])[2])
496496
end
497497

498-
DDEProblem(f, h, h(0), tspan, [T₁], [(t, u) -> T₁ + u[3]])
498+
DDEProblem(f, h, h(0), tspan, nothing, [T₁], [(t, u) -> T₁ + u[3]])
499499
end
500500

501501
function h_mahaffy1(t)
@@ -535,7 +535,7 @@ DDE with vanishing state dependent delay at ``t = 1`` (K. W. Neves, Automatic in
535535
of functional differential equations: An approach, 1975).
536536
"""
537537
prob_dde_neves2 = DDEProblem(f_dde_neves2, t -> [log(t); 1/t], [log(0.1); 10], (0.1, 5.),
538-
[], [(t, u) -> t - exp(1 - u[2])])
538+
nothing, [], [(t, u) -> t - exp(1 - u[2])])
539539

540540
function build_f_dde_gatica(r₁, r₂, α, δ)
541541
function f_dde_gatica(du, u, h, p, t)
@@ -559,7 +559,7 @@ Model of antigen antibody dynamics with fading memory, with vanishing state depe
559559
at ``t = 0`` (J. Gatica and P. Waltman, A threshold model of antigen antibody dynamics with fading memory, 1982).
560560
"""
561561
prob_dde_gatica = DDEProblem(build_f_dde_gatica(0.02, 0.005, 3, 0.01), t -> [5; 0.1; 0; 0],
562-
[5; 0.1; 0; 0], (0., 40.), [], [(t, u) -> u[4]])
562+
[5; 0.1; 0; 0], (0., 40.), nothing, [], [(t, u) -> u[4]])
563563

564564
#=
565565
Quorum Sensing model
@@ -611,7 +611,7 @@ function build_prob_dde_qs(u₀, tspan, τ, D, γₛ, Kₘ, nₛ, a, αₐ, β
611611
end
612612
end
613613

614-
DDEProblem(f_dde_qs, t -> u₀, u₀, tspan, [τ])
614+
DDEProblem(f_dde_qs, t -> u₀, u₀, tspan, nothing, [τ])
615615
end
616616

617617
"""

0 commit comments

Comments
 (0)