Python implementation of Arithmetic, quasi arithmetic and other aggregating functions

# Means

Means, Aggregation functions...

#### Example 1:

Mix numpy and pure python example:

import numpy as np
t1 = [0.0, 0.0, 0.0, 0.0, 0.1]
t2 = [1 - x for x in t1]
mean1 = np.mean(t1)
mean2 = np.mean(t2)
print(t1, mean1)
print(t2, mean2)


In output we can see that returned value does not sum to 1. It have impact on comparasion

>>> [0.0, 0.0, 0.0, 0.0, 0.1] 0.02
>>> [1.0, 1.0, 1.0, 1.0, 0.9] 0.9800000000000001


#### Using 1:

from aggregationslib.aggregation import arithmetic

t1 = [0.0, 0.0, 0.0, 0.0, 0.1]
t2 = [1 - x for x in t1]
mean1 = arithmetic_(t1)
mean2 = arithmetic_(t2)
print(t1, mean1)
print(t2, mean2)


In implementation we obtain exact number:

>>> [0.0, 0.0, 0.0, 0.0, 0.1] 0.02
>>> [1.0, 1.0, 1.0, 1.0, 0.9] 0.98


exponential(y, r=1) is given by equation $A_6^{(r)}(x_1,...,x_n)= \frac{1}{r}\ln \Big(\frac{1}{n} \sum \limits_{k=1}^{n} e^{rx_k}\Big)$, where $r \in \mathbb{R}$, $r \neq 0$

arithmetic(y)

geometric(y)

harmonic(y)

power(y, r=1)

# 6

exponential(y, r=1)

lehmer(y, r=0)

# 8

arithmetic_min(y, p=0)

# 9

arithmetic_max(y, p=0)

median(y)

# 11

olimpic(y)

## Project details

This version 0.0.251 0.0.24 0.0.23 0.0.22 0.0.1

Uploaded source