({{, (RefLink[Gradient, paclet:ref/Gradient]) 
is an option for (RefLink[FindMinimum, paclet:ref/FindMinimum]) and related functions that specifies the gradient vector to assume for the function being extremized.}})

OpenersNotesSection(Spacer1)Details

(RefLink[Gradient, paclet:ref/Gradient])->{(Subscript[f, x]),(Subscript[f, y]),…} specifies explicit components to assume for the gradient vector.

(RefLink[Gradient, paclet:ref/Gradient])->(RefLink[Automatic, paclet:ref/Automatic]) specifies that the gradient vector should be deduced by exact or approximate differentiation of the function.

Gradient:>expr evaluates expr only with the specific numerical values of variables that are needed.

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Specify a numeric black-box function:

f[x_?NumberQ, y_?NumberQ] := Cos[x^2 - 3 y] + Sin[x^2 + y^2];

f[x,y]

Specify a symbolic gradient to use:

FindMinimum[f[x,y],{x,y},Gradient:>{2 x Cos[(x^2)+(y^2)]-2 x Sin[(x^2)-3 y],2 y Cos[(x^2)+(y^2)]+3 Sin[(x^2)-3 y]}]

Specify that second-order finite differences be used:

FindMinimum[f[x,y],{x,y},Gradient:>{"FiniteDifference", "DifferenceOrder"->2}]

Give a monitor for evaluation of the gradient:

Module[{g = 0},{FindMinimum[f[x,y],{x,y},Gradient:>{Automatic,"EvaluationMonitor":>g++}],g}]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[FindFit, paclet:ref/FindFit])  ▪  (RefLink[FindMaximum, paclet:ref/FindMaximum])  ▪  (RefLink[FindMinimum, paclet:ref/FindMinimum])  ▪  (RefLink[StepMonitor, paclet:ref/StepMonitor])}})}})