fix: pass atol (not rtol) to parent in AdamsBashforthMoulton.__init__#280
Open
haoyu-haoyu wants to merge 1 commit intortqichen:masterfrom
Open
fix: pass atol (not rtol) to parent in AdamsBashforthMoulton.__init__#280haoyu-haoyu wants to merge 1 commit intortqichen:masterfrom
haoyu-haoyu wants to merge 1 commit intortqichen:masterfrom
Conversation
Line 169 passes atol=rtol to the parent constructor instead of atol=atol. This is a copy-paste typo that causes the user-provided atol parameter to be silently ignored — the absolute tolerance is always set to the same value as rtol in the parent class. While self.atol is correctly set from the atol parameter at line 175, the parent FixedGridODESolver.__init__ receives the wrong value, which affects any tolerance checks performed by the parent class.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
AdamsBashforthMoulton.__init__(line 169 offixed_adams.py) passesatol=rtolto the parent constructor instead ofatol=atol:This is a copy-paste typo. The user-provided
atolparameter is silently ignored in the parent class — the absolute tolerance is always set to the same value asrtol.Impact
Any user calling
odeint(func, y0, t, method='adams', atol=1e-6)with a customatolwould not get the requested tolerance behavior. The parent class would usertolfor both relative and absolute tolerance, potentially producing less accurate (or unnecessarily slow) solutions.Fix
One character:
rtol→atolon line 169.