0
$\begingroup$

So basically I am trying to minimizing a function. I use the command "FindMinimum" since "Minimize" just returns the input.

FindMinimum gives me the minimized potential and the value of the two variables that minimize it. But... then I tried to vary parameters which gave me a different minimum, but the two variables still took the same value, which makes no sense to me.

Since I am dealing with very large and small numbers I suspect Mathematica cannot handle it.

For instance,

FindMinimum[((0.1) x^(-3) + (1/50000000) x^(-4/3)  + (80000^2 E^(-200 \[Pi] y) \[Pi]^2   Sqrt[y])/ 3 x - (4000 \[Pi]  y E^(-100 \[Pi] y))/(x^2)) / (800000000 \[Pi]), {x, y}]

$$\Big(\frac{0.1}{x^3} + \frac{1}{5 \times 10^6 x^{4/3}} + \frac{8 \times 10^{8} e^{-200 \pi y} \pi^2 \sqrt{y}}{3x} - \frac{4000 e^{-100 \pi y} \pi y}{x^2} \Big) \frac{1}{8 \times 10^8 \pi}$$

As can be seen, this function is dominated by the first term. The output is

{3.97887*10^-11, {x -> 1., y -> 1.}}]

However, if I tweak the first term, letting $0.1 \rightarrow 1$: $$\Big( \frac{1}{x^3} + \frac{1}{5 \times 10^6 x^{4/3}} + \frac{8 \times 10^{8} e^{-200 \pi y} \pi^2 \sqrt{y}}{3x} - \frac{4000 e^{-100 \pi y} \pi y}{x^2} \Big) \frac{1}{8 \times 10^8 \pi}$$

FindMinimum[((1) x^(-3) + (1/50000000) x^(-4/3)  + (80000^2 E^(-200 \[Pi] y) \[Pi]^2   Sqrt[y])/ 3 x - (4000 \[Pi]  y E^(-100 \[Pi] y))/(x^2)) / (800000000 \[Pi]), {x, y}]

now gives the output

{3.97887*10^-10, {x -> 1., y -> 1.}}

Notice that the value of the function changed but not x and y. Why is that? Are these numbers too hard for Mathematica to handle? If so, something I can do about it? I am a bit confused. My objective is to find x and y that minimizes the function.

$\endgroup$
3
  • $\begingroup$ From the documentation, FindMinimum "searches for a local minimum" and "Except when f and cons are both linear, the results found by FindMinimum may correspond only to local, but not global, minima." Further, machine precision will not generally give the best results. $\endgroup$
    – Bob Hanlon
    Apr 27 at 20:06
  • $\begingroup$ I see the function is complicated so it could be that other minimas are found. Do you have any idea why Minimize just return the input? $\endgroup$ Apr 28 at 13:52
  • $\begingroup$ Furthermore, I know approximately the values on x and y that minimizes the function. Is it possible to search for a minima close to those values of x and y? $\endgroup$ Apr 28 at 13:59
2
$\begingroup$
Clear["Global`*"]

f[x_, y_, t_] := (t x^(-3) + (1/
       50000000) x^(-4/3) + (80000^2 E^(-200 π y) π^2 Sqrt[y])/
      3 x - (4000 π y E^(-100 π y))/(x^2))/(800000000 π)

FunctionDomain[f[x, y, t], {x, y}]

(* x > 0 && y >= 0 *)

Since you "know approximately the values on x and y that minimizes the function", add constraints and use NMinimize. From documentation, "NMinimize always attempts to find a global minimum of f subject to the constraints given." However, that is not a guarantee that the global minimum is found, and certainly not if the constraints do not include the global minimum.

NMinimize[{f[x, y, 1/10], 0 < x < 2, 0 <= y < 2}, {x, y}, 
  WorkingPrecision -> 20] // N

(* {4.98816*10^-12, {x -> 1.99805, y -> 1.29799}} *)

NMinimize[{f[x, y, 1], 0 < x < 2, 0 <= y < 2}, {x, y}, 
  WorkingPrecision -> 20] // N

(* {4.97359*10^-11, {x -> 2., y -> 1.29799}} *)
$\endgroup$
0
$\begingroup$

Things get a bit better if you remove the multiplicative constant:

f[x_, y_, t_] := (t x^(-3) 
   + (1/50000000) x^(-4/3) 
   + (80000^2 E^(-200 \[Pi] y) \[Pi]^2 Sqrt[y])/3 x 
   - (4000 \[Pi] y E^(-100 \[Pi] y))/(x^2));
FindMinimum[f[x, y, .1], {x, y}]
  (* {2.40011*10^-19, {x -> 1.55095*10^8, y -> 1.}} *)

However note that

Limit[f[x, x, 1], x -> \[Infinity]]
(* 0 *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.