Skip to main content

Function: binarySearch()

binarySearch(fn, target, lowerBound, upperBound, tolerance): number

Defined in: src/utils/simpleFunctions.ts:11

Numerical binary search for the input to fn, between lowerBound and upperBound, whose output is target to within tolerance (ManimCE binary_search). Returns undefined if no such input exists in the bounds.

Parameters​

fn​

(x) => number

target​

number

lowerBound​

number

upperBound​

number

tolerance​

number = 1e-4

Returns​

number