WIP/ENH: optimize.minimize_scalar: add method 'chandrupatla'? #20624
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.
Reference issue
gh-18829
What does this implement/fix?
This investigates what it would look like to add
method='chandrupatla'
, an elementwise scalar minimizer slated for array API support, tominimize_scalar
. I haven't updated all the documentation, because I'm not sure this is what we want to do.Additional information
The nice thing is that it could work. The downsides include:
bounded
acceptsbounds
but notbracket
, and the other methods acceptbracket
but notbounds
. I don't want to shove another method into this function if it's already cramming two interfaces into one function.brent
andgolden
don't require a three-point bracket, but I thinkchandrupatla
should. It could attempt to find a bracket automatically, but I've seen a lot of confusion about brackets in the past (e.g. MAINT: optimize.bracket: don't fail silently #17704, DOC: optimize.minimize_scalar and friends: correct documentation about bracket #17705, and linked issues) and I think this could be resolved if we require users to find a bracket as a separate step. After all, we require them to find a two-point rootfinding bracket if they want to use a bracketing rootfinder. Also, if they can't find a bracket, they know they'll need to use a derivative-based rootfinder (e.g. viaminimize
, currently).disp
option. I'm not going to put that into a new function.chandrupatal
supports acallback
; the other methods don't.tol
is ambiguous.chandrupatla
accepts four separate tolerances.chandrupatla
does not provide amessage
attribute like the others because string messages are unweildy for an elementwise function. (It provides an integerstatus
, instead.)chandrupatla
works elementwise, and the others don't. Describing the differences would complicate the documentation a bit.Should we continue with this or create a new function? Based on #7242 (comment) it already looks like we'll need a new function for elementwise rootfinding, so maybe it makes sense to have a new elementwise minimizer, too.