-
-
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
Add example for Rosenbrock function #9326
Conversation
scipy/optimize/optimize.py
Outdated
|
||
Examples | ||
-------- | ||
>>> import numpy as np |
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.
numpy is implicitly loaded for examples so you can remove it.
scipy/optimize/optimize.py
Outdated
Now, We calculate the value of Rosenbrock function: | ||
|
||
>>> y = rosen(X) | ||
>>> y |
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.
The doctest actually checks the output of the function hence you have to provide the result. But random vector will keep changing its results. It's better to fix X
and typeout the result explicitly
>>> from scipy.optimize import rosen
>>> X = 0.1 * np.arange(10)
>>> rosen(X)
76.56
I've cleaned up since the example is clear enough. Thanks @souravsingh merging |
Fixes a part of #7168 by adding example for Rosenbrock function.