Thanks! On Thu, Nov 10, 2016 at 6:03 PM, Mauro <mauro...@runbox.com> wrote:
> > On Thu, 2016-11-10 at 20:07, Mauro <mauro...@runbox.com> wrote: > > On Thu, 2016-11-10 at 18:54, Joaquim Masset Lacombe Dias Garcia < > joaquimdgar...@gmail.com> wrote: > >> I am running a sequence of root finding functions in a loop. > >> For my problem the basic fzero always work. > >> > >> However, using Newtons method is very useful because it is very fast > when > >> it converges. > >> The problem is that when it does not converge it throws an error > instead of > >> a non-convergence flag. > >> > >> That way I cant use the fzero when newton fails (actually try/catch > works > >> but its very slow). > >> > >> Any suggestions? > > > > Just modify the Roots.jl package. > > To be a bit more informative: The error gets thrown here: > https://github.com/JuliaMath/Roots.jl/blob/943cf897e9ea6b31ab3ec70238ac49 > 31065d365a/src/derivative_free.jl#L45 > > In that function, modify all occurrences of > throw(ConvergenceFailed("some message")) > with > ( warn("some message"); return true) > > Restart the REPL > > Then it should not throw but warn and return the best value it found. >