scipy 1.8.0 Pypi GitHub Homepage
Other Docs
ParametersReturns
_adjust_scheme_to_bounds(x0, h, num_steps, scheme, lb, ub)

Parameters

x0 : ndarray, shape (n,)

Point at which we wish to estimate derivative.

h : ndarray, shape (n,)

Desired absolute finite difference steps.

num_steps : int

Number of h steps in one direction required to implement finite difference scheme. For example, 2 means that we need to evaluate f(x0 + 2 * h) or f(x0 - 2 * h)

scheme : {'1-sided', '2-sided'}

Whether steps in one or both directions are required. In other words '1-sided' applies to forward and backward schemes, '2-sided' applies to center schemes.

lb : ndarray, shape (n,)

Lower bounds on independent variables.

ub : ndarray, shape (n,)

Upper bounds on independent variables.

Returns

h_adjusted : ndarray, shape (n,)

Adjusted absolute step sizes. Step size decreases only if a sign flip or switching to one-sided scheme doesn't allow to take a full step.

use_one_sided : ndarray of bool, shape (n,)

Whether to switch to one-sided scheme. Informative only for scheme='2-sided' .

Adjust final difference scheme to the presence of bounds.

Examples

See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /scipy/optimize/_numdiff.py#11
type: <class 'function'>
Commit: