Skip to content

fix: pass atol (not rtol) to parent in AdamsBashforthMoulton.__init__#280

Open
haoyu-haoyu wants to merge 1 commit intortqichen:masterfrom
haoyu-haoyu:fix/adams-atol-parameter-typo
Open

fix: pass atol (not rtol) to parent in AdamsBashforthMoulton.__init__#280
haoyu-haoyu wants to merge 1 commit intortqichen:masterfrom
haoyu-haoyu:fix/adams-atol-parameter-typo

Conversation

@haoyu-haoyu
Copy link
Copy Markdown

Bug

AdamsBashforthMoulton.__init__ (line 169 of fixed_adams.py) passes atol=rtol to the parent constructor instead of atol=atol:

# Before (bug):
super(AdamsBashforthMoulton, self).__init__(func, y0, rtol=rtol, atol=rtol, **kwargs)

# After (fix):
super(AdamsBashforthMoulton, self).__init__(func, y0, rtol=rtol, atol=atol, **kwargs)

This is a copy-paste typo. The user-provided atol parameter is silently ignored in the parent class — the absolute tolerance is always set to the same value as rtol.

Impact

Any user calling odeint(func, y0, t, method='adams', atol=1e-6) with a custom atol would not get the requested tolerance behavior. The parent class would use rtol for both relative and absolute tolerance, potentially producing less accurate (or unnecessarily slow) solutions.

Fix

One character: rtolatol on line 169.

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.
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.

1 participant