generate_rs_reference

Reference-trajectory generator for the Roessler RS1/RS2 Stratonovich weak-order-2 integrators with MULTIPLE (m > 1), possibly non-commutative, noise sources.

Why a separate reference from the Julia one: StochasticDiffEq.jl’s in-place RS cache has an array-aliasing defect in its multi-noise cross-terms (it does H22[k] = uprev - aliasing rather than copying the working state - then mutates it in place), so its m > 1 trajectory does not match the method as published. This generator therefore implements the method directly from the primary source,

A. Roessler, “Second Order Runge-Kutta Methods for Stratonovich Stochastic Differential Equations”, BIT Numer. Math. 47 (2007), 657-680,

equations (5.1)-(5.2) with the Table 5.2/5.3 coefficients. It is validated against the paper’s own published error tables (Table 6.1 commutative, Table 6.3 non-commutative) by validate_paper_tables() below, which reproduces Roessler’s RS1 weak errors to 3 significant figures and shows the expected weak order 2.

Like the Julia generator, this PRESCRIBES the underlying Gaussian increments (dW, dZ) and applies exactly the transforms the Basilisk integrator uses (stochasticWeakRandomVariables: three-point for Ihat, two-point for Itilde), so the Basilisk test can replay the identical increments and compare to floating-point tolerance. This script is not run in CI; the JSON it writes is committed.

Run: python3 generate_rs_reference.py

generate_rs_reference.problem_commutative()[source]

Roessler SDE (6.1): 2 states, 2 commutative (diagonal) noise sources.

generate_rs_reference.problem_noncommutative()[source]

Roessler SDE (6.2): 2 states, 2 non-commutative noise sources.

generate_rs_reference.rs_step(X, a, bcols, Ihat, Itilde, h, C)[source]

One RS step (vectorized over rows of X). a(X)->(M,d); bcols(X)->list of m (M,d); Ihat (M,m); Itilde (M,m-1). Returns (M,d).

generate_rs_reference.validate_paper_tables(M=2000000)[source]

Reproduce Roessler’s published RS1 weak-error tables to confirm correctness.