naginterfaces.library.roots.contfn_cntin¶
- naginterfaces.library.roots.contfn_cntin(x, f, eps=1.1102230246251565e-13, eta=0.0, nfmax=1000, data=None)[source]¶
contfn_cntin
attempts to locate a zero of a continuous function using a continuation method based on a secant iteration.For full information please refer to the NAG Library document for c05aw
https://support.nag.com/numeric/nl/nagdoc_30.2/flhtml/c05/c05awf.html
- Parameters
- xfloat
An initial approximation to the zero.
- fcallable retval = f(x, data=None)
must evaluate the function whose zero is to be determined.
- Parameters
- xfloat
The point at which the function must be evaluated.
- dataarbitrary, optional, modifiable in place
User-communication data for callback functions.
- Returns
- retvalfloat
The value of evaluated at .
- epsfloat, optional
An absolute tolerance to control the accuracy to which the zero is determined. In general, the smaller the value of the more accurate will be as an approximation to . Indeed, for very small positive values of , it is likely that the final approximation will satisfy . You are advised to call the function with more than one value for to check the accuracy obtained.
- etafloat, optional
A value such that if , is accepted as the zero. may be specified as (see Accuracy).
- nfmaxint, optional
The maximum permitted number of calls to from
contfn_cntin
. If is inexpensive to evaluate, should be given a large value (say ).- dataarbitrary, optional
User-communication data for callback functions.
- Returns
- xfloat
The final approximation to the zero, unless = 1 or 2, in which case it contains no useful information.
- Raises
- NagValueError
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
Internal scale factor invalid for this problem. Consider using
contfn_cntin_rcomm()
instead and setting .- (errno )
Either has no zero near or too much accuracy has been requested. Check the coding of or increase .
- (errno )
More than calls have been made to .
- Notes
contfn_cntin
attempts to obtain an approximation to a simple zero of the function given an initial approximation to . The zero is found by a call tocontfn_cntin_rcomm()
whose specification should be consulted for details of the method used.The approximation to the zero is determined so that at least one of the following criteria is satisfied:
,
.