Skip to main content
2 of 3
added 2 characters in body
yohbs
  • 7.1k
  • 3
  • 29
  • 60

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 setting AccuracyGoal:

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}} *)
yohbs
  • 7.1k
  • 3
  • 29
  • 60