NHoldAll
Details
- NHoldAll, NHoldFirst, and NHoldRest are useful in ensuring that arguments to functions are maintained as exact integers, rather than being converted by N to approximate numbers.
Examples
open allclose allBasic Examples (1)
Prevent N from affecting the arguments of a function:
Scope (3)
System symbols with the NHoldAll attribute:
The arguments of Derivative remain unchanged with N:
N leaves the derivative order while changing the point of evaluation:
The function with coefficients converted to numerical values:
The positional parameters remain unchanged with N because Slot has the NHoldAll attribute:
Applications (2)
With this attribute, the variables remain unchanged:
Define a data object that represents a polynomial in a sparse form :
Make sure that N only affects the coefficients, not the powers:
Default N evaluation of the argument needs to be prevented for the rule above to work:
A representation of the polynomial :
Text
Wolfram Research (1996), NHoldAll, Wolfram Language function, https://reference.wolfram.com/language/ref/NHoldAll.html.
CMS
Wolfram Language. 1996. "NHoldAll." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/NHoldAll.html.
APA
Wolfram Language. (1996). NHoldAll. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/NHoldAll.html