scijit.optimize.RootResults

class scijit.optimize.RootResults(root, iterations, function_calls, converged, flag, method)

Bases: OptimizeResult, RootResults

Result of a scalar root find.

Returned by bisect, brentq, brenth, ridder, toms748, newton and root_scalar.

Attributes:
rootfloat

The estimated root.

iterationsint

Iterations taken.

function_callsint

Evaluations of f.

convergedbool

True when the routine met its tolerance.

flagstr

'converged' or 'convergence error'. See Notes.

methodstr

The routine that ran, by name.

Notes

The flag set is two strings, 'converged' and 'convergence error'. scipy.optimize.RootResults’s flag_map also holds 'sign error', 'value error' and 'No error', and its root_scalar puts an exception message there on the NaN path.

The CONTAINER is a namedtuple, where scipy.optimize.RootResults subclasses OptimizeResult and so is a dict. Attribute access reads the same on both. Three things do not, all measured on the same root:

isinstance(res, scipy.optimize.RootResults)     False
res[0]                                          the root here,
                                                KeyError: 0 in scipy
tuple(res)                                      the six values here,
                                                the six field NAMES in
                                                scipy, which is a dict
                                                iterating its keys

The third is silent, since both sides return a 6-tuple.

The CONSTRUCTOR differs too. This takes the six attributes above; scipy.optimize.RootResults takes five, (root, iterations, function_calls, flag, method), with flag an integer code, and derives converged and the flag string from it.

__init__(*args, **kwargs)

Methods

__init__(*args, **kwargs)

count(value, /)

Return number of occurrences of value.

get(key[, default])

index(value[, start, stop])

Return first index of value.

items()

keys()

values()

Attributes

converged

Alias for field number 3

flag

Alias for field number 4

function_calls

Alias for field number 2

iterations

Alias for field number 1

method

Alias for field number 5

root

Alias for field number 0