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

Add example for Rosenbrock function #9326

Merged
merged 4 commits into from
Oct 2, 2018
Merged

Add example for Rosenbrock function #9326

merged 4 commits into from
Oct 2, 2018

Conversation

souravsingh
Copy link
Contributor

Fixes a part of #7168 by adding example for Rosenbrock function.


Examples
--------
>>> import numpy as np
Copy link
Member

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.

Now, We calculate the value of Rosenbrock function:

>>> y = rosen(X)
>>> y
Copy link
Member

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

@ilayn ilayn added scipy.optimize Documentation Issues related to the SciPy documentation. Also check https://github.com/scipy/scipy.org labels Oct 1, 2018
@ilayn
Copy link
Member

ilayn commented Oct 2, 2018

I've cleaned up since the example is clear enough. Thanks @souravsingh merging

@ilayn ilayn merged commit 64f02cd into scipy:master Oct 2, 2018
@ilayn ilayn added this to the 1.2.0 milestone Nov 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Issues related to the SciPy documentation. Also check https://github.com/scipy/scipy.org scipy.optimize
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants