|
12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- % Define environment (functions, gradients etc...)
- GivenEnv
-
-
- % Point x0 = (0, 0)
- % =========================================================================
- point = 1;
- x0 = [0, 0];
- f = fun(x0(1), x0(2));
- gf = grad_fun(x0(1), x0(2));
- hf = hessian_fun(x0(1), x0(2));
- ev = eig(hf);
- fprintf('Initial point (%d, %d), f = %f, grad = [%f;%f], hessian = [%f %f ; %f %f]. Eigenvalues= [%f, %f], Can NOT use method\n', x0, f, gf, hf, ev);
- disp(' ');
-
-
- % Point x0 = (-1, 1)
- % =========================================================================
- point = 2;
- x0 = [-1, 1];
- point_str = "[" + x0(1) + ", " + x0(2) + "]";
-
- f = fun(-1, 1);
- gf = grad_fun(x0(1), x0(2));
- hf = hessian_fun(x0(1), x0(2));
- ev = eig(hf);
- fprintf('Initial point (%d, %d), f = %f, grad = [%f;%f], hessian = [%f %f ; %f %f]. Eigenvalues= [%f, %f], Can NOT use method\n', x0, f, gf, hf, ev);
- disp(' ');
-
- % Point x0 = (1, -1)
- % =========================================================================
- point = 3;
- x0 = [1, -1];
- point_str = "[" + x0(1) + ", " + x0(2) + "]";
-
- f = fun(-1, 1);
- gf = grad_fun(x0(1), x0(2));
- hf = hessian_fun(x0(1), x0(2));
- ev = eig(hf);
- fprintf('Initial point (%d, %d), f = %f, grad = [%f;%f], hessian = [%f %f ; %f %f]. Eigenvalues= [%f, %f], Can NOT use method\n', x0, f, gf, hf, ev);
-
-
-
|