function [y,dy,hy]=testfunc(x) % A test function for Newton's Method: % The input is the VECTOR x (with elements x,y below) % % y = (1/4)x^4-(1/2)x^2+(1/2)y^2 % dy = Gradient = [x^3-x; y] (The gradient will output as a COLUMN) % hy = Hessian = [3x^2-1, 0;0,1] y=(1/4)*x(1)^4-(1/2)*x(1)^(1/2)*x(2)^2; dy=[x(1)^3-x(1); x(2)]; hy=[3*x(1)^2-1, 0;0,1];