Hi, I am trying to solve a highly dimensional nonlinear optimization problem for which I have a function that maps a vector into a value and a its jacobian. I want to solve the problem providing the gradient but I can not find good resources that explain how to do so using the Optim package. Can anyone point to resources or provide a very simple example illustrating how to set up the problem?

I am trying to adapt the example in the documentation so that it takes in a vector instead its elements explicitly because in my problem I am solving a 15 dimensional problem. However, when I do this it assumes it is univariate function. I illustrate this below: