# Complex Number Support in NLSolve

**URL:** <https://discourse.julialang.org/t/complex-number-support-in-nlsolve/36748>\
**Category:** Optimization (Mathematical)\
**Tags:** complex-numbers\
**Created:** [March 30, 2020, 3:17pm UTC](https://discourse.julialang.org/t/complex-number-support-in-nlsolve/36748 "2020-03-30T15:17:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ccoffrin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ccoffrin/32/400_2.png) [@ccoffrin](https://discourse.julialang.org/u/ccoffrin)\
**Post date:** [March 30, 2020, 3:17pm UTC](https://discourse.julialang.org/t/complex-number-support-in-nlsolve/36748/1 "2020-03-30T15:17:59Z")

</div>

What is the scope of complex number support in NLSolve?

I found an example in this issue, [Allow complex numbers · Issue #112 · JuliaNLSolvers/NLsolve.jl · GitHub](https://github.com/JuliaNLSolvers/NLsolve.jl/issues/112)

```julia
using NLsolve

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

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

nlsolve(f!, g!, [0.1+im; 1.2])

```

Which seems to be resolved. However throws this error,

```julia
ERROR: BoundsError: attempt to access 2-element Array{Complex{Float64},1} at index [1, 2]

```

in julia v1.4, NLsolve v4.3
