Skip to content

Commit

Permalink
fix: set max time span to 1e16 for CoupledSDEs (#230)
Browse files Browse the repository at this point in the history
* fix: set max time span to 1e6 for CoupledSDEs

* fix approximate covariance test

* tag patch version
  • Loading branch information
oameye authored Dec 2, 2024
1 parent d161bce commit 7b7ac7a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "DynamicalSystemsBase"
uuid = "6e36e845-645a-534a-86f2-f5d4aa5a06b4"
repo = "https://github.com/JuliaDynamics/DynamicalSystemsBase.jl.git"
version = "3.12.1"
version = "3.12.2"

[deps]
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
Expand Down
2 changes: 1 addition & 1 deletion ext/src/CoupledSDEs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function DynamicalSystemsBase.CoupledSDEs(
f,
g,
s,
(T(t0), T(Inf)),
(T(t0), T(1e11)),
p;
noise_rate_prototype=noise_prototype,
noise=noise_process,
Expand Down
11 changes: 6 additions & 5 deletions test/stochastic.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using DynamicalSystemsBase, Test
using OrdinaryDiffEq: Tsit5
using StochasticDiffEq: SDEProblem, SRA, SOSRA, LambaEM, CorrelatedWienerProcess
using StochasticDiffEq: SDEProblem, SRA, SOSRA, LambaEM, CorrelatedWienerProcess, EM

StochasticSystemsBase = Base.get_extension(DynamicalSystemsBase, :StochasticSystemsBase)
diffusion_matrix = StochasticSystemsBase.diffusion_matrix
Expand Down Expand Up @@ -148,10 +148,11 @@ end
@testset "approximate cov" begin
Γ = [1.0 0.3; 0.3 1]
f(u, p, t) = [0.0, 0.0]
diffeq_cov = (alg = EM(), abstol = 1e-2, reltol = 1e-2, dt=0.1)

ds = CoupledSDEs(f, zeros(2), (); covariance = Γ, diffeq=diffeq_cov)
tr, _ = trajectory(ds, 1_000)
approx = cov(diff(reduce(hcat, tr.data), dims=2), dims=2)
@test approx Γ atol=1e-1 broken = true
# I think I understand something wromg here
tr, _ = trajectory(ds, 10_000, Δt=0.1)
approx = cov(diff(reduce(hcat, tr.data), dims=2)./sqrt(0.1), dims=2)
@test approx Γ atol=1e-1
end
end

0 comments on commit 7b7ac7a

Please sign in to comment.