Hello. I need to perform Gradient Descent in VBA. Before that I wanna do the same thing in mathematica. So that I've tried to use this code. I've already made it for one variable and it works well. But for two it dosent.
...
Do[
cx = nx;
cy = ny;
Subscript[p, 0] = cx;
Subscript[p, 1] = cy;
nx = cx - alpha*dx;
(*Print[nx];*)
ny = cy - alpha*dy;
i += 1;
(*Print[ny];*)
step = nx - cx;
tmp = {nx, ny};
If[ Abs[step] <= precision && Abs[step] > 0, Break[]], 500]
i
Subscript[p, 0] = tmp[[1]]
Subscript[p, 1] = tmp[[2]]
z = Y/100*z
it dosent find a correct solution. I've found partial derivatives in the file. Please, take a look at the attachment for the whole code. Are there other effective numerical methods for this function to make a code the problem in VB/VBA? So I cant use any optimization libraries there. And I need to write a complete code of that stuff. To do that I need to make it in mathematica first.
Attachments: