pynbody.util.bisect

Contents

pynbody.util.bisect#

pynbody.util.bisect(left, right, f, epsilon=None, eta=0, verbose=False, niter_max=200)[source]#

Finds the value x such that f(x)=0 for a monotonically increasing function f, using a binary search.

The search stops when either the bounding domain is smaller than epsilon (by default 10^-7 times the original region) OR a value f(x) is found such that |f(x)|<eta (by default eta=0, so this criterion is never satisfied).