Skip to content

Instantly share code, notes, and snippets.

View paulobuchsbaum's full-sized avatar

Paulo Buchsbaum paulobuchsbaum

View GitHub Profile
@ryanspradlin
ryanspradlin / brent.js
Last active March 20, 2024 06:48
Javascript implementation of Brent's Method, a root-finding algorithm
/* @flow */
// Derived from: https://en.wikipedia.org/wiki/Brent%27s_method#Algorithm
// Brent's method is a hybrid root-finding algorithm that combines the
// faster/less-reliable inverse quadradic interpolation and secant methods with
// the slower/more-reliable bisection method.
export function brent(
f: (x: number) => number,
lowerBound: number,