MemberQ
The first example is simple. MemberQ finds that the sum includes (x) to an
Integer power.
You might wonder why MemberQ doesn't return True in this case. The reason is
that the default level specification doesn't have MemberQ check the whole
expression.
Next MemberQ is given a level specification that has it check all levels including the whole expression, and True is returned.
Next the default level specification stops MemberQ from looking deep enough to find the .
In the next example MemberQ is given a level specification deep enough to find the .
I don't provide further examples, but any combination of pattern matching constructs can be used with MemberQ. Nuances of pattern matching are discussed in another section.
Heads Option
MemberQ has a Heads option with the default setting (Heads→False). So
in the next example MemberQ doesn't check the heads of subexpressions.
In the next example the setting (Heads→True) is used and MemberQ does
check the heads of subexpressions.
Created by Mathematica (May 16, 2004)