Temporarily prevent expressions from evaluating so that you can work with them symbolically.

Using Hold or HoldForm...

Wrap an expression with Hold or HoldForm

Prevent an expression from evaluating by wrapping it with Hold:

Use HoldForm to hold an expression and suppress the wrapper on output:

Operate on the expression

Modify the expression; for example, replace Reverse with Sort:

Evaluate the expression

Apply ReleaseHold to remove any instances of Hold or HoldForm in an expression, allowing it to evaluate completely:

Using Inactive and Inactivate...

Inactivate a function or functions

Wrap a function with Inactive to prevent it from evaluating. Arguments of inactivated functions are evaluated, but not the inactivated functions themselves:

In[5]:=
Click for copyable input

Apply Inactivate to an entire expression to inactivate all of the functions in the expression:

In[6]:=
Click for copyable input

Use InputForm to see where Inactive has been applied:

In[7]:=
Click for copyable input
Out[7]=
  • In StandardForm, inactivated functions are displayed in gray.

Operate on the expression

Modify the expression. For example, replace 1 with 10:

In[8]:=
Click for copyable input
Out[8]=

Evaluate the expression

Apply Activate to remove any instances of Inactive in an expression, allowing it to evaluate completely:

In[9]:=
Click for copyable input
Out[9]=

Specify a pattern to activate only functions that match the pattern: