[Date Index] [Thread Index] [Author Index]
Gradient option for FindMinimum
How does one specify the Gradient option for FindMinimum when the function being minimized takes as argument a list of real numbers of unspecified length? Suppose I have defined a numerical function func[x_] := ... that returns a real number when given a list of real numbers x. I have also defined a numerical function grad[x_] := ... that returns the gradient of func at x (a list of real numbers of the same length as x). How do I use func and grad within FindMinimum to find the local minimum of func given some starting point x0 (a list of real numbers of the appropriate length)? I use Mathematica version 6. The documentation for the Gradient option says to specify a list of functions. This would be very inefficient in my case. Without going into too many details, this comes about because func is a sum of terms over pairs of variables, as is grad. One computation of grad therefore takes just about the same time as one computation of func. This efficiency would be lost if Mathematica had to evaluate multiple versions of grad, one corresponding to each of its components. In my application the variable x has typically thousands of components.