Skip to content

Use the analytic event Jacobian as the AD test oracle - #4100

Merged
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:agent/use-analytic-ad-event-reference
Aug 2, 2026
Merged

Use the analytic event Jacobian as the AD test oracle#4100
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:agent/use-analytic-ad-event-reference

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

Ignore this PR until it has been reviewed by @ChrisRackauckas.

Summary

  • replace the bouncing-ball event test's finite-difference Jacobian oracle with its exact one-bounce Jacobian
  • use the same analytic reference for Jacobian and gradient backends
  • leave every tolerance and the existing broken Enzyme assertion unchanged

This is a test-oracle correction; it does not change solver behavior.

Clean-master failure

The trajectory contains exactly one bounce. Perturbing the parameters for finite differences also perturbs the located root time, so the finite-difference reference carries enough event-time noise to fail the default comparison:

  • ForwardDiff differs from the analytic Jacobian by at most about 2.7e-9
  • the finite-difference oracle differs by about 7.5e-8

On untouched master a7080c6f6d, the full AD group passes its 28,299 general checks, then the event set ends with 3 passes, 2 failures, and 1 existing broken test. The failures are the ForwardDiff Jacobian and Enzyme gradient comparisons against that noisy finite-difference oracle.

Hosted history brackets the exposure after the last passing 275ed1e4 run and the shared-controller merge fd3f95bb99 (#3720); the test itself did not change across that boundary. The closed-form reference distinguishes a small numerical trajectory shift from an AD regression.

Analytic reference

For initial height h and restitution e, the impact speed is v = sqrt(2h). The final-state Jacobian used here is:

[(1 + e) / v - 1/2    v - 2
 (1 + e) / v - 1      v]

Local verification

At 05db644879, the exact full GROUP=AD julia +1.12 --project -e 'using Pkg; Pkg.test()' run passes:

  • AD tests: 28,299/28,299
  • autodiff event tests: 5 passes and the same 1 existing broken test
  • discrete adjoint: 1/1
  • Runic on the changed file: pass
  • git diff --check: pass

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review August 2, 2026 22:04
@ChrisRackauckas
ChrisRackauckas merged commit 9d780e1 into SciML:master Aug 2, 2026
119 of 127 checks passed
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