JuliaNLSolvers / NLsolve.jl

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

i have tried to solve this in jullia 1.4.2, but got error #251

Closed qorimaputri closed 4 years ago

qorimaputri commented 4 years ago

image

*f! = function (x,dx) dx[1] = x[1] + x[2](x[2](5-x[2])-2)-13 dx[2] = x[1] + x[2](x[2]*(1+x[2])-14)-29 end

solve = nlsolve(f!,[15;-2]) ** InexactError: Int64(NaN)

Stacktrace: [1] Int64(::Float64) at .\float.jl:710 [2] alloc_DF(::Array{Int64,1}, ::Array{Int64,1}) at C:\Users\WIN10.julia\packages\NLSolversBase\QPnui\src\objective_types\abstract.jl:19 [3] nlsolve(::Function, ::Array{Int64,1}; method::Symbol, autodiff::Symbol, inplace::Bool, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at C:\Users\WIN10.julia\packages\NLsolve\04rfI\src\nlsolve\nlsolve.jl:49 [4] nlsolve(::Function, ::Array{Int64,1}) at C:\Users\WIN10.julia\packages\NLsolve\04rfI\src\nlsolve\nlsolve.jl:46

how can solve these??

antoine-levitt commented 4 years ago

Your input is in Ints, should be in floats:

solve = nlsolve(f!,[15.0;-2.0])

This should probably be made more user-friendly...

qorimaputri commented 4 years ago

thanks a lot