Search
Expressions II
Untitled (the Wolfram Language for Students - Personal Use Only : www.wolfram.com)

Expressions

We have dealt quite a bit with expressions

e.g.

Expressions_2_1.png

Expressions_2_2.png

Expressions_2_3.png

Expressions_2_4.png

Expressions_2_5.png

Expressions_2_6.png

Lists...

Expressions_2_7.png

Expressions_2_8.png

Plots...

Expressions_2_9.png

Expressions_2_10.gif

Equations...

Expressions_2_11.png

Expressions_2_12.png

Functions

Expressions_2_13.png

Rules

Expressions_2_14.png

Expressions_2_15.png

More complicated expressions

Let’s return to our quadratic equation

Expressions_2_16.png

Expressions_2_17.png

We can decompose it into atoms:

Expressions_2_18.png

Expressions_2_19.png

We see that this expression is created using nested symbols and numbers

The nested structure can be visualized intuitively using TreeForm

Expressions_2_20.png

Expressions_2_21.gif

Extracting parts of expressions

We can programmatically extract parts of expressions:

Recall:

Expressions_2_22.png

Expressions_2_23.gif

The root of the expression tree can be obtained by calling Head

Expressions_2_24.png

Expressions_2_25.png

This is always the same thing as getting the 0th index:

Expressions_2_26.png

Expressions_2_27.png

The “levels” of this tree can be extracted using Level

Expressions_2_28.png

Expressions_2_29.png

Expressions_2_30.png

Expressions_2_31.png

Expressions_2_32.png

Expressions_2_33.png

Expressions_2_34.png

Expressions_2_35.png

Expressions_2_36.png

Expressions_2_37.png

More sophisticated expressions

Expressions_2_38.png

Expressions_2_39.gif

Expressions_2_40.png

Expressions_2_41.png

Holding expressions

Consider the expression

Expressions_2_42.png

Expressions_2_43.png

Expressions_2_44.png

Expressions_2_45.png

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

Expressions_2_46.png

Expressions_2_47.png

Expressions_2_48.png

Expressions_2_49.gif

Hold can be released using ReleaseHold

Expressions_2_50.png

Expressions_2_51.png