Use Inactive for Debugging a Program 

By activating parts of a program in stages, Inactive can assist the debugging process.

The following program contains an error.

In[1]:=
Click for copyable input
X

Multiple messages are produced, and the integral returns unevaluated.

In[2]:=
Click for copyable input
X
Out[2]=

Create an inactive version of the program.

In[3]:=
Click for copyable input
X
In[4]:=
Click for copyable input
X
Out[4]=

Everything looks fine, so try activating the function .

In[5]:=
Click for copyable input
X
Out[5]=

A message is produced, and the inner NIntegrate shows failed to evaluateit is missing its second argument. Correct the definition.

In[6]:=
Click for copyable input
X

Now evaluation proceeds correctly.

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