JuliaNLSolvers / NLsolve.jl

Julia solvers for systems of nonlinear equations and mixed complementarity problems

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Discrepancy of NLsolve with Mathematica

dkiese1 opened this issue · comments

Hi,

I encountered the following problem. I have a large system of coupled non-linear equations for which I would like to find the root. I have implemented two versions - one in Julia and one in Mathematica (the latter just as a first trial, the Julia version is the one I plan to use mainly). In Mathematica FindRoot using Newton's method nicely converges. NLsolve also converges, but to a different (and also incorrect) solution. I already benchmarked, that the initial condition and also the equations themselves are the same in both codes. Using the Mathematica solution as initial condition for nlsolve converges immediately, returning the input. So apparently, this seems to be an initial value problem, yet I wonder why we cannot find the solution in Julia if the algorithm (nlsolve(f!, x_initial, method = :newton)) and the initial condition should be the same. Since the equations are subject of current research, bare with me that I cannot post them here. I am however ready to share code in a private discussion.

You can reach me on patrick.mogensen @ gmail.com if you want to share something in private.

In general, there might be a number of reasons why one converges and the other one doesn't. If you just use :newton it will default to no line search, so no it's actually not Damped Newton's method as FindRoot appears to be. You'd have to choose a line search. Try , linesearch = LineSearches.BackTracking(). You need to using LineSearches first.

Hi,
I have the same problem and I tried the linesearch as well. But it still does not work. Did you find out any solution?
P.S. I have the solutions for FindRoots (Mathematica) and fsolve(Python) which both seem very similar but not same as Julia's roots