This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)
 Documentation / Mathematica / The Mathematica Book / Principles of Mathematica / Expressions  /

2.1.1 Everything Is an Expression

Mathematica handles many different kinds of things: mathematical formulas, lists and graphics, to name a few. Although they often look very different, Mathematica represents all of these things in one uniform way. They are all expressions.
A prototypical example of a Mathematica expression is f[x,y]. You might use f[x,y] to represent a mathematical function . The function is named f, and it has two arguments, x and y.
You do not always have to write expressions in the form f

[x,y, ... ]. For example, x+y is also an expression. When you type in x+y, Mathematica converts it to the standard form Plus[x,y]. Then, when it prints it out again, it gives it as x+y.
The same is true of other "operators", such as ^ (Power) and / (Divide).
In fact, everything you type into Mathematica is treated as an expression.

Some examples of Mathematica expressions.

You can see the full form of any expression by using FullForm[expr].

  • Here is an expression.
  • In[1]:= x + y + z


  • This is the full form of the expression.
  • In[2]:= FullForm[%]


  • Here is another expression.
  • In[3]:= 1 + x^2 + (y + z)^2


  • Its full form has several nested pieces.
  • In[4]:= FullForm[%]


    The object f in an expression f[x,y, ... ] is known as the head of the expression. You can extract it using Head[expr]. Particularly when you write programs in Mathematica, you will often want to test the head of an expression to find out what kind of thing the expression is.

  • Head gives the "function name" f.
  • In[5]:= Head[f[x, y]]


  • Here Head gives the name of the "operator".
  • In[6]:= Head[a + b + c]


  • Everything has a head.
  • In[7]:= Head[{a, b, c}]


  • Numbers also have heads.
  • In[8]:= Head[23432]


  • You can distinguish different kinds of numbers by their heads.
  • In[9]:= Head[345.6]


    Functions for manipulating expressions.