Q:

NMinimize function in Mathematica

I tried using NMinimize function to find the global minimum of the following function.
f = {s1 - Log[1000/{Norm[{2.83, 0, 2} - {u, v, w}]}^3]}^2 + {s2 - 
      Log[1000/{Norm[{0, 2.83, -2} - {u, v, w}]}^3]}^2 + {s3 - 
      Log[1000/{Norm[{-2.83, 0, 2} - {u, v, w}]}^3]}^2 + {s4 - 
      Log[1000/{Norm[{0, -2.83, -2} - {u, v, w}]}^3]}^2;
NMinimize[f, {u, v, w}, Method -> {"DifferentialEvolution"}].

The optimization is an unconstrained optimization. The following is the error I get each time I run it.

"NMinimize::nnum: "The function value {{2.67476}} is not a number at
  {u,v,w} = {0.673558,0.659492,0.0861047}"

I am not sure where I am going wrong. Also is there a way to set the stopping rule and to extract the values from the NMinimize output when there is an error of this kind.
Please help me in debugging this code.
Thank you in advance for the help
Kum.

A:

Curly braces mean lists in Mathematica, so your function is outputting a one-element matrix, not a scalar. Change the pairs of {} you are using for grouping into normal parentheses. The fact you are getting double curly braces shows that there are two levels of braces to convert.
f = (s1 - Log[1000./(Norm[{2.83, 0, 2} - {u, v, w}])^3])^2 + (s2 - 
      Log[1000./(Norm[{0, 2.83, -2} - {u, v, w}])^3])^2 + (s3 - 
      Log[1000./(Norm[{-2.83, 0, 2} - {u, v, w}])^3])^2 + (s4 - 
      Log[1000./(Norm[{0, -2.83, -2} - {u, v, w}])^3])^2;

As a further remark, I'd change the Integer values (1000) into real numbers (1000.), since the rest of the input is in machine-precision real numbers. As Brett reminded me in the comments, the output won't be any different, but if you are doing a lot of repeated calculations, you might notice a small performance speed-up, and you can more easily Compile the function if you want further performance improvements.
(Edited when I realised it was a 1*1 matrix output, not a vector output.)

