is an attribute which specifies that the first argument to a function should not be affected by N.
NHoldFirst
is an attribute which specifies that the first argument to a function should not be affected by N.
Examples
open all close allBasic Examples (1)
Prevent N from affecting the first argument of a function:
SetAttributes[f, NHoldFirst]N[f[3, Pi]]N[f[Pi, E], 20]Scope (2)
System symbols with the NHoldFirst attribute:
ssymb = Cases[Map[ToExpression, Names["System`*"]], _Symbol];
Select[ssymb, MemberQ[Attributes[#], NHoldFirst]&]The ![]()
zero of the zeta function on the critical line with the imaginary part greater than
:
zz20 = ZetaZero[20, t + Pi]N does not affect the index
:
N[zz20]When the second argument is numeric, N evaluates numerically:
N[zz20 /. t -> 1]Applications (1)
e : binv[k_Integer, x_ ? InexactNumberQ] := With[{r = Quiet[Check[z /. FindRoot[BesselJ[k, z] - x, {z, 0}, WorkingPrecision -> Precision[x]], $Failed]]}, r /; NumberQ[r]]Set the NHoldFirst attribute so that
remains an integer:
SetAttributes[binv, NHoldFirst]A symbolic representation of an inverse of
:
binv[1, x]This remains unmodified with N:
N[%]With a numeric value of x, the function binv evaluates numerically:
N[binv[1, 1 / Pi]]Properties & Relations (1)
HoldFirst prevents evaluation while NHoldFirst only prevents numerical evaluation:
SetAttributes[f1, HoldFirst]f1[1 + 2, 3 + 4]N[%]SetAttributes[f2, NHoldFirst]f2[1 + 2, 3 + 4]N[%]You can prevent both by setting both attributes:
SetAttributes[f, {HoldFirst, NHoldFirst}]f[1 + 2, 3 + 4]N[%]See Also
Tech Notes
Related Guides
History
Introduced in 1996 (3.0)
Text
Wolfram Research (1996), NHoldFirst, Wolfram Language function, https://reference.wolfram.com/language/ref/NHoldFirst.html.
CMS
Wolfram Language. 1996. "NHoldFirst." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/NHoldFirst.html.
APA
Wolfram Language. (1996). NHoldFirst. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/NHoldFirst.html
BibTeX
@misc{reference.wolfram_2026_nholdfirst, author="Wolfram Research", title="{NHoldFirst}", year="1996", howpublished="\url{https://reference.wolfram.com/language/ref/NHoldFirst.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_nholdfirst, organization={Wolfram Research}, title={NHoldFirst}, year={1996}, url={https://reference.wolfram.com/language/ref/NHoldFirst.html}, note=[Accessed: 12-June-2026]}