JuliaNLSolvers / NLsolve.jl

Julia solvers for systems of nonlinear equations and mixed complementarity problems

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ftol seems to be ignored, or incorrectly computed

ChrisRackauckas opened this issue · comments

using NLsolve
function g(resid,u)
    resid[1] = u[1] < 0 ? -u[1] : 0
end
nlsolve(g,[-1.2354],ftol=1e-18)

Results of Nonlinear Solver Algorithm
 * Algorithm: Trust-region with dogleg and autoscaling
 * Starting Point: [-1.2354]
 * Zero: [2.46247e-12]
 * Inf-norm of residuals: 0.000000
 * Iterations: 2
 * Convergence: true
   * |x - x'| < 0.0e+00: false
   * |f(x)| < 1.0e-18: true
 * Function Calls (f): 3
 * Jacobian Calls (df/dx): 3

It's clear that the root that is found does not satisfy the ftol, but it reports true.

It doesn't? g(2.4647e-12) is 0.0 so f(x) < 1e-18. What am I missing? :)

Oh I read it was negative. Dang, I need to find a better MWE then.

Tracked it down to something else.

If the rabbit hole ends up here in NLsolve, you know where the button is to make a complaint :)