Repository navigation
Pass Θ = 0, not the absolute time, to the AN5 startup interpolant - #4534
Merged
ChrisRackauckas merged 1 commit intoSep 12, 2026
Merged
ChrisRackauckas merged 1 commit into
ChrisRackauckas merged 1 commit into
Conversation
AN5 seeds its Nordsieck vector from a Tsit5 step, reading the higher derivatives out of the Tsit5 interpolant. `ode_interpolant`'s first argument is the normalised parameter Θ ∈ [0, 1], but the startup passed `t`. The vector is assembled at the start of the step (`z[1] = uprev`, `z[2] = k[1] * dt`), so the correct value is `Θ = 0`. Every standard test problem starts at t = 0, where `t` coincides with the right answer, which is why this went unnoticed. Away from the origin the startup derivatives are wrong, and because Θ then depends on where the interval sits, AN5 loses time-translation invariance (solving u' = 1.01u on (0,1) versus (100,101) gives different step counts) and time-reversal symmetry (on a tspan symmetric about zero it diverged from the mirrored solve at step 2, by 8e-5 relative). Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Agent-Harness: Claude Code 2.1.269 Agent-Model: claude-opus-5[1m] Agent-Session: https://claude.ai/code/session_01JQATpLKMyYX3VbPPX8qdeE Claude-Session: https://claude.ai/code/session_01JQATpLKMyYX3VbPPX8qdeE
ChrisRackauckas
marked this pull request as ready for review
September 12, 2026 19:32
ChrisRackauckas
added a commit
that referenced
this pull request
Sep 13, 2026
- OrdinaryDiffEqDefault: require OrdinaryDiffEqCore 4.17.1 (#4520) - Add adaptive step size control to SDC (#4346) - Allow JET 0.12 in every QA test environment (#4513) - Resolve OrdinaryDiffEqDefault against the local sublibraries (#4514) - NonlinearSolveAlg: stale-Jacobian retry + rejected-step W reassembly (carries #4282 to current master) (#4505) - Do not seed a retry from the previous-step interpolant (#4473) - Say why the linear path ignores new_W_dt_cutoff (#4527) - Carry the QNDF2 difference array across steps (#4526) - Pass Θ = 0, not the absolute time, to the AN5 startup interpolant (#4534) - Make the stabilized-RK step cap and eigenvalue tolerance direction-agnostic (#4536) Agent-Harness: Claude Code Agent-Model: claude-opus-5[1m] Claude-Session: https://claude.ai/code/session_014FEzNTLFutCmTEAZ3zBg5R Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
This was referenced Oct 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ignore until reviewed by @ChrisRackauckas. Draft.
What changed and why
AN5seeds its Nordsieck vector in one shot from aTsit5step, reading the higher derivatives out of the Tsit5 interpolant:ode_interpolant's first argument is the normalised parameterΘ ∈ [0, 1], not a time. The startup passed the absolute timet. The vector is assembled at the start of the step (z[1] = uprev,z[2] = k[1] * dt), so the correct value isΘ = 0. Six call sites, three in the out-of-place path and three in the in-place one.Every standard test problem starts at
t = 0, wherethappens to equal the right answer — which is why this has been invisible.Consequences away from the origin
AN5is not time-translation invariant. For an autonomous ODE, where the interval sits on the time axis cannot matter, butu' = 1.01uon(0, 1)and on(100, 101)take different numbers of steps and land on different answers.AN5is not reversible in time. On a tspan symmetric about zero, against the mirrored problemg(u,p,t) = -f(u,p,-t), it diverged from the forward solve at step 2 with a relative difference of 8e-5, because Θ = −0.5 one way and +0.5 the other.Verification
New
lib/OrdinaryDiffEqNordsieck/test/an5_startup_tests.jl, registered inruntests.jl, with a translation-invariance testset and a reversal testset (the latter asserts bitwise|dt|equality — on a symmetric tspan the mirror is exact in IEEE arithmetic and round-to-nearest is sign-symmetric).Failing on master (
git stash push -- lib/OrdinaryDiffEqNordsieck/src/nordsieck_perform_step.jl) — all six assertions:Passing with the fix:
Full package suite on this branch (Julia 1.10.11): every functional testset passes, including the existing convergence tests that pin AN5's order at 5 —
Two failures remain, both pre-existing
AllocCheckfailures in JVODEperform_step!, which this diff does not touch:What I did not verify
zero(t)versusone(t)is the intended seeding point from the original derivation. I chosezero(t)becausez[1]/z[2]are the state and scaled derivative atuprev/k[1], and because it is the choice that makes the existing order-5 convergence tests pass —one(t)restores reversal symmetry (any constant does) but breaks those convergence tests, which is how I settled it.pre.Worth pushing back on
JVODE_Adams/JVODE_BDFalso fail time-reversal, but for an unrelated reason (thedtminfloor inOrdinaryDiffEqCore.fix_dt_at_bounds!, see the companion PR); they are not covered here.JVODE_BDFreturnsUnstableonu' = 1.01uover(-0.5, 0.5), aborting atdtbelow floating-point epsilon. That looks like a real defect in JVODE but is out of scope for this diff.🤖 Generated with Claude Code (model: claude-opus-5[1m], harness: Claude Code 2.1.269)
https://claude.ai/code/session_01JQATpLKMyYX3VbPPX8qdeE