Skip to content

Pass Θ = 0, not the absolute time, to the AN5 startup interpolant - #4534

Merged
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:nordsieck-an5-startup-theta
Sep 12, 2026
Merged

ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:nordsieck-an5-startup-theta

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

Ignore until reviewed by @ChrisRackauckas. Draft.

What changed and why

AN5 seeds its Nordsieck vector in one shot from a Tsit5 step, reading the higher derivatives out of the Tsit5 interpolant:

         z[3] = ode_interpolant(
-            t, dt, nothing, nothing, integrator.k, tsit5tab, nothing,
+            zero(t), dt, nothing, nothing, integrator.k, tsit5tab, nothing,
             Val{2}, differential_vars
         ) * dt^2 / 2

ode_interpolant's first argument is the normalised parameter Θ ∈ [0, 1], not a time. The startup passed the absolute time 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. 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, where t happens to equal the right answer — which is why this has been invisible.

Consequences away from the origin

  1. AN5 is not time-translation invariant. For an autonomous ODE, where the interval sits on the time axis cannot matter, but u' = 1.01u on (0, 1) and on (100, 101) take different numbers of steps and land on different answers.
  2. AN5 is not reversible in time. On a tspan symmetric about zero, against the mirrored problem g(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 in runtests.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:

Test Summary:                 | Fail  Total  Time
AN5 startup                   |    6      6  9.9s
  time-translation invariance |    4      4  7.6s
  time-reversal symmetry      |    2      2  2.3s
    oop                       |    1      1  1.9s
    iip                       |    1      1  0.3s

Passing with the fix:

Test Summary: | Pass  Total  Time
AN5 startup   |    6      6  8.6s

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 —

Test Summary:                       | Pass  Total   Time
Nordsieck Tests                     |   24     24  29.9s

Two failures remain, both pre-existing AllocCheck failures in JVODE perform_step!, which this diff does not touch:

Some tests did not pass: 0 passed, 2 failed, 0 errored, 1 broken.
  OrdinaryDiffEqNordsieck.JVODE{...} perform_step! allocation check

What I did not verify

  • Whether zero(t) versus one(t) is the intended seeding point from the original derivation. I chose zero(t) because z[1]/z[2] are the state and scaled derivative at uprev/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.
  • GPU and Downstream groups, Julia pre.

Worth pushing back on

  • JVODE_Adams/JVODE_BDF also fail time-reversal, but for an unrelated reason (the dtmin floor in OrdinaryDiffEqCore.fix_dt_at_bounds!, see the companion PR); they are not covered here.
  • Separately and not addressed: JVODE_BDF returns Unstable on u' = 1.01u over (-0.5, 0.5), aborting at dt below 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

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
ChrisRackauckas marked this pull request as ready for review September 12, 2026 19:32
@ChrisRackauckas
ChrisRackauckas merged commit 33b43a7 into SciML:master Sep 12, 2026
128 of 133 checks passed
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants