Skip to content

Commit 7b7ac7a

Browse files
authored
fix: set max time span to 1e16 for CoupledSDEs (#230)
* fix: set max time span to 1e6 for CoupledSDEs * fix approximate covariance test * tag patch version
1 parent d161bce commit 7b7ac7a

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
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.12.1"
4+
version = "3.12.2"
55

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

ext/src/CoupledSDEs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function DynamicalSystemsBase.CoupledSDEs(
5151
f,
5252
g,
5353
s,
54-
(T(t0), T(Inf)),
54+
(T(t0), T(1e11)),
5555
p;
5656
noise_rate_prototype=noise_prototype,
5757
noise=noise_process,

test/stochastic.jl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using DynamicalSystemsBase, Test
22
using OrdinaryDiffEq: Tsit5
3-
using StochasticDiffEq: SDEProblem, SRA, SOSRA, LambaEM, CorrelatedWienerProcess
3+
using StochasticDiffEq: SDEProblem, SRA, SOSRA, LambaEM, CorrelatedWienerProcess, EM
44

55
StochasticSystemsBase = Base.get_extension(DynamicalSystemsBase, :StochasticSystemsBase)
66
diffusion_matrix = StochasticSystemsBase.diffusion_matrix
@@ -148,10 +148,11 @@ end
148148
@testset "approximate cov" begin
149149
Γ = [1.0 0.3; 0.3 1]
150150
f(u, p, t) = [0.0, 0.0]
151+
diffeq_cov = (alg = EM(), abstol = 1e-2, reltol = 1e-2, dt=0.1)
152+
151153
ds = CoupledSDEs(f, zeros(2), (); covariance = Γ, diffeq=diffeq_cov)
152-
tr, _ = trajectory(ds, 1_000)
153-
approx = cov(diff(reduce(hcat, tr.data), dims=2), dims=2)
154-
@test approx Γ atol=1e-1 broken = true
155-
# I think I understand something wromg here
154+
tr, _ = trajectory(ds, 10_000, Δt=0.1)
155+
approx = cov(diff(reduce(hcat, tr.data), dims=2)./sqrt(0.1), dims=2)
156+
@test approx Γ atol=1e-1
156157
end
157158
end

0 commit comments

Comments
 (0)