(Function|Operator) - Associative Property

> Code - (Programming|Computer) Language > (Function | Operator | Map | Mapping | Transformation | Method | Rule | Task | Subroutine)

1 - Definition

An operator or function op is associative if the following holds:

<MATH> (a \text{ op } b) \text{ op } c == a \text{ op } (b \text{ op } c) </MATH>
Advertising

3 - Parallel

The importance of this to parallel evaluation can be seen if we expand this to four terms:

<MATH> a \text{ op } b \text{ op } c \text{ op } d == (a \text{ op } b) \text{ op } (c \text{ op } d) </MATH>

So we can evaluate (a op b) in parallel with (c op d), and then invoke op on the results.

4 - Linear Algebra

Associativity of function composition:

<math>h \circ (g \circ f) = (h \circ g) \circ f</math>
<math>(h \circ (g \circ f))(x)</math>

=

<math>h(g \circ f)(x)</math>


<math>h(g(f(x)))</math>


<math>(h \circ g)(f(x))</math>


<math>((h \circ g) \circ f)(x)</math>

5 - Example

Examples of associative operations include:

<MATH> (x + y) + z = x + (y + z) </MATH>
Advertising

6 - Documentation / Reference

code/function/associative.txt · Last modified: 2017/11/16 22:38 by gerardnico