Mathematica is built on the powerful unifying idea that everything can be represented as a symbolic expression.
All symbolic expressions are built up from combinations of the basic form:
A list of elements
An algebraic expression
An equation
A logic expression
A command
Graphics
Abstract mathematical notation
A button
A cell in a notebook
The uniformity of symbolic expressions makes it easy to add to Mathematica any construct you want.
A chemical compound
An electric circuit
All operations in Mathematica are ultimately transformations of symbolic expressions. Mathematica has a uniquely powerful pattern matcher for applying transformation rules.
The /. tells Mathematica to apply a simple transformation rule.
x_ and y_ each stand for any expression, so the pattern x_+ y_ stands for a sum of terms.
Mathematica uses patterns to generalize the notion of functions.
Mathematica uses patterns to generalize the notion of functions. This is an ordinary function definition to be used for any x.
Here is a special case that overrides the general definition.
Here is an example of the use of f.
This clears the definitions given for f.
An important feature of using patterns is that they allow "functions" to take arguments in any structure.
Using patterns allows "functions" to take arguments in any structure.
This specifies the value for the "function" area when given a Circle object as an argument.