Mathematic formula for deriving a mean
In mathematics, the Lehmer mean of a tuple
of positive real numbers, named after Derrick Henry Lehmer,[1] is defined as:
![{\displaystyle L_{p}(\mathbf {x} )={\frac {\sum _{k=1}^{n}x_{k}^{p)){\sum _{k=1}^{n}x_{k}^{p-1))}.}](https://wikimedia.org/api/rest_v1/media/math/render/svg/fa27b99725e5e200af66262f2c0b51a0e9453561)
The weighted Lehmer mean with respect to a tuple
of positive weights is defined as:
![{\displaystyle L_{p,w}(\mathbf {x} )={\frac {\sum _{k=1}^{n}w_{k}\cdot x_{k}^{p)){\sum _{k=1}^{n}w_{k}\cdot x_{k}^{p-1))}.}](https://wikimedia.org/api/rest_v1/media/math/render/svg/442ab5dc0ad6b2cb1dfb9f91b58e32a4a3ef72e4)
The Lehmer mean is an alternative to power means
for interpolating between minimum and maximum via arithmetic mean and harmonic mean.
Properties
The derivative of
is non-negative
![{\displaystyle {\frac {\partial }{\partial p))L_{p}(\mathbf {x} )={\frac {\left(\sum _{j=1}^{n}\sum _{k=j+1}^{n}\left[x_{j}-x_{k}\right]\cdot \left[\ln(x_{j})-\ln(x_{k})\right]\cdot \left[x_{j}\cdot x_{k}\right]^{p-1}\right)}{\left(\sum _{k=1}^{n}x_{k}^{p-1}\right)^{2))},}](https://wikimedia.org/api/rest_v1/media/math/render/svg/54d85f18b17a36f3605fdbded105ff4ba51e8a96)
thus this function is monotonic and the inequality
![{\displaystyle p\leq q\Longrightarrow L_{p}(\mathbf {x} )\leq L_{q}(\mathbf {x} )}](https://wikimedia.org/api/rest_v1/media/math/render/svg/ae9e806245dcb0878568dd1161f3ea900b5dd0d9)
holds.
The derivative of the weighted Lehmer mean is:
![{\displaystyle {\frac {\partial L_{p,w}(\mathbf {x} )}{\partial p))={\frac {(\sum wx^{p-1})(\sum wx^{p}\ln {x})-(\sum wx^{p})(\sum wx^{p-1}\ln {x})}{(\sum wx^{p-1})^{2))))](https://wikimedia.org/api/rest_v1/media/math/render/svg/f14c069e3015d855f8305cdf2d5c3802bfc3f62e)
Applications
Signal processing
Like a power mean, a Lehmer mean serves a non-linear moving average which is shifted towards small signal values for small
and emphasizes big signal values for big
. Given an efficient implementation of a moving arithmetic mean called smooth
you can implement a moving Lehmer mean according to the following Haskell code.
lehmerSmooth :: Floating a => ([a] -> [a]) -> a -> [a] -> [a]
lehmerSmooth smooth p xs =
zipWith (/)
(smooth (map (**p) xs))
(smooth (map (**(p-1)) xs))
Gonzalez and Woods call this a "contraharmonic mean filter" described for varying values of p (however, as above, the contraharmonic mean can refer to the specific case
). Their convention is to substitute p with the order of the filter Q:
![{\displaystyle f(x)={\frac {\sum _{k=1}^{n}x_{k}^{Q+1)){\sum _{k=1}^{n}x_{k}^{Q))}.}](https://wikimedia.org/api/rest_v1/media/math/render/svg/93c997965c740dd77ac0772b110c379562083100)
Q=0 is the arithmetic mean. Positive Q can reduce pepper noise and negative Q can reduce salt noise.[2]