GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing reference.wolfram.com — NumericFunction—Wolfram Documentation 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
Examples
Basic Examples
Scope
Applications
Properties & Relations
See Also
Tech Notes
Related Guides
History
Cite this Page
NumericFunctionis 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
Examplesopen all close allBasic Examples (1)Log has the NumericFunction attribute: Attributes[Log]When Log has an argument that is a number, constant, or numeric, the result is numeric: NumericQ[Log[2]]In most cases when NumericQ[expr] gives True, then N[expr] yields an explicit number: N[Log[2]]Scope (1)Define f to be a numeric function: SetAttributes[f, NumericFunction]If you have not assigned f to yield numerical values, then NumericQ gives misleading results: NumericQ[f[2]]N[f[2]]Assign f to evaluate for arguments that are approximate numbers: f[x_ ? InexactNumberQ] := Precision[x] - Accuracy[x]N[f[2]]Applications (2)Consider the following two function definitions, where one has the NumericFunction attribute: SetAttributes[f1, NumericFunction];
f1[x_ ? InexactNumberQ] := Log[x]
f2[x_ ? InexactNumberQ] := Log[x]Define a function g[x_ ? NumericQ] := N[x] ^ 2
g[x_] := (Pause[1];N[x] ^ 2)The evaluation of AbsoluteTiming[g[f1[1]]]AbsoluteTiming[g[f2[1]]]Define a function that can represent an exact value: SetAttributes[f, NumericFunction];Assign N[f[a]] to give the derivative with respect to a of the solution of an ODE at 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: 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: {f[1], NumericQ[f[1]]}N[f[1]]It will work with any precision (within reasonable limits!): N[f[1], 32]A plot of the function: Plot[f[a], {a, 0, 10}]Properties & Relations (2)Sin has the attribute NumericFunction: Attributes[Sin]The NumericFunction attribute informs NumericQ that Sin[1] can be converted into a number when using N: NumberQ[N[Sin[1]]]NumericQ can return True without having to evaluate N[Sin[1]]: NumericQ[Sin[1]]Note that NumberQ returns False: NumberQ[Sin[1]]Some of the system symbols that are numeric functions: RandomSample[Select[Names["System`*"], MemberQ[Attributes[#], NumericFunction]&], 10]Tech NotesRelated GuidesHistoryIntroduced in 1996 (3.0)
Wolfram Research (1996), NumericFunction, Wolfram Language function, https://reference.wolfram.com/language/ref/NumericFunction.html.
TextWolfram Research (1996), NumericFunction, Wolfram Language function, https://reference.wolfram.com/language/ref/NumericFunction.html. CMSWolfram Language. 1996. "NumericFunction." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/NumericFunction.html. APAWolfram 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]} |
| 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. |