I can't speak to canon (the intersection of Gophers and numerical people is already the intersection of two small niches...so there's not a whole lotta canon), but Brent's method is standard stuff straight out of Numerical Recipes, Section 9.3, page 352
https://s3.amazonaws.com/nrbook.com/book_F210.html ( I see this is cited by the cpmech/gosl library you referenced.) Anyway -- it's a very short method and you can probably have an LLM give you Go implementation or port in 20 seconds. Ask your LLM to write you some tests too and you should be good to go in another couple of minutes. On Tuesday, March 4, 2025 at 3:11:06 PM UTC awaw...@gmail.com wrote: > Hi Fellow Gophers > > I wonder what is the canonical Go library for finding roots of > single-valued real functions? > > In particular, I am finding an implementation of Brent's method > <https://en.wikipedia.org/wiki/Brent's_method>. > Brent's method is the default algorithm in R, Matlab, and Scipy > <https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.root_scalar.html#scipy.optimize.root_scalar> > . > > Gonum has a pretty comprehensive list of facilities for optimization > <https://pkg.go.dev/gonum.org/v1/gonum@v0.15.1/optimize>, but I couldn't > find one that does simple root finding. > There seem to be two packages out there that implement Brent's method, but > they are of dubious provenance: > * https://pkg.go.dev/github.com/cpmech/gosl/num#Brent . Relies on the > derivative of f, f'(x), which shouldn't be the case for Brent's method. > Plus, it pulls in a deluge of dependencies, and is not in pure Go. > * https://pkg.go.dev/go.skia.org/infra/pinpoint/go/compare/stats . The > zeroin function is not even exported, so presumably of unknown quality. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/golang-nuts/06ebf857-8b3a-4bea-a13e-98412d7e52abn%40googlegroups.com.