 |
3.1.9 Advanced Topic: Controlling Numerical Evaluation
| NHoldAll | prevent any arguments of a function from being affected by N | | NHoldFirst | prevent the first argument from being affected | | NHoldRest | prevent all but the first argument from being affected |
Attributes for controlling numerical evaluation. | Usually N goes inside functions and gets applied to each of their arguments. | |
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. | |
Out[3]=
|
|
|
|
|