-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: integrate: Handle y0=[] in odeint. #13278
Conversation
7895e2d
to
13d4165
Compare
if nm1 == 0: | ||
info['message'] = 'Nothing was done; the integration time was 0.' | ||
else: | ||
info['message'] = 'Integration successful.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't nothing done even in this case? "Integration successful." doesn't sound appropriate to me when there is nothing to integrate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm preserving the invariants where len(t) == 1
gives the message 'Nothing was done...'
and len(t) > 1
gives the message 'Integration successful.'
. I don't think even this distinction is useful, and I'd be happy to always give a simple "success" message in any case that is not an error, but I'm copying the current behavior for the sake of consistency.
'imxer': -1, | ||
'lenrw': 0, | ||
'leniw': 0, | ||
'mused': np.zeros(nm1, dtype=np.int32), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is a mused
value of zero documented? (I see only 1 is adams, 2 is bdf.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to return an array with the expected shape and dtype for the given length of t
, but I didn't think it was meaningful to use the values 1 or 2, since neither method was actually used.
All these arrays of zeros are just placeholders put there for consistency. An alternative approach that is probably justifiable is to put the value None
instead of an array. The arrays provide information about the behavior of the solver, and since a solver never ran in this edge case, maybe we shouldn't provide these arrays at all.
I've marked this PR as "draft". While looking into gh-13276, I discovered gh-13281. We can probably fix both of these at the same time, but it might require tweaking what we put in the |
OK. Shall we table this until February, then? |
Well, for a while, anyway. :) This isn't quite as quick a fix as I had hoped, and there's a lot of higher priority |
I'm closing this draft PR. I'll submit a new pull request with a slightly modified version of the fix proposed here. |
Closes gh-13276.