Skip to content

Carry the QNDF2 difference array across steps - #4455

Closed
singhharsh1708 wants to merge 1 commit into
SciML:masterfrom
singhharsh1708:qndf2-difference-array
Closed

singhharsh1708 wants to merge 1 commit into
SciML:masterfrom
singhharsh1708:qndf2-difference-array

Conversation

@singhharsh1708

@singhharsh1708 singhharsh1708 commented Sep 1, 2026 •

Copy link
Copy Markdown
Member

QNDF2 rebuilt its backward differences from uprev, uprev2 and uprev3 on every step and corrected a change of step size with a first-order scaling, so an O(h^2) error sat inside a quantity whose signal is O(h^3) and the local error estimate tracked dt/dtₙ₋₁ instead of the error. There was no step size at which the estimate settled near 1, so the controller alternated between growing by the maximum factor and rejecting.

D now stays at the step size its differences were formed with, a step that changes dt scales them through the exact R * U transform into locals, and a successful step commits the new differences incrementally, which is what variable-order QNDF already does. Reading D and writing locals also removes the aliasing in D[2] = D[1] * R[1, 2] + D[2] * R[2, 2], which used the D[1] assigned on the line above; that was inert because (R * U)[1, 2] is zero for k = 2.

On u' = -u at 1e-8, QNDF2 goes from 4211 accepted and 6427 rejected to 765 and 2. On the issue's stiff 2x2 at 1e-8, QBDF2 goes from 5491 and 10456 to 923 and 23. On Robertson at 1e-8, QNDF2 goes from 5874 and 6115 to 1505 and 11, and the mass matrix form from 6214 and 11144 to 1504 and 9. Fixed-step convergence is unchanged at 1.88, 2.00, 2.01, 2.01.

The regression test asserts QNDF2 and QBDF2 reject fewer than a tenth of the steps they accept on u' = -u at 1e-8; on master they reject more than they accept.

This still reproduced on master after #4328, which was suggested as the fix on the issue. Fixes #4332.

AI Disclosure: Claude assisted with this change.

@ChrisRackauckas

Copy link
Copy Markdown
Member

Supersceded and merged.

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.

QNDF2 and QBDF2 reject many more steps than expected

2 participants