# $$\text{Average}$$¶

You can use the ::math:\text{Average} function to calculate the average value from a list of values.

You can use the \average backslash command to insert this function.

The following variants of this function are available:

• $$\text{complex } \text{Average} \left ( \ldots \right )$$

You can supply a list containing, single values, sets, tuples, and matrices. The average will be calculated using all the supplied basic values. If you supply a set or tuple containing other iterable types, then those types will also be recursively iterated over to locate basic values.

Note that run-time type conversion allows the result of this function to be assigned to any basic type provided the returned value is compatible with that type.

Below is a basic example using the $$Average$$ function.

$a = \text{Average } \left ( 1, 2, 4 \right )$
$\text{a = 2.3333333333333334814}$

The example below shows how you can determine the average value across sets and tuples.

$t = \left ( 1, 2, 4 \right )$
$s = \left \lbrace 5, 7, 4 \right \rbrace$
$b = \text{Average } \left ( t, s \right )$
$\text{b = 3.833333333333333333348136}$

You can also find the average through more complex constructs.

$t _ 1 = \left ( 1, 2, 4 \right )$
$s _ 1 = \left \lbrace 3, 5, 9 \right \rbrace$
$s _ 2 = \left \lbrace t _ 1, s _ 1 \right \rbrace$
$c = \text{Average } s _ 2$
$\text{c = 4}$