GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • WOLFRAM
  • Products
  • AI AccessUse with Mathematica and Wolfram|One
  • Finance Platform
  • Wolfram|Alpha Notebook Edition
  • Application Server
  • Enterprise Private Cloud
  • Wolfram Engine
  • Wolfram Player
  • Wolfram Cloud App
  • Wolfram Player App
  • Wolfram|Alpha Website
  • Wolfram|Alpha APIs
  • Wolfram AI Ecosystem

This view

  • Original page
  • New address

GeezerVison is showing reference.wolfram.com — NumericFunction—Wolfram Documentation

NumericFunction

is an attribute that can be assigned to a symbol f to indicate that f[arg1,arg2,…] should be considered a numeric quantity whenever all the argi are numeric quantities.

Details
Details and Options Details and Options
Examples  
Basic Examples  
Scope  
Applications  
Properties & Relations  
See Also
Tech Notes
Related Guides
History
Cite this Page

NumericFunction

NumericFunction

is an attribute that can be assigned to a symbol f to indicate that f[arg1,arg2,…] should be considered a numeric quantity whenever all the argi are numeric quantities.

Details

  • Most standard built‐in mathematical functions have the attribute NumericFunction.
  • NumericQ checks the NumericFunction attribute of every function it encounters.
  • If you assign the attribute NumericFunction to a function that does not yield numerical values, then NumericQ will give misleading results. »

Examples

open all close all

Basic Examples  (1)

Log has the NumericFunction attribute:

Wolfram Language code: Attributes[Log]

When Log has an argument that is a number, constant, or numeric, the result is numeric:

Wolfram Language code: NumericQ[Log[2]]

In most cases when NumericQ[expr] gives True, then N[expr] yields an explicit number:

Wolfram Language code: N[Log[2]]

Scope  (1)

Define f to be a numeric function:

Wolfram Language code: SetAttributes[f, NumericFunction]

If you have not assigned f to yield numerical values, then NumericQ gives misleading results:

Wolfram Language code: NumericQ[f[2]]
Wolfram Language code: N[f[2]]

Assign f to evaluate for arguments that are approximate numbers:

Wolfram Language code: f[x_ ? InexactNumberQ] := Precision[x] - Accuracy[x]
Wolfram Language code: N[f[2]]

Applications  (2)

Consider the following two function definitions, where one has the NumericFunction attribute:

Wolfram Language code: SetAttributes[f1, NumericFunction]; f1[x_ ? InexactNumberQ] := Log[x] f2[x_ ? InexactNumberQ] := Log[x]

Define a function that evaluates faster for numeric input than for arbitrary input:

Wolfram Language code: g[x_ ? NumericQ] := N[x] ^ 2 g[x_] := (Pause[1];N[x] ^ 2)

The evaluation of is faster when it is able to recognize that its argument can be treated as numeric:

Wolfram Language code: AbsoluteTiming[g[f1[1]]]
Wolfram Language code: AbsoluteTiming[g[f2[1]]]

Define a function that can represent an exact value:

Wolfram Language code: SetAttributes[f, NumericFunction];

Assign N[f[a]] to give the derivative with respect to a of the solution of an ODE at :

Wolfram Language code: N[f[a_], {prec_, acc_}] := Block[{x, t, xa, wp = If[prec == MachinePrecision, prec, 2 * prec]}, First[xa[1] /. NDSolve[{x''[t] + Sin[a x[t]] == 0, xa''[t] + x[t]Cos[a x[t]] == 0, x[0] == 1, x'[0] == xa[0] == xa'[0] == 0}, {x, xa}, {t, 0, 1}, WorkingPrecision -> wp, Method -> "Extrapolation"]]]

Assign f for approximate numbers:

Wolfram Language code: f[a_ ? InexactNumberQ] := Block[{x, t, xa}, First[xa[1] /. NDSolve[{x''[t] + Sin[a x[t]] == 0, xa''[t] + x[t]Cos[a x[t]] == 0, x[0] == 1, x'[0] == xa[0] == xa'[0] == 0}, {x, xa}, {t, 0, 1}, WorkingPrecision -> Precision[a], Method -> "Extrapolation"]]]

f[1] does not evaluate but represents a number:

Wolfram Language code: {f[1], NumericQ[f[1]]}
Wolfram Language code: N[f[1]]

It will work with any precision (within reasonable limits!):

Wolfram Language code: N[f[1], 32]

A plot of the function:

Wolfram Language code: Plot[f[a], {a, 0, 10}]

Properties & Relations  (2)

Sin has the attribute NumericFunction:

Wolfram Language code: Attributes[Sin]

The NumericFunction attribute informs NumericQ that Sin[1] can be converted into a number when using N:

Wolfram Language code: NumberQ[N[Sin[1]]]

NumericQ can return True without having to evaluate N[Sin[1]]:

Wolfram Language code: NumericQ[Sin[1]]

Note that NumberQ returns False:

Wolfram Language code: NumberQ[Sin[1]]

Some of the system symbols that are numeric functions:

Wolfram Language code: RandomSample[Select[Names["System`*"], MemberQ[Attributes[#], NumericFunction]&], 10]

See Also

NumericQ  NHoldAll  N

Tech Notes

    ▪
  • Attributes
  • ▪
  • Numeric Quantities

Related Guides

    ▪
  • Attributes

History

Introduced in 1996 (3.0)

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

Text

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

CMS

Wolfram Language. 1996. "NumericFunction." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/NumericFunction.html.

APA

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

BibTeX

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

BibLaTeX

@online{reference.wolfram_2026_numericfunction, organization={Wolfram Research}, title={NumericFunction}, year={1996}, url={https://reference.wolfram.com/language/ref/NumericFunction.html}, note=[Accessed: 12-November-2026]}

Top
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.