JuliaNLSolvers / NLsolve.jl

Julia solvers for systems of nonlinear equations and mixed complementarity problems
Other
325 stars 66 forks source link

Fixedpoint returns wrong result #231

Open bertschi opened 4 years ago

bertschi commented 4 years ago

Hi,

consider the following function: f(x, p) = p .* x

When I solve for a fixed point everything works fine when p != 0. But when p = 0, the call fixedpoint(x -> f(x, 0.), [1.2]) just returns the initial condition, e.g. 1.2, and not the fixed point of zero. This also occurs when setting m = 0 which according to the documentation just gives Picard iteration. Don't understand how this could possibly fail. Any ideas?

Nils
pkofod commented 4 years ago

Can you show me the output? I get the correct answer.

pkofod commented 4 years ago

I'm seeing some test noise wrt fixedpoints so I'm looking into it.

bertschi commented 4 years ago

Your right, it works in version 4.2.0

julia> fixedpoint(x -> f(x, 0.), [1.2]) Results of Nonlinear Solver Algorithm

With version 4.0.0 instead, I get

fixedpoint(x -> f(x, 0.), [1.2]) Results of Nonlinear Solver Algorithm

In any case, I was running on Julia 1.3.0. Will upgrade my dependencies which hopefully also solves the issue with my larger model.

pkofod commented 4 years ago

Fingers crossed :)

pkofod commented 4 years ago

I think this solved your bug https://github.com/JuliaNLSolvers/NLsolve.jl/commit/9b4c7b37e6fd2911d1fab77ebeabd450a039712b