I am having trouble with the while loop not breaking,
f[x_, y_] = 2 x^2 + 5 y^2;
dfx[x_, y_] = D[f[x, y], x];
dfy[x_, y_] = D[f[x, y], y];
a = 10.;
b = 10.;
aold = 0;
bold = 0;
count=0;
While[ Abs[f[a, b] - f[aold, bold]] > 10^-5,
aold = a; bold = b;
α = dfx[a, b]; β = dfy[a, b];
l[t_] = {a, b} + t*{α, β};
h[t_] = f[l[t][[1]], l[t][[2]]];
dh[t_] = D[h[t], t];
tnew = t /. Solve[dh[t] == 0, t];
a = a + tnew*α;
b = b + tnew*β;
count++;
If[count == 10, Break[]];
]
When I print the output, value of Abs[f[a, b] - f[aold, bold]]
is way smaller than $10^{-5}$, the condition should be met around 5 loops. Can you see what is wrong with the code?