root-finding (quartic polynomial)

75 views
Skip to first unread message

Sebastien Binet

unread,
Nov 26, 2020, 11:48:31 AM11/26/20
to gonum-dev
hi there,

I know it's quite an old discussion[1], but what's the current status for root-finding algorithms?

my favorite Go-HEP user might have a need for quartic polynomials roots finding, something along the lines of GSL's gsl_poly_complex_solve_quartic[2,3].
(I haven't dug through the bibliography)

do we have a vague plan for these?

thanks,
-s

[1]: https://groups.google.com/g/gonum-dev/c/F70xPKOQJs8
[2]: http://linux.math.tifr.res.in/manuals/html/gsl-ref-html/gsl-ref_6.html
[3]: https://www.sciencedirect.com/science/article/pii/S0377042710002128

Sebastien Binet

unread,
Dec 1, 2020, 4:20:50 AM12/1/20
to gonum-dev, bloggi...@gmail.com, nicolas...@gmail.com, Brendan Tracey, david.n...@gmail.com
hi,

(+cc authors of the other root-finding thread[1], to get a bit more feedback)

as a possible first iteration, let me propose the following.
let's leave the general roots finding API (Bisection, Newton, Brent, ...) for later.
I am only interested (for now) in polynomial of degree n<=4.

package roots // import "gonum.org/v1/gonum/roots"

// Poly2 returns the roots of the following 2nd degree polynomial:
// a x^2 + b x + c = 0
func Poly2(a, b, c float64) (r1, r2 float64) { ... }

// Poly3 returns the roots of the following 3rd degree polynomial:
// a x^3 + b x^2 + c x + d = 0
func Poly3(a, b, c, d float64) (z1, z2, z3 complex128) { ... }

// Poly4 returns the roots of the following 4th degree polynomial:
// a x^4 + b x^3 + c x^2 + d x + e = 0
func Poly4(a, b, c, d, e float64) (z1, z2, z3, z4 complex128) { ... }

the PolyN find the roots analytically (ie: sans using the companion matrix).

alternatively (or in addition), we could have the following catch all function:
func Polynomial(dst []complex128, ps []float64) []complex128 { ...}

that would deal with all cases (using the companion matrix for n>4).

or, just have the single "Polynomial" function to deal with all cases:
o := roots.Polynomial(nil, []float64{1,2,3,4})
the PolyN won't incur any slice allocation (neither on the user nor internally).

WDYT ?

-s

[1]: https://groups.google.com/g/gonum-dev/c/F70xPKOQJs8

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

Sebastien Binet

unread,
Dec 1, 2020, 1:48:45 PM12/1/20
to Sebastien Binet, gonum-dev, bloggi...@gmail.com, nicolas...@gmail.com, Brendan Tracey, david.n...@gmail.com
I've (temporarily?) filed the roots package under go-hep.org/x/exp/roots:

- https://github.com/go-hep/exp/pull/15

(I'd sent it over to Gonum if agreement is reached at some point)

-s

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

On Tuesday, December 1st, 2020 at 10:20 AM, Sebastien Binet <s...@sbinet.org> wrote:

> hi,
>
> (+cc authors of the other root-finding thread1, to get a bit more feedback)
> > I know it's quite an old discussion1, but what's the current status for root-finding algorithms?
> >
> > my favorite Go-HEP user might have a need for quartic polynomials roots finding, something along the lines of GSL's gsl_poly_complex_solve_quartic[2,3].
> >
> > (I haven't dug through the bibliography)
> >
> > do we have a vague plan for these?
> >
> > thanks,
> >
> > -s
>
> You received this message because you are subscribed to the Google Groups "gonum-dev" group.
>
> To unsubscribe from this group and stop receiving emails from it, send an email to gonum-dev+...@googlegroups.com.
>
> To view this discussion on the web visit https://groups.google.com/d/msgid/gonum-dev/xKg-pgekmobD8t4_3fPMce3qH95VYoijz_keQCEVLFgw1uXeR_TlL8gnPEnLDBBBAGbDMbOM-LWvHLMk1N2_rK38LMtna6HHUkA7A5UJ9bI%3D%40sbinet.org.
Reply all
Reply to author
Forward
0 new messages