The symbol f is the name of the function, and calling f with the proper argument structure (i.e. 1 argument, like x) replaces it with the function value (the definition on the right hand side). Since f is not called with an argument in your example in NMinimize, it is not replaced by the right hand side, thus a symbol is left which cannot be minimized.
If you define f as a function of y and not x, or even as a pure function:
f = #^4 - 3 #^2 - # &;
it is still not enough, as NMinimize then is replaced as:
NMinimize[f, x] --> NMinimize[#^4 - 3 #^2 - # &, x]
where # and x are not bound, as x now you can see that x does not appear at all in the function. On the other hand, this works:
NMinimize[foo^4 - 3 foo^2 - foo, foo]
{-3.51391, {foo -> 1.30084}}
Also note, that if you define your function in the standard way like this:
f[x_] := x^4 - 3 x^2 - x;
then calling f on its own returns the symbol f itself, as f does not have any OwnValue (only DownValues), therefore NMinimize[f, x] does not make sense:
f
f
{OwnValues[f], DownValues[f]}
{{}, {HoldPattern[f[x_]] :> x^4 - 3 x^2 - x}}
NMinimize[f[x], x], i.e.f[x]instead offas first argument. – F'x Mar 25 '12 at 22:45NMinimize[f, x]and there should be an answer why it doesn't work inMathematica. I don't find this to localized since it adresses the very basics of theMathematicacore and the current answer may be misleading until it does not emphasize the reasons of the error. – Artes Mar 25 '12 at 23:19Plot[f,{x,-10,10}]and it didn't work, would they have found the solutions below by searching in this site? No. Hence, "too localized"; only someone with the identical problem would have found the current form of this question useful. At least, this is how I view it. – acl Mar 26 '12 at 11:11NMinimize[f, x]produces an error. I find Mathematica frequentely involves mathematically inconvenient notation and this is the core of what I meant. I am sorry for too concise explaining of my point, I have no time at the moment . – Artes Mar 26 '12 at 12:25NMinimizedoc page should make it clear howNMinimizemust be used... I agree with F'x that this is unlikely to help future visitors. – Szabolcs Mar 27 '12 at 11:37