# naginterfaces.library.roots.contfn_​interval_​rcomm¶

naginterfaces.library.roots.contfn_interval_rcomm(x, fx, h, boundl, boundu, y, comm, ind)[source]

contfn_interval_rcomm attempts to locate an interval containing a simple zero of a continuous function using a binary search. It uses reverse communication for evaluating the function.

For full information please refer to the NAG Library document for c05av

https://www.nag.com/numeric/nl/nagdoc_29/flhtml/c05/c05avf.html

Parameters
xfloat

On initial entry: the best available approximation to the zero.

fxfloat

On initial entry: if , need not be set.

If , must contain for the initial value of .

On intermediate entry: must contain for the current value of .

hfloat

On initial entry: a basic step size which is used in the binary search for an interval containing a zero. The basic step sizes , and are used in turn when searching for the zero.

boundlfloat

The lower bound for the interval of search for the zero.

boundufloat

The upper bound for the interval of search for the zero.

yfloat

On initial entry: need not be set.

commdict, communication object, modified in place

Communication structure.

On initial entry: need not be set.

indint

On initial entry: must be set to or .

need not be set.

must contain .

Returns
xfloat

On intermediate exit: contains the point at which must be evaluated before re-entry to the function.

On final exit: contains one end of an interval containing the zero, the other end being in , unless an error has occurred. If = 4, and are the end points of the largest interval searched. If a zero is located exactly, its value is returned in (and in ).

hfloat

On final exit: is undefined.

yfloat

On final exit: contains the closest point found to the final value of , such that . If a value is found such that , . On final exit with = 4, and are the end points of the largest interval searched.

c1float

On final exit: if the function exits successfully or = 4, is set to .

indint

On intermediate exit: contains or . The calling program must evaluate at , storing the result in , and re-enter contfn_interval_rcomm with all other arguments unchanged.

On final exit: contains .

Raises
NagValueError
(errno )

On entry, and .

Constraint: .

(errno )

On entry, , and .

Constraint: .

(errno )

On entry, , , and .

Constraint: either or must lie inside the closed interval .

(errno )

On entry, and .

Constraint: must be sufficiently large that on the computer.

(errno )

On entry, .

Constraint: , , or .

Warns
NagAlgorithmicWarning
(errno )

An interval containing the zero could not be found. Try restarting with modified and .

Notes

You must supply an initial point and a step . contfn_interval_rcomm attempts to locate a short interval containing a simple zero of .

(On exit we may have ; is determined as the first point encountered in a binary search where the sign of differs from the sign of at the initial input point .) The function attempts to locate a zero of using , , and in turn as its basic step before quitting with an error exit if unsuccessful.

contfn_interval_rcomm returns to the calling program for each evaluation of . On each return you should set and call contfn_interval_rcomm again.