|
1 | 1 | using DynamicalSystemsBase, Test |
2 | 2 | using OrdinaryDiffEq: Tsit5 |
3 | | -using StochasticDiffEq: SDEProblem, SRA, SOSRA, LambaEM, CorrelatedWienerProcess |
| 3 | +using StochasticDiffEq: SDEProblem, SRA, SOSRA, LambaEM, CorrelatedWienerProcess, EM |
4 | 4 |
|
5 | 5 | StochasticSystemsBase = Base.get_extension(DynamicalSystemsBase, :StochasticSystemsBase) |
6 | 6 | diffusion_matrix = StochasticSystemsBase.diffusion_matrix |
@@ -148,10 +148,11 @@ end |
148 | 148 | @testset "approximate cov" begin |
149 | 149 | Γ = [1.0 0.3; 0.3 1] |
150 | 150 | f(u, p, t) = [0.0, 0.0] |
| 151 | + diffeq_cov = (alg = EM(), abstol = 1e-2, reltol = 1e-2, dt=0.1) |
| 152 | + |
151 | 153 | 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 |
156 | 157 | end |
157 | 158 | end |
0 commit comments