Skip to content

Commit de431f1

Browse files
ChrisRackauckas-ClaudeChrisRackauckasclaude
authored
Give the SRI weak-order study enough trajectories for its own tolerance (#4096)
`iip_weak.jl`'s SRI study asserts `abs(𝒪est[:weak_final] - 2) < 0.5` from 2e4 trajectories. Sampling the estimator over 12 independent seeds shows that tolerance is too tight for that sample size: trajectories 𝒪 range mean sd max |𝒪-2| 2e4 [1.822, 2.277] 2.006 0.172 0.277 1e5 [1.892, 2.214] 2.008 0.100 0.214 4e5 [1.910, 2.078] 1.972 0.049 0.090 The mean sits on 2 at every count and `sd` falls as `1/sqrt(n)` to within noise, so the estimator is unbiased and the only problem is spread. The study's own RNG state — seeded once at the top of the file and advanced by the fifteen studies before it — lands about 3σ out, at `0.5533865655544976`, and fails. This has not been seen because the group never reached line 186: the file was OOM-killed at the SROCK2 call on line 71 until #4060. Raise the count to 4e5 rather than widen the tolerance. At 4e5 the worst of 12 seeds is 0.09 from 2, more than five times inside the existing bound, so the assertion still catches a real order regression; widening it to admit a bad estimate would not. The cost is ~4 minutes for that one study. Verified with the whole group, 16 GiB cgroup, JULIA_NUM_THREADS=2: GROUP=IIPWeakConvergence -> tests passed, 17m00s, 1.55 GiB peak which is the first end-to-end run of this file — everything after line 186 had never executed before. Fixes #4061 Claude-Session: https://claude.ai/code/session_01UwLXp5WY1uiqPun7qhwxeU Co-authored-by: ChrisRackauckas-Claude <accounts@chrisrackauckas.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 54675c7 commit de431f1

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

lib/StochasticDiffEq/test/weak_convergence/iip_weak.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,12 @@ sim = test_convergence(
179179
#@test abs(sim.𝒪est[:weak_l∞]-1) < 0.3
180180
println("SRI")
181181
dts = 1 .// 2 .^ (8:-1:2)
182+
# 2e4 trajectories leaves the weak-order estimate with a standard deviation of 0.17
183+
# against a 0.5 tolerance, so a ~3σ draw breaches it — which is what this study's own
184+
# RNG state produced (𝒪 off by 0.553). 4e5 brings the spread to 0.049, worst case 0.09
185+
# over 12 seeds. See issue #4061.
182186
sim = test_convergence(
183-
dts, prob, SRI(), save_everystep = false, trajectories = Int(2.0e4),
187+
dts, prob, SRI(), save_everystep = false, trajectories = Int(4.0e5),
184188
weak_timeseries_errors = false
185189
)
186190
@test abs(sim.𝒪est[:weak_final] - 2) < 0.5

0 commit comments

Comments
 (0)