SciML / NonlinearSolve.jl

High-performance and differentiation-enabled nonlinear solvers (Newton methods), bracketed rootfinding (bisection, Falsi), with sparsity and Newton-Krylov support.
https://docs.sciml.ai/NonlinearSolve/stable/
MIT License
226 stars 40 forks source link

Unhelpful return code for IntervalNonlinearProblem #452

Open TomRottier opened 1 month ago

TomRottier commented 1 month ago

Trying to solve the following IntervalNonlinearProblem:

f(t,p) = sin(t) - 10.0
prob = IntervalNonlinearProblem(f, [0.0, 2pi])
sol = solve(prob, ITP())

gives a FloatingPointLimit return code and the solution as 0.0. Which according to the docs (https://docs.sciml.ai/SciMLBase/stable/interfaces/Solutions/#retcodes) means a successful solve:

ReturnCode.FloatingPointLimit The success state of the solver. If this return code is given, then the solving process was successful, and the closest floating point value to the solution was given.

Given this equation cannot be solved this return code doesn't seem appropiate. It also feels like the "closest floating point value to the solution" should be pi/2 rather than 0.0.

On Julia 1.10.4 and:

(jl_ajmNJc) pkg> st
Status `/tmp/jl_ajmNJc/Project.toml`
  [8913a72c] NonlinearSolve v3.13.1
oscardssmith commented 1 month ago

it should probably be an initialfailure since I think intervalproblem requires opposite signs on the boundary

ChrisRackauckas commented 1 month ago

Yes, it should give an initial failure with a warning about not being an enclosing interval.