Expressions
We have dealt quite a bit with expressions
e.g.
Lists...
Plots...
Equations...
Functions
Rules
More complicated expressions
Let’s return to our quadratic equation
We can decompose it into atoms:
We see that this expression is created using nested symbols and numbers
The nested structure can be visualized intuitively using TreeForm
Extracting parts of expressions
We can programmatically extract parts of expressions:
Recall:
The root of the expression tree can be obtained by calling Head
This is always the same thing as getting the 0th index:
The “levels” of this tree can be extracted using Level
More sophisticated expressions
Holding expressions
Consider the expression
Mathematica evaluates our input expression and converts it to a canonical form
If we want to maintain the original expression in unevaluated form, use Hold
Hold can be released using ReleaseHold