`); SciPySciPy Installing User Guide API reference Building from source Development Release notes GitHubGitHub TwitterTwitter Installing User Guide API reference Building from source Development Release notes GitHubGitHub TwitterTwitterSection Navigationscipyscipy.clusterscipy.constantsscipy.datasetsscipy.differentiatescipy.fftscipy.fftpackscipy.integratescipy.interpolatescipy.ioscipy.linalgscipy.ndimagescipy.odrscipy.optimizescipy.signalscipy.sparsescipy.spatialscipy.specialscipy..." />`); SciPySciPy Installing User Guide API reference Building from source Development Release notes GitHubGitHub TwitterTwitter Installing User Guide API reference Building from source Development Release notes GitHubGitHub TwitterTwitterSection Navigationscipyscipy.clusterscipy.constantsscipy.datasetsscipy.differentiatescipy.fftscipy.fftpackscipy.integratescipy.interpolatescipy.ioscipy.linalgscipy.ndimagescipy.odrscipy.optimizescipy.signalscipy.sparsescipy.spatialscipy.specialscipy..." /> residual — SciPy v1.15.3 Manual
scipy.optimize.Bounds.

residual#

Bounds.residual(x)[source]#

Calculate the residual (slack) between the input and the bounds

For a bound constraint of the form:

lb <= x <= ub

the lower and upper residuals between x and the bounds are values sl and sb such that:

lb + sl == x == ub - sb

When all elements of sl and sb are positive, all elements of x lie within the bounds; a negative element in sl or sb indicates that the corresponding element of x is out of bounds.

Parameters:
x: array_like

Vector of independent variables

Returns:
sl, sbarray-like

The lower and upper residuals