Skip to main content
Small improvements for readability
Source Link
MarcoB
  • 68k
  • 19
  • 98
  • 205

How to obtain all possible heads of expressions without What Heads do not have the attribute NumericFunction that, but still give True in the NumericQ test, like the head Root?

NextThe following expressions give TrueTrue in the NumericQNumericQ test:

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

we obtain:

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

However the heads RationalRational, ComplexComplex, RootRoot and RootSumRootSum do not have the attribute NumericFunction, for example if we evaluateNumericFunction:

Attributes[Root] 

we obtain:

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

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

Is there a way to obtain a list of all the posiblepossible heads hh of expressions h[args]h[args] that do NotNOT have the NumericFunctionNumericFunction attribute, and yet will give TrueTrue in the test NumericQ[h[args]]NumericQ[h[args]]?

How to obtain all possible heads of expressions without attribute NumericFunction that give True in the NumericQ test, like the head Root

Next 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] &]}] 

we obtain:

{True, True, True, True} 

However the heads Rational, Complex, Root and RootSum do not have the attribute NumericFunction, for example if we evaluate:

Attributes[Root] 

we obtain:

{NHoldAll, Protected, ReadProtected} 

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

What Heads do not have the attribute NumericFunction, but still give True in NumericQ?

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:

Attributes[Root] (* 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]]?

Source Link
MaTECmatica
  • 588
  • 4
  • 12

How to obtain all possible heads of expressions without attribute NumericFunction that give True in the NumericQ test, like the head Root

Next 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] &]}] 

we obtain:

{True, True, True, True} 

However the heads Rational, Complex, Root and RootSum do not have the attribute NumericFunction, for example if we evaluate:

Attributes[Root] 

we obtain:

{NHoldAll, Protected, ReadProtected} 

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