jaxrts.helpers.bisection

jaxrts.helpers.bisection(func, a, b, tolerance=0.0001, max_iter: int = 10000.0, min_iter: int = 100.0)[source]

Find the root of a function func between the points a and b by bisection.

This is a simple implementation, without any checks guaranteeing that the root is found.

Parameters:
  • func – The function of which a root should be found.

  • a – Lower end of the interval within which the root should be searched.

  • b – Upper limit of the interval within which the root should be searched.

  • tolerance – Tolerance that sets the condition to stop the iterative search. Applies to both the absolute value of the function, and the absolute distance between two consecutive candidates.

  • max_iter (int) – Maximal number of steps before the loop aborts.

  • min_iter (int) – Minimal number of steps the algorithm has to run before a value is returned.

Returns:

One of the function func.