From 7123196bee4f731115cb73333c9072ce8d14b055 Mon Sep 17 00:00:00 2001 From: ChrisRackauckas-Claude Date: Sun, 2 Aug 2026 08:13:10 -0400 Subject: [PATCH] Give the SRI weak-order study enough trajectories for its own tolerance MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `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 Co-Authored-By: Chris Rackauckas Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01UwLXp5WY1uiqPun7qhwxeU --- lib/StochasticDiffEq/test/weak_convergence/iip_weak.jl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/StochasticDiffEq/test/weak_convergence/iip_weak.jl b/lib/StochasticDiffEq/test/weak_convergence/iip_weak.jl index 0ebb1c3b602..3fa28cb2867 100644 --- a/lib/StochasticDiffEq/test/weak_convergence/iip_weak.jl +++ b/lib/StochasticDiffEq/test/weak_convergence/iip_weak.jl @@ -179,8 +179,12 @@ sim = test_convergence( #@test abs(sim.π’ͺest[:weak_l∞]-1) < 0.3 println("SRI") dts = 1 .// 2 .^ (8:-1:2) +# 2e4 trajectories leaves the weak-order estimate with a standard deviation of 0.17 +# against a 0.5 tolerance, so a ~3Οƒ draw breaches it β€” which is what this study's own +# RNG state produced (π’ͺ off by 0.553). 4e5 brings the spread to 0.049, worst case 0.09 +# over 12 seeds. See issue #4061. sim = test_convergence( - dts, prob, SRI(), save_everystep = false, trajectories = Int(2.0e4), + dts, prob, SRI(), save_everystep = false, trajectories = Int(4.0e5), weak_timeseries_errors = false ) @test abs(sim.π’ͺest[:weak_final] - 2) < 0.5