Finance.Solver.Brent (finance v1.7.0)

Copy Markdown View Source

A Finance.Solver using Brent's method (zbrent): bracketing with a secant step, inverse-quadratic interpolation, and a bisection safeguard.

It uses no derivative, so each iteration costs a single net-present-value evaluation rather than the two (NPV and its derivative) the default Finance.Solver.Newton spends per Newton step. Results match the default to the requested :precision.

Because it skips the derivative, it tends to be faster on long-horizon flows — long amortization schedules or bond ladders, where each NPV evaluation is itself expensive. On short series the derivative-based default is quicker, so it stays the default; select Brent where it pays:

Finance.CashFlow.xirr(flows, solver: Finance.Solver.Brent)
config :finance, solver: Finance.Solver.Brent