Skip to main content
added 176 characters in body
Source Link
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 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}} *)

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}} *)

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 playing 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}} *)
added 2 characters in body
Source Link
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}} *)

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}} *)

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}} *)
Source Link
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}} *)