Versions in this module Expand all Collapse all v0 v0.8.0 Jul 19, 2026 Changes in this version + const DefaultMaxIter + const DefaultRootTol + const DefaultTol + var ErrBadInput = errors.New("rootfind: invalid input") + var ErrDegreeTooLow = errors.New("rootfind: polynomial degree too low for this operation") + var ErrEmptyInterval = errors.New("rootfind: invalid or empty interval") + var ErrNoBracket = errors.New("rootfind: endpoints do not bracket a root") + var ErrNoConvergence = errors.New("rootfind: iteration did not converge") + var ErrZeroDerivative = errors.New("rootfind: derivative vanished during iteration") + var ErrZeroPolynomial = errors.New("rootfind: operation undefined for the zero polynomial") + func AberthEhrlich(c CPoly, tol float64, maxIter int) ([]complex128, int, error) + func AllRootsReal(p Poly, tol float64) bool + func AnnulusBounds(p Poly) (lo, hi float64) + func Bairstow(p Poly, u0, v0, tol float64, maxIter int) (u, v float64, iters int, err error) + func BairstowRoots(p Poly, tol float64, maxIter int) ([]complex128, error) + func BracketOutward(f Func, a, b, factor float64, maxIter int) (lo, hi float64, err error) + func BudanFourierCount(p Poly, a, b float64) int + func BudanFourierUpperBound(p Poly) int + func CPolyRoots(c CPoly) ([]complex128, error) + func CauchyBound(p Poly) float64 + func CoeffSignVariations(p Poly) int + func CompanionEigenvalues(p Poly) ([]complex128, error) + func CompanionMatrix(p Poly) ([][]float64, error) + func CountComplexRoots(c CPoly) int + func CountRealRoots(p Poly) int + func CountRealRootsInInterval(p Poly, a, b float64) int + func DescartesNegativeBound(p Poly) int + func DescartesPositiveBound(p Poly) int + func DescartesRuleOfSigns(p Poly) (positive, negative int) + func DiscriminantCubic(a, b, c, d float64) float64 + func DiscriminantQuadratic(a, b, c float64) float64 + func DistinctRealRoots(p Poly, tol float64) []float64 + func DurandKerner(c CPoly, tol float64, maxIter int) ([]complex128, int, error) + func DurandKernerWithInit(c CPoly, init []complex128, tol float64, maxIter int) ([]complex128, int, error) + func FindBrackets(f Func, a, b float64, n int) [][2]float64 + func FujiwaraBound(p Poly) float64 + func HalleyComplex(c CPoly, x0 complex128, tol float64, maxIter int) (complex128, int, error) + func Horner(coeffs []float64, x float64) float64 + func HornerComplex(coeffs []complex128, x complex128) complex128 + func IsolateRoots(p Poly) [][2]float64 + func IsolateRootsInterval(p Poly, a, b float64) [][2]float64 + func KojimaBound(p Poly) float64 + func LagrangeBound(p Poly) float64 + func Laguerre(c CPoly, x0 complex128, tol float64, maxIter int) (complex128, int, error) + func LaguerreRoots(c CPoly, tol float64, maxIter int) ([]complex128, error) + func LowerRootBound(p Poly) float64 + func MaxResidual(c CPoly, roots []complex128) float64 + func Multiplicity(p Poly, r, tol float64) int + func MultiplicityComplex(c CPoly, r complex128, tol float64) int + func NewtonComplex(c CPoly, x0 complex128, tol float64, maxIter int) (complex128, int, error) + func PolishComplexRoots(c CPoly, roots []complex128, tol float64, steps int) []complex128 + func PolyRoots(p Poly) ([]complex128, error) + func QuadraticRoots(a, b, c float64) (complex128, complex128) + func RealRootInterval(p Poly) (lo, hi float64) + func RealRoots(p Poly, imagTol float64) ([]float64, error) + func SeparateRoots(roots []complex128, imagTol float64) (reals []float64, complexes []complex128) + func SignChange(f Func, a, b float64) bool + func SignVariations(vals []float64) int + func SolveCubic(a, b, c, d float64) ([]complex128, error) + func SolveCubicReal(a, b, c, d float64) ([]float64, error) + func SolveLinear(a, b float64) (float64, error) + func SolveQuadraticReal(a, b, c float64) []float64 + func SortComplex(z []complex128) []complex128 + func SturmCountRoots(seq []Poly, a, b float64) int + func SturmRealRoots(p Poly, tol float64) []float64 + func SturmRefine(seq []Poly, a, b, tol float64) float64 + func SturmVariations(seq []Poly, x float64) int + func SturmVariationsAtNegInf(seq []Poly) int + func SturmVariationsAtPosInf(seq []Poly) int + func TotalRealRoots(p Poly, tol float64) int + type CPoly []complex128 + func CFromRoots(roots ...complex128) CPoly + func NewCPoly(coeffs ...complex128) CPoly + func (c CPoly) Add(q CPoly) CPoly + func (c CPoly) At(x complex128) complex128 + func (c CPoly) Clone() CPoly + func (c CPoly) Coeff(i int) complex128 + func (c CPoly) Deflate(r complex128) (quo CPoly, remainder complex128) + func (c CPoly) Degree() int + func (c CPoly) Derivative() CPoly + func (c CPoly) Eval(x complex128) complex128 + func (c CPoly) EvalDeriv(x complex128) (val, deriv complex128) + func (c CPoly) EvalDeriv2(x complex128) (val, d1, d2 complex128) + func (c CPoly) IsMonic(tol float64) bool + func (c CPoly) IsZero() bool + func (c CPoly) LeadingCoeff() complex128 + func (c CPoly) Monic() (CPoly, error) + func (c CPoly) Mul(q CPoly) CPoly + func (c CPoly) Neg() CPoly + func (c CPoly) NumTerms() int + func (c CPoly) Pow(k int) CPoly + func (c CPoly) Scale(s complex128) CPoly + func (c CPoly) String() string + func (c CPoly) Sub(q CPoly) CPoly + func (c CPoly) ToReal() Poly + func (c CPoly) Trim() CPoly + type ComplexRootMultiplicity struct + Multiplicity int + Root complex128 + func GroupComplexRoots(roots []complex128, tol float64) []ComplexRootMultiplicity + type Func func(x float64) float64 + type Poly []float64 + func DeflateRoots(p Poly, roots []float64) Poly + func FourierSequence(p Poly) []Poly + func FromRoots(roots ...float64) Poly + func FromRootsWithLead(lead float64, roots ...float64) Poly + func NewPoly(coeffs ...float64) Poly + func PolyFromDesc(coeffs ...float64) Poly + func SquareFree(p Poly) (Poly, error) + func SturmSequence(p Poly) []Poly + func (p Poly) Add(q Poly) Poly + func (p Poly) At(x float64) float64 + func (p Poly) Clone() Poly + func (p Poly) Coeff(i int) float64 + func (p Poly) CoeffsDesc() []float64 + func (p Poly) Compose(q Poly) Poly + func (p Poly) DeflateReal(r float64) (quo Poly, remainder float64) + func (p Poly) Degree() int + func (p Poly) Derivative() Poly + func (p Poly) DivMod(d Poly) (q, r Poly, err error) + func (p Poly) Equal(q Poly, tol float64) bool + func (p Poly) Eval(x float64) float64 + func (p Poly) EvalComplex(x complex128) complex128 + func (p Poly) EvalDeriv(x float64) (val, deriv float64) + func (p Poly) EvalDeriv2(x float64) (val, d1, d2 float64) + func (p Poly) GCD(q Poly) Poly + func (p Poly) InfNorm() float64 + func (p Poly) Integral(c float64) Poly + func (p Poly) IsConstant() bool + func (p Poly) IsMonic(tol float64) bool + func (p Poly) IsZero() bool + func (p Poly) L1Norm() float64 + func (p Poly) L2Norm() float64 + func (p Poly) LeadingCoeff() float64 + func (p Poly) Monic() (Poly, error) + func (p Poly) Mul(q Poly) Poly + func (p Poly) Neg() Poly + func (p Poly) NumTerms() int + func (p Poly) Pow(k int) Poly + func (p Poly) ProductOfRoots() float64 + func (p Poly) Quo(d Poly) (Poly, error) + func (p Poly) ReflectX() Poly + func (p Poly) Rem(d Poly) (Poly, error) + func (p Poly) Reverse() Poly + func (p Poly) Scale(s float64) Poly + func (p Poly) ShiftScale(a, b float64) Poly + func (p Poly) String() string + func (p Poly) Sub(q Poly) Poly + func (p Poly) SumOfRoots() float64 + func (p Poly) ToComplex() CPoly + func (p Poly) Trim() Poly + type Result struct + Converged bool + Iterations int + Root float64 + Value float64 + func Bisection(f Func, a, b, tol float64, maxIter int) (Result, error) + func Brent(f Func, a, b, tol float64, maxIter int) (Result, error) + func FalsePosition(f Func, a, b, tol float64, maxIter int) (Result, error) + func FixedPoint(g Func, x0, tol float64, maxIter int) (Result, error) + func Halley(f, df, d2f Func, x0, tol float64, maxIter int) (Result, error) + func Illinois(f Func, a, b, tol float64, maxIter int) (Result, error) + func Newton(f, df Func, x0, tol float64, maxIter int) (Result, error) + func Ridders(f Func, a, b, tol float64, maxIter int) (Result, error) + func Secant(f Func, x0, x1, tol float64, maxIter int) (Result, error) + func Steffensen(f Func, x0, tol float64, maxIter int) (Result, error) + type RootMultiplicity struct + Multiplicity int + Root float64 + func RealRootsWithMultiplicity(p Poly, tol float64) []RootMultiplicity + type SquareFreeFactor struct + Factor Poly + Multiplicity int + func SquareFreeFactorization(p Poly) ([]SquareFreeFactor, error)