NHoldRest

NHoldRest

is an attribute which specifies that all but the first argument to a function should not be affected by N.

Examples

open allclose all

Basic Examples  (1)

Prevent N from affecting all but the first argument of a function:

Scope  (2)

System symbols with the NHoldRest attribute:

Use Part symbolically:

Using N does not affect the specified parts:

The expression works when x is substituted with a list:

Applications  (1)

Define a function that represents the real-valued root for positive and positive integer :

Prevent its second argument from being converted to real using NHoldRest:

An exact representation of the cube root of 2:

Machine-number approximation:

47-digit approximation:

Properties & Relations  (2)

Subscript by default has the NHoldRest attribute:

This means that subscripts generally do not change under N:

HoldRest prevents evaluation while NHoldRest only prevents numerical evaluation:

You can prevent both by setting both attributes:

Introduced in 1996
 (3.0)