Skip to main content
`Ctrl`+`K`
scipy.optimize.

# rosen_der

scipy.optimize.rosen_der(x)

  The derivative (i.e. gradient) of the Rosenbrock function.

  Parameters:
    xarray_like

      1-D array of points at which the derivative is to be computed.

  Returns:
    rosen_der(N,) ndarray

      The gradient of the Rosenbrock function at x.

  See also

  `rosen`, `rosen_hess`, `rosen_hess_prod`

  Notes

  `rosen_der` has experimental support for Python Array API Standard compatible backends in addition to NumPy. Please consider testing these features by setting an environment variable `SCIPY_ARRAY_API=1` and providing CuPy, PyTorch, JAX, or Dask arrays as array arguments. The following combinations of backend and device (or other capability) are supported.

  Library | CPU | GPU
  --- | --- | ---
  NumPy | ✅ | n/a
  CuPy | n/a | ✅
  PyTorch | ✅ | ✅
  JAX | ⛔ | ⛔
  Dask | ✅ | n/a

  See Support for the array API standard for more information.

  Examples

      >>> import numpy as np
      >>> from scipy.optimize import rosen_der
      >>> X = 0.1 * np.arange(9)
      >>> rosen_der(X)
      array([ -2. ,  10.6,  15.6,  13.4,   6.4,  -3. , -12.4, -19.4,  62. ])