This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
 Documentation / Mathematica / The Mathematica Book / Advanced Mathematics / Numbers  /

3.1.9 Advanced Topic: Controlling Numerical Evaluation


Attributes for controlling numerical evaluation.

  • Usually N goes inside functions and gets applied to each of their arguments.
  • In[1]:= N[f[2/3, Pi]]

    Out[1]=

  • This tells Mathematica not to apply N to the first argument of f.
  • In[2]:= SetAttributes[f, NHoldFirst]

  • Now the first argument of f is left in its exact form.
  • In[3]:= N[f[2/3, Pi]]

    Out[3]=