Hi, someone not knowing much about optimization here…
Why does this code searching for the minimum of the two-dimensional paraboloid
optimize(x->x[1]^2+x[2]^2,[1.0, 1.0])
work without given algorithm whilst this one-dimensional equivalent
optimize(x->x[1]^2,[1.0])
only works with specified algorithm
optimize(x->x[1]^2,[1.0], BFGS())
(message says that NelderMead does not work with one variable)
Further, this version without vectors
optimize(x->x^2,1.0)
does not work at all for syntactical reasons, seemingly:
ERROR: MethodError: no method matching optimize(::getfield(Main, Symbol("##13#14")), ::Float64)
but the bound version in (-1.0,1.0) works fine (and is much more precise)
optimize(x->x^2,-1.0,1.0)
I stumbled across this because I want to optimize a one-dimensional function from a given starting point, not an interval