Skip to content

Clarify ConstantStepSize finite-interval step semantics - #764

Open
Whning0513 wants to merge 2 commits into
patrick-kidger:mainfrom
Whning0513:clarify-constant-stepsize-docs-757
Open

Clarify ConstantStepSize finite-interval step semantics#764
Whning0513 wants to merge 2 commits into
patrick-kidger:mainfrom
Whning0513:clarify-constant-stepsize-docs-757

Conversation

@Whning0513

Copy link
Copy Markdown

Fixes #757.

This updates the finite-interval documentation for ConstantStepSize and diffeqsolve(dt0=...) to match the current implementation:

  • dt0 determines the number of fixed steps via ceil((t1 - t0) / dt0)
  • the remaining fixed steps are rescaled so the solve lands exactly on t1

It also adds a regression test that locks in the current step locations for a representative finite-interval solve, plus a docstring test for the clarified wording.

Tested with:

  • uv run python -m pytest -q test/test_saveat_solution.py

Copilot AI review requested due to automatic review settings July 1, 2026 09:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses #757 by aligning Diffrax’s documentation with the current ConstantStepSize behavior on finite intervals, and adds tests to lock in both the observed step locations and the clarified wording.

Changes:

  • Updates ConstantStepSize and diffeqsolve(dt0=...) documentation to describe finite-interval step placement that lands exactly on t1.
  • Updates the getting-started guide to describe ConstantStepSize as fixed-step behavior on finite intervals.
  • Adds a regression test asserting the step timestamps for a representative finite-interval ConstantStepSize solve, plus a docstring-content test.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
test/test_saveat_solution.py Adds a regression test for finite-interval step locations and a docstring wording test.
docs/usage/getting-started.md Adjusts tutorial wording to describe finite-interval fixed-step semantics.
diffrax/_step_size_controller/constant.py Updates ConstantStepSize docstring to describe finite-interval behavior.
diffrax/_integrate.py Updates diffeqsolve’s dt0 docstring text to match finite-interval fixed-step behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread diffrax/_step_size_controller/constant.py
Comment thread diffrax/_integrate.py Outdated
Comment thread docs/usage/getting-started.md Outdated
Comment thread test/test_saveat_solution.py
@Whning0513

Copy link
Copy Markdown
Author

Addressed the four review comments in aad4faa. The API docstrings now give the exact target formula, the getting-started guide calls out the special first step, and the regression test computes num_steps with the controller formula instead of hard-coding 11. The two focused tests pass; prek also passes mixed-line-ending, ruff-format, ruff, and pyright checks on the four changed files

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.

Documentation and implementation of ConstantStepSize do not quite align

2 participants