Hi! I want to optimize a 2 variable function using Optim.jl. I’ve read the documentation but I still can’t figure it out. I hope someone can help me. (I’m using Optim and using MittagLeffler on a Jupyter notebook with Julia 1.5.3).

I have two arrays of data x_1 and y_1. I have defined the following function which I want to optimize:

```
function distancia2(α, m)
distancias = 0.0
for j in 1:length(x_1) #length(x) = length(y)
distancias += (9.387683485474406*mittleff(α, m*x_1[j]) + 71.89597427356132 - y_1[j])^2
end
return distancias
```

end

which is basically the square residues of the Mittag-Leffler function to the set of data points that I have.

I want to find \alpha and m such that minimize distancias2(\alpha, m). I have tried: optimize(distancia2, [0.9900284232219172, -0.0067826190463882875]) (which are my initial guesses), but get the following error:

MethodError: no method matching distancia2(::Array{Float64,1})

Closest candidates are:

distancia2(::Any, ::Any) at In[24]:3

Stacktrace:

[1] value!!(::NonDifferentiable{Float64,Array{Float64,1}}, ::Array{Float64,1}) at C:\Users\progr.julia\packages\NLSolversBase\geyh3\src\interface.jl:9

[2] initial_state(::NelderMead{Optim.AffineSimplexer,Optim.AdaptiveParameters}, ::Optim.Options{Float64,Nothing}, ::NonDifferentiable{Float64,Array{Float64,1}}, ::Array{Float64,1}) at C:\Users\progr.julia\packages\Optim\3K7JI\src\multivariate\solvers\zeroth_order\nelder_mead.jl:171

[3] optimize(::NonDifferentiable{Float64,Array{Float64,1}}, ::Array{Float64,1}, ::NelderMead{Optim.AffineSimplexer,Optim.AdaptiveParameters}, ::Optim.Options{Float64,Nothing}) at C:\Users\progr.julia\packages\Optim\3K7JI\src\multivariate\optimize\optimize.jl:35

[4] optimize(::Function, ::Array{Float64,1}; inplace::Bool, autodiff::Symbol, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at C:\Users\progr.julia\packages\Optim\3K7JI\src\multivariate\optimize\interface.jl:90

[5] optimize(::Function, ::Array{Float64,1}) at C:\Users\progr.julia\packages\Optim\3K7JI\src\multivariate\optimize\interface.jl:84

[6] top-level scope at In[29]:1

[7] include_string(::Function, ::Module, ::String, ::String) at .\loading.jl:1091

Any help would be truly appreciated!!