Skip to content

Commit 1106184

Browse files
authored
fix breakage of trajctory for discrete systems (#201)
* fix breakage of trajctory for discrete systems * bump version
1 parent 3041423 commit 1106184

File tree

5 files changed

+24
-3
lines changed

5 files changed

+24
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "DynamicalSystemsBase"
22
uuid = "6e36e845-645a-534a-86f2-f5d4aa5a06b4"
33
repo = "https://github.com/JuliaDynamics/DynamicalSystemsBase.jl.git"
4-
version = "3.7.0"
4+
version = "3.7.1"
55

66
[deps]
77
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"

src/core/trajectory.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function trajectory_discrete(ds, T;
5555
data[1] = obtain_state(current_state(ds), accessor)
5656
for i in 2:L
5757
step!(ds, Δt)
58-
data[i] = SVector{X, ET}(obtain_state(ds, current_state(ds), accessor))
58+
data[i] = SVector{X, ET}(obtain_state(ds, current_time(ds), accessor))
5959
if !successful_step(ds)
6060
# Diverged trajectory; set final state to remaining set
6161
# and exit iteration early

test/mtk_integration.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,4 +186,3 @@ X, tvec = trajectory(ds, 10.0; Δt = 0.1, save_idxs = Any[1, 2, η1])
186186

187187
@test all(abs.(diff(X[:, 1])) .> 1e-8)
188188
@test all(diff(X[:, 3]) .≈ 0.001)
189-

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ testfile(file, testname=defaultname(file)) = @testset "$testname" begin; include
1515
testfile("projected.jl")
1616
testfile("successful_step.jl")
1717
testfile("mtk_integration.jl")
18+
testfile("trajectory.jl")
1819
end

test/trajectory.jl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using DynamicalSystemsBase
2+
using Test
3+
4+
@testset "trajectory with `nothing`" begin
5+
6+
# time-dependent logistic map, so that the `r` parameter increases with time
7+
r1 = 3.83
8+
r2 = 3.86
9+
N = 2000
10+
rs = range(r1, r2; length = N)
11+
12+
function logistic_drifting_rule(u, rs, n)
13+
r = rs[n+1] # time is `n`, starting from 0
14+
return SVector(r*u[1]*(1 - u[1]))
15+
end
16+
17+
ds = DeterministicIteratedMap(logistic_drifting_rule, [0.5], rs)
18+
19+
x, t = trajectory(ds, N-1)
20+
@test length(x) > 1
21+
end

0 commit comments

Comments
 (0)