% Given environment clear; % Setup the function under test syms x y; fexpr = x^5 * exp(-x^2 - y^2); title_fun = "$f(x,y) = x^5 \cdot e^{-x^2 - y^2}$"; % Calculate the gradient and Hessian grad_fexpr = gradient(fexpr, [x, y]); % Gradient of f hessian_fexpr = hessian(fexpr, [x, y]); % Hessian of f % Convert symbolic expressions to MATLAB functions fun = matlabFunction(fexpr, 'Vars', [x, y]); % Function grad_fun = matlabFunction(grad_fexpr, 'Vars', [x, y]); % Gradient hessian_fun = matlabFunction(hessian_fexpr, 'Vars', [x, y]); % Hessian % Amijo globals global amijo_beta amijo_sigma %fixed step size globals global gamma_fixed_step