4
4
5
5
# ## In-place function
6
6
7
- function f_1delay (t , u, h, du )
7
+ function f_1delay (du , u, h, p, t )
8
8
du[1 ] = - h (t - oneunit (t))[1 ] / oneunit (t)
9
9
end
10
10
11
- function f_1delay (:: Type{Val{:analytic}} , t, u₀ )
11
+ function f_1delay (:: Type{Val{:analytic}} , u₀, p, t )
12
12
z = t/ oneunit (t)
13
13
14
14
if z < 0
@@ -77,7 +77,7 @@ prob_dde_1delay = build_prob_dde_1delay(1.0)
77
77
78
78
# ## Not in-place function
79
79
80
- function f_1delay_notinplace (t, u, h)
80
+ function f_1delay_notinplace (u, h, p, t )
81
81
- h (t - oneunit (t)) ./ oneunit (t)
82
82
end
83
83
@@ -113,11 +113,11 @@ prob_dde_1delay_scalar_notinplace = build_prob_dde_1delay_scalar_notinplace(1.0)
113
113
114
114
# ## In-place function
115
115
116
- function f_2delays (t :: T , u, h, du ) where {T <: Number }
116
+ function f_2delays (du :: T , u, h, p, t ) where T
117
117
du[1 ] = (- h (t - T (1 // 3 ))[1 ] - h (t - T (1 // 5 ))[1 ]) / oneunit (t)
118
118
end
119
119
120
- function f_2delays (:: Type{Val{:analytic}} , t, u₀ )
120
+ function f_2delays (:: Type{Val{:analytic}} , u₀, p, t )
121
121
z = t/ oneunit (t)
122
122
123
123
if z < 0
@@ -184,7 +184,7 @@ prob_dde_2delays = build_prob_dde_2delays(1.0)
184
184
185
185
# ## Not in-place function
186
186
187
- function f_2delays_notinplace (t :: T , u, h ) where {T}
187
+ function f_2delays_notinplace (u :: T , h, p, t ) where T
188
188
(- h (t - T (1 // 3 )) .- h (t - T (1 // 5 ))) ./ oneunit (t)
189
189
end
190
190
@@ -225,7 +225,7 @@ prob_dde_2delays_scalar_notinplace = build_prob_dde_2delays_scalar_notinplace(1.
225
225
226
226
# ## In-place function
227
227
228
- function f_1delay_long (t :: T , u, h, du ) where {T}
228
+ function f_1delay_long (du :: T , u, h, p, t ) where T
229
229
du[1 ] = (- h (t - T (1 // 5 ))[1 ] + u[1 ]) / oneunit (t)
230
230
end
231
231
@@ -258,7 +258,7 @@ prob_dde_1delay_long = build_prob_dde_1delay_long(1.0)
258
258
259
259
# ## Not in-place function
260
260
261
- function f_1delay_long_notinplace (t :: T , u, h ) where {T}
261
+ function f_1delay_long_notinplace (u :: T , h, p, t ) where T
262
262
(- h (t - T (1 // 5 )) .+ u ) ./ oneunit (t)
263
263
end
264
264
@@ -289,7 +289,7 @@ prob_dde_1delay_long_scalar_notinplace = build_prob_dde_1delay_long_scalar_notin
289
289
290
290
# ## In-place function
291
291
292
- function f_2delays_long (t :: T , u, h, du ) where {T}
292
+ function f_2delays_long (du :: T , u, h, p, t ) where T
293
293
du[1 ] = (- h (t - T (1 // 3 ))[1 ] - h (t - T (1 // 5 ))[1 ]) / oneunit (t)
294
294
end
295
295
@@ -322,7 +322,7 @@ prob_dde_2delays_long = build_prob_dde_2delays_long(1.0)
322
322
323
323
# ## Not in-place function
324
324
325
- function f_2delays_long_notinplace (t :: T , u, h ) where {T}
325
+ function f_2delays_long_notinplace (u :: T , h, p, t ) where T
326
326
(- h (t - T (1 // 3 )) .- h (t - T (1 // 5 ))) ./ oneunit (t)
327
327
end
328
328
@@ -360,7 +360,7 @@ W.H. Enright and H. Hayashi, The evaluation of numerical software for delay
360
360
differential equations.
361
361
=#
362
362
363
- function f_dde_mackey (t , u, h, du )
363
+ function f_dde_mackey (du , u, h, p, t )
364
364
du[1 ] = 0.2 * h (t- 14 )[1 ]/ (1 + h (t- 14 )[1 ]^ 10 ) - 0.1 * u[1 ]
365
365
end
366
366
@@ -372,7 +372,7 @@ chaos in physiological control systems, 1977).
372
372
"""
373
373
prob_dde_mackey = DDEProblem (f_dde_mackey, t -> [0.5 ], [0.5 ], (0.0 , 500.0 ), [14 ])
374
374
375
- function f_dde_wheldon (t , u, h, du )
375
+ function f_dde_wheldon (du , u, h, p, t )
376
376
du[1 ] = 1.1 / (1 + sqrt (10 )* (h (t- 20 )[1 ])^ (5 / 4 )) - 10 * u[1 ]/ (1 + 40 * u[2 ])
377
377
du[2 ] = 100 * u[1 ]/ (1 + 40 * u[2 ]) - 2.43 * u[2 ]
378
378
end
@@ -386,11 +386,11 @@ H. Finlay, Cyclical granulopoiesis in chronic granulocytic leukemia: A simulatio
386
386
"""
387
387
prob_dde_wheldon = DDEProblem (f_dde_wheldon, t -> u0_wheldon, u0_wheldon, (0. , 100. ), [20 ])
388
388
389
- function f_dde_neves1 (t , u, h, du )
389
+ function f_dde_neves1 (du , u, h, p, t )
390
390
du[1 ] = 1 - h (exp (1 - 1 / t))[1 ]
391
391
end
392
392
# only valid for specific history function
393
- function f_dde_neves1 (:: Type{Val{:analytic}} , t, u₀ )
393
+ function f_dde_neves1 (:: Type{Val{:analytic}} , u₀, p, t )
394
394
0 < t ≤ 10 && u₀ == [log (0.1 )] && return [log (t)]
395
395
error (" This analytical solution is only valid on (0, 10] and for history function ϕ(t) = ln(t) for 0 < t ≤ 0.1" )
396
396
end
@@ -404,15 +404,15 @@ of functional differential equations: An approach, 1975).
404
404
prob_dde_neves_1 = DDEProblem (f_dde_neves1, t -> [log (t)], [log (0.1 )], (0.1 , 10. ), [],
405
405
[(t, u) -> t - exp (1 - 1 / t)])
406
406
407
- function f_dde_neves_thompson (t , u, h, du )
407
+ function f_dde_neves_thompson (du , u, h, p, t )
408
408
if h (t/ 2 )[1 ] < 0
409
409
du[1 ] = 1 - u[1 ]
410
410
else
411
411
du[1 ] = - 1 - u[1 ]
412
412
end
413
413
end
414
414
# only valid for specific history function
415
- function f_dde_neves_thompson (:: Type{Val{:analytic}} , t, u₀ )
415
+ function f_dde_neves_thompson (:: Type{Val{:analytic}} , u₀, p, t )
416
416
if u₀ == [1 ]
417
417
if 0 ≤ t ≤ 2 * log (2 )
418
418
return [2 * exp (- t) - 1 ]
@@ -449,7 +449,7 @@ for ``t \\leq 0``.
449
449
prob_dde_neves_thompson = DDEProblem (f_dde_neves_thompson, t -> [1. ], [1. ], (0. , 2 * log (66 )),
450
450
[], [(t, u) -> t/ 2 ])
451
451
452
- function f_dde_paul1 (t , u, h, du )
452
+ function f_dde_paul1 (du , u, h, p, t )
453
453
du[1 ] = - 2 * h (t - 1 - abs (u[1 ]))[1 ]* (1 - u[1 ]^ 2 )
454
454
end
455
455
@@ -474,7 +474,7 @@ for ``t \\leq 0``.
474
474
prob_dde_paul1 = DDEProblem (f_dde_paul1, t -> [0.5 ], [0.5 ], (0. , 30. ), [],
475
475
[(t, u) -> 1 + abs (u[1 ])])
476
476
477
- function f_dde_paul2 (t , u, h, du )
477
+ function f_dde_paul2 (du , u, h, p, t )
478
478
h1 = h (t - u[2 ])[1 ]
479
479
du[1 ] = - 2 * h1
480
480
du[2 ] = (abs (h1) - abs (u[1 ]))/ (1 + abs (h1))
@@ -489,7 +489,7 @@ prob_dde_paul2 = DDEProblem(f_dde_paul2, t -> [1; 0.5], [1; 0.5], (0., 30.), [],
489
489
[(t, u) -> u[2 ]])
490
490
491
491
function build_prob_dde_mahaffy (tspan, h, σ₀, T₁, γ, Q, k, a, K, r)
492
- function f (t , u, h, du )
492
+ function f (du , u, h, p, t )
493
493
du[1 ] = σ₀* h (t- T₁)[2 ] - γ* u[1 ] - Q
494
494
du[2 ] = a/ (1 + K* u[1 ]^ r) - k* u[2 ]
495
495
du[3 ] = 1 - Q* exp (γ* u[3 ])/ (σ₀* h (t- T₁- u[3 ])[2 ])
@@ -517,13 +517,13 @@ M. C. Mackey, Hematopoietic model with moving boundary condition and state depen
517
517
"""
518
518
prob_dde_mahaffy1, prob_dde_mahaffy2
519
519
520
- function f_dde_neves2 (t , u, h, du )
520
+ function f_dde_neves2 (du , u, h, p, t )
521
521
t2 = exp (1 - u[2 ])
522
522
du[1 ] = u[2 ]
523
523
du[2 ] = - h (t2)[2 ]* u[2 ]^ 2 * t2
524
524
end
525
525
# only valid for specific history function
526
- function f_dde_neves2 (:: Type{Val{:analytic}} , t, u₀ )
526
+ function f_dde_neves2 (:: Type{Val{:analytic}} , u₀, p, t )
527
527
0 < t ≤ 5 && u₀ == [log (0.1 ); 10 ] && return [log (t); 1 / t]
528
528
error (" This analytical solution is only valid on (0, 5) and for history function ϕ(t) = [ln(t); 1/t] for 0 < t ≤ 0.1" )
529
529
end
@@ -538,7 +538,7 @@ prob_dde_neves2 = DDEProblem(f_dde_neves2, t -> [log(t); 1/t], [log(0.1); 10], (
538
538
[], [(t, u) -> t - exp (1 - u[2 ])])
539
539
540
540
function build_f_dde_gatica (r₁, r₂, α, δ)
541
- function f_dde_gatica (t , u, h, du )
541
+ function f_dde_gatica (du , u, h, p, t )
542
542
u₁u₂ = u[1 ]* u[2 ]
543
543
r₁u₁u₂ = r₁* u₁u₂
544
544
r₂u₃ = r₂* u[3 ]
@@ -580,7 +580,7 @@ function build_prob_dde_qs(u₀, tspan, τ, D, γₛ, Kₘ, nₛ, a, αₐ, β
580
580
581
581
S₀ = u₀[1 ]
582
582
583
- function f_dde_qs (t , u, h, du )
583
+ function f_dde_qs (du , u, h, p, t )
584
584
if u[1 ] < 0
585
585
# eq. 1 and 2 not defined for u[1] < 0
586
586
du[1 ] = 0
0 commit comments