The following expressions give True in the NumericQ test:

Map[NumericQ, {Rational[2, 3], Complex[2, 3], 
  Root[1 + 2 #1 + #1^5 &, 1], RootSum[-7 - 3 #1 + #1^5 &, Sin[#1] &]}]

(* Out: {True, True, True, True} *)

However the heads Rational, Complex, Root and RootSum do not have the attribute NumericFunction:

(* Out: {NHoldAll, Protected, ReadProtected} *)

... but NumericQ still returns True when applied to them.

Is there a way to obtain a list of all the possible heads h of expressions h[args] that do NOT have the NumericFunction attribute, and yet will give True in the test NumericQ[h[args]]?


1 Answer 1


Note that Root is only considered numeric when its argument does NOT contain any non-numerical parameters. For instance:

Root[(# - a) &, 1] 
(* Out: a *)

NumericQ@Root[(# - a) &, 1] 
(* Out: False *)

A similar argument applies to RootSum, Rational, and Complex:

NumericQ@RootSum[a + # &, Log[#1] &]   (* False *)
NumericQ@Rational[a, 2]                (* False *)
NumericQ@Complex[a, 2]                 (* False *)

It seems to me that these examples still fall within the general guideline presented in the documentation for NumericQ, under "Details": "NumericQ[expr] gives True whenever N[expr] would yield an explicit number".

  • $\begingroup$ Yes they do fall within the documentation, what I want to know is the explicit list of ALL the heads that fall within the documentation, I know Root, RootSum, Rational, Complex, are there others? Could new ones appear in future versions of Mathematica? If so, how could they be automatically detected in the code of a Mathematica package? $\endgroup$ Commented Jun 9, 2016 at 21:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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