One of the most useful developments of Julia is the concept of the metapackage. A package management system coupled with multiple dispatch has lead to ecosystems like Plots.jl, DiffEqBase.jl (DifferentialEquations.jl), and MathProgBase.jl (JuMP) which allow you to use the same high level code to plug into many different packages in the same regime. This has been not only a big boost for users (there’s one interface to know!), but it’s actually been crazy amazing for package development: you can write a package which targets one interface and now all of the methods are available.
To build off of these successes, I would like to propose some kind of RootFindingBase.jl. Building off of previous interfaces, what I would like to see is something like:
find_zeros(f,interval,x0,alg(),kwargs...)
which would dispatch find_zeros
using the type of alg
to different solver methods in different packages. Candidates that I know of include:
- Roots.jl
- Sundials.jl (KINSOL)
- NLsolve.jl
The idea is so that way I could so something like
find_zeros(f,(0.0,1.0),0.5,kinsol(linear_solver=banded),abstol=1e-5)
to call Sundials.jl and
find_zeros(f,(0.0,1.0),0.5,nlsolve(autodiff=true),abstol=1e-5)
to call NLsolve.jl
The reason why this is important to me is because it would allow me to write algorithms at this level, and let the user choose any nonlinear solver which fits the problem (and also easily benchmark between them!). (This will be really nice for JuliaDiffEq because then implicit methods could easily swap out rootfinding algorithms!).
The questions going forward are:
- Are package maintainers on-board to add this kind of interface?
- What are the problems with the current proposal?
- How do we make it robust to the different types of rootfinding problems which exist?
Some details to discuss are:
- The form of
f
. Allow both inplace and not inplace (allow not inplace for the univariate case, and auto-convert to an inplace function for problems on vectors?) - Not every method needs an interval or an initial condtion. What do we do here?
- What should the solution type look/act like?
- Anything else you can think of.