AutoMovie API
    Preparing search index...

    Function bracketedBisection

    • The boundary of a yes-or-no condition between two arguments, the condition holding at one and not at the other, by bisection.

      Each step reads the condition at the bracket's midpoint and keeps the half whose ends still disagree, so the bracket halves on every step and the boundary never leaves it. Where the condition is the sign of a continuous function, bracketedRoot finds the crossing in fewer evaluations; this is for a condition that has no value to interpolate, or whose value jumps (one shape left as another is met), where a chord would misread it. The ends are the caller's to have read: neither is evaluated here.

      Parameters

      • holds: (x: number) => boolean

        The condition.

      • low: number

        The end where the condition holds; it may lie either side of high.

      • high: number

        The end where it does not.

      • tolerance: number

        The bracket width at which the search stops, in the argument's unit; positive. A tolerance finer than the spacing of doubles at the boundary stops at two adjacent doubles instead, the finest bracket the arithmetic holds.

      Returns number

      The end of the final bracket where the condition does not hold, within tolerance of the boundary, or one double from it when the tolerance is finer than that; high itself when the bracket is already no wider than tolerance.

      If an end is not finite or the tolerance is not positive and finite.