@@ -20,20 +20,28 @@ function _extrapolate_derivative_left(A, t, order)
20
20
elseif extrapolation_left == ExtrapolationType. Constant
21
21
zero (first (A. u) / one (A. t[1 ]))
22
22
elseif extrapolation_left == ExtrapolationType. Linear
23
- (order == 1 ) ? derivative (A, first (A. t)) : zero (first (A. u) / one (A. t[1 ]))
23
+ _derivative (A, first (A. t), 1 )
24
+ zero (first (A. u) / one (A. t[1 ]))
25
+ (order == 1 ) ? _derivative (A, first (A. t), 1 ) : zero (first (A. u) / one (A. t[1 ]))
24
26
elseif extrapolation_left == ExtrapolationType. Extension
25
- iguess = A. iguesser
26
- (order == 1 ) ? _derivative (A, t, iguess) :
27
+ (order == 1 ) ? _derivative (A, t, length (A. t)) :
27
28
ForwardDiff. derivative (t -> begin
28
- _derivative (A, t, iguess )
29
+ _derivative (A, t, length (A . t) )
29
30
end , t)
30
31
elseif extrapolation_left == ExtrapolationType. Periodic
31
32
t_, _ = transformation_periodic (A, t)
32
- derivative (A, t_, order)
33
+ (order == 1 ) ? _derivative (A, t_, A. iguesser) :
34
+ ForwardDiff. derivative (t -> begin
35
+ _derivative (A, t, A. iguesser)
36
+ end , t_)
33
37
else
34
38
# extrapolation_left == ExtrapolationType.Reflective
35
39
t_, n = transformation_reflective (A, t)
36
- isodd (n) ? - derivative (A, t_, order) : derivative (A, t_, order)
40
+ sign = isodd (n) ? - 1 : 1
41
+ (order == 1 ) ? sign * _derivative (A, t_, A. iguesser) :
42
+ ForwardDiff. derivative (t -> begin
43
+ sign * _derivative (A, t, A. iguesser)
44
+ end , t_)
37
45
end
38
46
end
39
47
@@ -44,20 +52,27 @@ function _extrapolate_derivative_right(A, t, order)
44
52
elseif extrapolation_right == ExtrapolationType. Constant
45
53
zero (first (A. u) / one (A. t[1 ]))
46
54
elseif extrapolation_right == ExtrapolationType. Linear
47
- (order == 1 ) ? derivative (A, last (A. t)) : zero (first (A. u) / one (A. t[1 ]))
55
+ (order == 1 ) ? _derivative (A, last (A. t), length (A. t)) :
56
+ zero (first (A. u) / one (A. t[1 ]))
48
57
elseif extrapolation_right == ExtrapolationType. Extension
49
- iguess = A. iguesser
50
- (order == 1 ) ? _derivative (A, t, iguess) :
58
+ (order == 1 ) ? _derivative (A, t, length (A. t)) :
51
59
ForwardDiff. derivative (t -> begin
52
- _derivative (A, t, iguess )
60
+ _derivative (A, t, length (A . t) )
53
61
end , t)
54
62
elseif extrapolation_right == ExtrapolationType. Periodic
55
63
t_, _ = transformation_periodic (A, t)
56
- derivative (A, t_, order)
64
+ (order == 1 ) ? _derivative (A, t_, A. iguesser) :
65
+ ForwardDiff. derivative (t -> begin
66
+ _derivative (A, t, A. iguesser)
67
+ end , t_)
57
68
else
58
- # extrapolation_right == ExtrapolationType.Reflective
69
+ # extrapolation_left == ExtrapolationType.Reflective
59
70
t_, n = transformation_reflective (A, t)
60
- iseven (n) ? - derivative (A, t_, order) : derivative (A, t_, order)
71
+ sign = iseven (n) ? - 1 : 1
72
+ (order == 1 ) ? sign * _derivative (A, t_, A. iguesser) :
73
+ ForwardDiff. derivative (t -> begin
74
+ sign * _derivative (A, t, A. iguesser)
75
+ end , t_)
61
76
end
62
77
end
63
78
@@ -299,4 +314,4 @@ function _derivative(
299
314
out += Δt₀^ 2 *
300
315
(3 c₁ + (3 Δt₁ + Δt₀) * c₂ + (3 Δt₁^ 2 + Δt₀ * 2 Δt₁) * c₃)
301
316
out
302
- end
317
+ end
0 commit comments