Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TrustRegion cannot solve the Readme example from NLsolve.jl #170

Closed
junyuan-chen opened this issue Mar 22, 2023 · 1 comment
Closed

TrustRegion cannot solve the Readme example from NLsolve.jl #170

junyuan-chen opened this issue Mar 22, 2023 · 1 comment

Comments

@junyuan-chen
Copy link

junyuan-chen commented Mar 22, 2023

If I didn't misunderstand how the solver is supposed to be used, there must be issues with TrustRegion. Also, what seems strange to me is that there is no warning message or something like that when the residuals are far from zeros. Somehow the solver just terminates quietly.

function f!(F, x, p)
    F[1] = (x[1]+3)*(x[2]^3-7)+18
    F[2] = sin(x[2]*exp(x[1])-1)
end

function j!(J, x, p)
    J[1, 1] = x[2]^3-7
    J[1, 2] = 3*x[2]^2*(x[1]+3)
    u = exp(x[1])*cos(x[2]*exp(x[1])-1)
    J[2, 1] = x[2]*u
    J[2, 2] = u
end

x0 = [0.1, 1.2]
F = NonlinearFunction(f!, jac=j!)
prob = NonlinearProblem(F, x0)
solver = solve(prob, TrustRegion(), reltol=1e-8)

Running above gives:

julia> solver = solve(prob, TrustRegion(), reltol=1e-8)
u: 2-element Vector{Float64}:
 0.22839632925361786
 1.1261248602773282

julia> solver.resid
2-element Vector{Float64}:
 0.011709310458734024
 0.40325365258870505
@ChrisRackauckas
Copy link
Member

This is a duplicate of #142.

Note that I just pulled them from the docs for this reason. bf6bcce

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants