Dear Shinji,
There is an example in the current documentation for NMinimize[]
(here) that shows the use f2[a_?NumericQ] := ...
. Note NumberQ[Sqrt[2]]
is False
but NumericQ[Sqrt[2]]
is True
. Therefore NumberQ[]
is a more restrictive test; per the docs, "NumberQ[expr]
returns False
unless expr
is manifestly a number (i.e. has head Complex
, Integer
, Rational
, or Real
)." The expression Sqrt[2]
has head Power
(another somewhat frequently encountered problem). NumberQ[]
may be slightly faster than NumericQ[]
, but RepeatedTiming[]
shows no discernible difference in my tests.
This example had been part of the "knowledge base" tech notes, but I believe it was incorporated into the documentation some years ago. The knowledge base note is still available here: https://support.wolfram.com/12502.
The issue is also discussed in this StackExchange answer. Other answers in that Q&A discuss things someone thinks are helpful for Mathematica users to know, some of which you may find helpful.
As for "the critical language design policies" in general, I'm not sure I can really help. I think I "grok" them. When I started, I read The Mathematica Book by Stephen Wolfram back around 1990. It is (or was for the early versions) a good, intermediate-level guide, with a good introductory Part 1. I came away with a pretty good understanding of "everything-is-an-expression"; that "evaluation" meant rewriting expressions according to pattern-rule operations, and it was not strictly limited to number and string crunching as in C but was more like Lisp, two languages I knew; and that there was "standard evaluation" and "non-standard evaluation." Coming to grips with standard and non-standard evaluation, the significance of Hold*
attributes, Hold[]
, Unevaluated[]
, Defer[]
, and up-/down-/sub-values associated to symbols took a bit longer. And now we have Inactive[]
. It's complicated. That means it is easy to become confused. Some of it I gave up on and didn't understand for maybe fifteen years or more. Most work does not require an understanding of all the arcane aspects. Much of The Mathematica Book is available in the documentation, tutorial/VirtualBookOverview. It has necessarily been restructured and updated. "The Evaluation of Expressions" may be found under "Core Language."
I mention several aspects of evaluation, because that is at the heart of the problem in the OP, and an appropriate pattern (_?NumericQ
) is needed to control the order of evaluation.
I might also mention that at the time I started learning Mathematica, I knew Postscript, which greatly helped with understanding graphics concepts in early Mathematica; and Macaulay and Maple, which greatly helped with understanding symbolic algebra concepts and symbolic computation in general.