Skip to content

Fix RungeKutta4 stage times (#216) - #217

Open
atong01 wants to merge 1 commit into
DiffEqML:masterfrom
atong01:fix-rk4-stage-times
Open

atong01 wants to merge 1 commit into
DiffEqML:masterfrom
atong01:fix-rk4-stage-times

Conversation

@atong01

@atong01 atong01 commented Dec 1, 2026

Copy link
Copy Markdown
Member

Fixes #216. Thanks @rcgiri-physics for catching this!

construct_rk4 included a leading 0. in c = [0., 1/2, 1/2, 1], unlike construct_dopri5 and construct_tsit5. Because RungeKutta4.step indexes c[0], c[1], c[2] for stages 2-4, stages were being evaluated at t, t + dt/2, t + dt/2 instead of t + dt/2, t + dt/2, t + dt, dropping RK4 to first order on time-dependent ODEs.

This removes the leading 0. from construct_rk4 and adds a non-autonomous RK4 test.

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.

RungeKutta4 evaluates its stages at the wrong times (c has a leading 0 that step() does not expect)

1 participant