This is documentation for Mathematica 5, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

Documentation / Mathematica / Built-in Functions / Lists and Matrices / List Testing /

Further Examples: FreeQ

Here is a feature of FreeQ that is absent from MemberQ: FreeQ recognizes that the sum a+c is a subexpression of the larger sum.

In[1]:=

Out[1]=

Here we see how the level argument to FreeQ affects its result. When no level is specified, matches at any level are reported.

In[2]:=

Out[2]=

In[3]:=

Out[3]=

In[4]:=

Out[4]=

In[5]:=

Out[5]=

The default level specification of FreeQ is . (MemberQ's is .)

In[6]:=

Out[6]=

The default for the Heads option of FreeQ is True.

In[7]:=

Out[7]=

This gives True since except for the head, this expression is free of ww.

In[8]:=

Out[8]=

In[9]:=

Out[9]=

In[10]:=

See also the Further Examples for the Heads option.