I’m using Optim and the BFGS algarithm in order to minimize a function. In order to speed up the minimization I want to provide the gradient of the objective function. However both, the objective function as well as the gradient depends on some constant parameters. I know, how to pass the constant parameters for objective function by

```
optimize(x -> mse(x, p), start_guess, BFGS() )
```

How can I do the same with the gradient function?