Further Examples: Blank (_)
Patterns, Rules, and Replacement
This rule can be used to replace the logarithm of a power in the usual way.
Rules are applied using the slash-dot operator.
As an aside, this rule is not built into Mathematica because it is not correct in general.
However, the built-in function PowerExpand does such transformations.
Patterns in Function Definitions
You can often simplify the definition of a function by putting the arguments in a suitable form and naming the important parts. In this case we are avoiding the use of [] (Part).
To make this definition without pattern matching, you would need to use a module, local variables, conditionals, and some complicated constructions to get at the right pieces.
We clear the definitions.
The output you see from Mathematica is designed for human eyes. Expressions that look the same may be structurally different. FullForm reveals the internal representation of expressions.
In this example, notice that the second square root is not transformed to become 1/s.
FullForm shows that the representation of the square root depends on whether it is in the numerator or the denominator.
One rule is needed for each case, and these can be put together in a list.