I have been having some trouble with NMinimize
. I am trying
NMinimize[f[x], x]
where f
is a complicated function. The whole reason I am using NMinimize
is because f
is too complicated to be able to compute for an arbitrary x
, but for a fixed value of x
it is fine.
Well NMinimize
seemed to be taking up an outrageous amount of time and memory, so I added a print statement inside f
f[x_]:= Module[{},
Print[x];
...
]
and ran the NMinimize
code again. To my surprise, Mathematica prints x$4770
, the name of a local variable. Why is NMinimize
calling my function with non-numeric values? How can I stop it from doing so?