Let the Rosenbrock function given by fx1x2=100x2-x1^2^2+1-x1^2 and initial condition x0=22 compute the gradient of fx1x2 at x0
The gradient of f(x1,x2) is given by:
∇f(x1,x2) = [ ∂f/∂x1, ∂f/∂x2 ]
Taking partial derivatives, we get:
∂f/∂x1 = -400x1(x2-x1^2) - 2(1-x1) ∂f/∂x2 = 200(x2-x1^2)
Substituting x(0)=[2,2], we get:
∂f/∂x1 = -400(2)(2-2^2) - 2(1-2) = -1200 ∂f/∂x2 = 200(2-2^2) = -400
Therefore, the gradient of f(x1,x2) at x(0)=[2,2] is:
∇f(2,2) = [-1200, -400]
原文地址: http://www.cveoy.top/t/topic/bquG 著作权归作者所有。请勿转载和采集!