NumberQ

NumberQ[expr]

gives True if expr is a number, and False otherwise.

Details

Examples

open allclose all

Basic Examples  (1)

NumberQ tests whether an object is explicitly a number:

Scope  (3)

The expression must be manifestly a number:

You can test if a quantity represents a number with NumericQ:

On numerical coercion with N, such quantities generally become numbers:

NumberQ[Infinity] gives False:

The same is true for complex and directed infinities:

NumberQ[Overflow[]] and NumberQ[Underflow[]] give True:

They are both treated as Real:

Applications  (2)

Test if a matrix consists entirely of numbers:

Define a function that only evaluates when the argument is a number:

It does not evaluate with a symbolic argument:

It does evaluate when the argument is a number:

Use FindRoot to find all the solutions of the boundary value problem with :

Plot the solutions:

Properties & Relations  (2)

NumberQ is equivalent to MatchQ[#,_Integer|_Rational|_Real|_Complex]&:

If NumberQ[x] is True, then NumericQ[x] is also True:

Wolfram Research (1988), NumberQ, Wolfram Language function, https://reference.wolfram.com/language/ref/NumberQ.html (updated 1996).

Text

Wolfram Research (1988), NumberQ, Wolfram Language function, https://reference.wolfram.com/language/ref/NumberQ.html (updated 1996).

CMS

Wolfram Language. 1988. "NumberQ." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 1996. https://reference.wolfram.com/language/ref/NumberQ.html.

APA

Wolfram Language. (1988). NumberQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/NumberQ.html

BibTeX

@misc{reference.wolfram_2024_numberq, author="Wolfram Research", title="{NumberQ}", year="1996", howpublished="\url{https://reference.wolfram.com/language/ref/NumberQ.html}", note=[Accessed: 22-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_numberq, organization={Wolfram Research}, title={NumberQ}, year={1996}, url={https://reference.wolfram.com/language/ref/NumberQ.html}, note=[Accessed: 22-November-2024 ]}