Skip to content
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

ENH: optimize.root_scalar: allow newton without f', secant without x1 #17691

Merged
merged 3 commits into from
Jan 16, 2023

Conversation

mdhaber
Copy link
Contributor

@mdhaber mdhaber commented Jan 1, 2023

Reference issue

Closes gh-17570

What does this implement/fix?

root_scalar does not allow method='newton' to be used without an analytical derivative even though scipy.optimize.root does, and it does not allow method='secant' to be used without an explicit x1 even though scipy.optimize.newton does. This PR removes root_scalar's restrictions on use of these methods and updates the defaults method resolution accordingly.

Additional information

I don't think there are any BC concerns because it is documented that
image

@mdhaber mdhaber added enhancement A new feature or improvement scipy.optimize labels Jan 1, 2023
@mdhaber mdhaber requested a review from andyfaff as a code owner January 1, 2023 00:50
@mdhaber
Copy link
Contributor Author

mdhaber commented Jan 2, 2023

No test failed (because of this PR) after the second commit, and the last commit made a minor tweak to the documentation, so I skipped CI.

Copy link
Member

@tupui tupui left a comment

Choose a reason for hiding this comment

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

LGTM, thanks Matt 👍

@andyfaff do you have comments?

I would merge in 2 weeks otherwise.

@tupui tupui added this to the 1.11.0 milestone Jan 3, 2023
@mdhaber
Copy link
Contributor Author

mdhaber commented Jan 15, 2023

@andyfaff looks like this might merge, but still let us know if there's an issue. There's plenty of time to change it before the next release.

@tupui
Copy link
Member

tupui commented Jan 15, 2023

Merging tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A new feature or improvement scipy.optimize
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ENH: optimize.root_scalar: default to newton when only x0 is provided
2 participants