As @xzczd pointed out, for a minimum to exist the coefficient of the second term should be positive. After doing that, you can improve accuracy by settingplaying with WorkingPrecision
, AccuracyGoal
, or PrecisionGoal
. Here's one example:
f[x_, y_] := (x - 1)^2 + 10^-20 (y - 2)^2
NMinimize[f[x, y], {x, y}]
(* Output: {1.75769*10^-20, {x -> 1., y -> 0.674219}}*)
NMinimize[f[x, y], {x, y}, AccuracyGoal -> 40]
(* Output: {6.70318*10^-29, {x -> 1., y -> 1.99992}} *)