Pardon my ignorance (if you’ve seen any recent posts of mine you’ll know I’ve been studying calculus lately) but I’m trying to understand how to find local maxima of a multivariate function with Optim.jl. Given the following function, it’s pretty easy to pick a starting point and let Optim work its magic to find local minima:

```
using Optim
using Plots
using Plots.PlotMeasures
pyplot(size=(1200,600))
f(x,y) = -5*x*y*exp(-x^2-y^2)
res = optimize(x -> f(x[1],x[2]), [1.0,1.0])
res2 = optimize(x -> f(x[1],x[2]), [-0.75,-0.75])
# Contour plot with local minima added
p = contour(
x,
y,
z,
color=:blues,
legend=false,
xlabel="x",
ylabel="y"
)
plot!([Optim.minimizer(res)[1]], [Optim.minimizer(res)[2]], marker=:circle)
plot!([Optim.minimizer(res2)[1]], [Optim.minimizer(res2)[2]], marker=:circle)
```

In this case, I can obviously just use the same values from `res`

and `res2`

by switching the sign for the `y`

value (`-(Optim.minimizer(res)[2])`

but is there a way to have it find local maxima just like it does for local minima? The docs seem to only discuss minimizing functions.