|  View source on GitHub | 
Finds root(s) of a scalar function using Chandrupatla's method.
tfp.math.find_root_chandrupatla(
    objective_fn,
    low=None,
    high=None,
    position_tolerance=1e-08,
    value_tolerance=0.0,
    max_iterations=50,
    stopping_policy_fn=tf.reduce_all,
    validate_args=False,
    name='find_root_chandrupatla'
)
Chandrupatla's method [1, 2] is a root-finding algorithm that is guaranteed to converge if a root lies within the given bounds. It generalizes the bisection method; at each step it chooses to perform either bisection or inverse quadratic interpolation. This makes it similar in spirit to Brent's method, which also considers steps that use the secant method, but Chandrupatla's method is simpler and often converges at least as quickly [3].
| Args | |
|---|---|
| objective_fn | Python callable for which roots are searched. It must be a
callable of a single variable. objective_fnmust return aTensorwith
shapebatch_shapeand dtype matchinglower_boundandupper_bound. | 
| low | Float Tensorof shapebatch_shaperepresenting a lower
bound(s) on the value of a root(s). If either ofloworhighis not
provided, both are ignored andtfp.math.bracket_rootis used to attempt
to infer bounds.
Default value:None. | 
| high | Float Tensorof shapebatch_shaperepresenting an upper
bound(s) on the value of a root(s). If either ofloworhighis not
provided, both are ignored andtfp.math.bracket_rootis used to attempt
to infer bounds.
Default value:None. | 
| position_tolerance | Optional Tensorrepresenting the maximum absolute
error in the positions of the estimated roots. Shape must broadcast withbatch_shape.
Default value:1e-8. | 
| value_tolerance | Optional Tensorrepresenting the absolute error allowed
in the value of the objective function. If the absolute value ofobjective_fnis smaller thanvalue_toleranceat a given position, then that position is considered a
root for the function. Shape must broadcast withbatch_shape.
Default value:1e-8. | 
| max_iterations | Optional Tensoror Python integer specifying the maximum
number of steps to perform. Shape must broadcast withbatch_shape.
Default value:50. | 
| stopping_policy_fn | Python callablecontrolling the algorithm termination.
It must be a callable accepting aTensorof booleans with the same shape
aslower_boundandupper_bound(denoting whether each search is
finished), and returning a scalar booleanTensorindicating
whether the overall search should stop. Typical values aretf.reduce_all(which returns only when the search is finished for all
points), andtf.reduce_any(which returns as soon as the search is
finished for any point).
Default value:tf.reduce_all(returns only when the search is finished
  for all points). | 
| validate_args | Python boolindicating whether to validate arguments.
Default value:False. | 
| name | Python strname prefixed to ops created by this function.
Default value: 'find_root_chandrupatla'. | 
References
[1] Tirupathi R. Chandrupatla. A new hybrid quadratic/bisection algorithm for finding the zero of a nonlinear function without using derivatives. Advances in Engineering Software, 28.3:145-149, 1997. [2] Philipp OJ Scherer. Computational Physics. Springer Berlin, Heidelberg, 2010. Section 6.1.7.3 https://books.google.com/books?id=cC-8BAAAQBAJ&pg=PA95 [3] Jason Sachs. Ten Little Algorithms, Part 5: Quadratic Extremum Interpolation and Chandrupatla's Method (2015). https://www.embeddedrelated.com/showarticle/855.php