1
$\begingroup$

This is kind of an odd question, and I'm not well educated in math, but bear with me.

I need a procedure similar to taking the average of a bunch of numbers, except I want large changes in one of the values in the input to cause a larger change in the output than you get with normal arithmetic mean.

Basically I want {2, 2, 2, 5} to "average" to something a little bit more than 3, and {2, 2, 2, 100} to "average" to something a lot more than 26.5.

Does that make sense? Is there a function that behaves like this?

$\endgroup$
3
  • $\begingroup$ Can I ask why you need this? $\endgroup$
    – Ben Longo
    Nov 14, 2015 at 0:59
  • $\begingroup$ @BenLongo Basically, I need a set of pixels to have colors "flow" through them. The way I have it now, each pixel's color is the average of the color of all adjacent pixels. The trouble is that changes in color are nullified more quickly than I want. $\endgroup$
    – Schilcote
    Nov 14, 2015 at 1:26
  • $\begingroup$ Interesting, have you looked into using something like a Gaussian matrix for weights? You may also want to check this out. $\endgroup$
    – Ben Longo
    Nov 14, 2015 at 1:51

1 Answer 1

2
$\begingroup$

A fairly well-known mean that may suit your needs is the root mean square, which is the square root of the mean of the squares.

$$\sqrt{\frac{1}{4}(2^2+2^2+2^2+5^2)}\approx 3.04$$

$$\sqrt{\frac{1}{4}(2^2+2^2+2^2+100^2)}\approx 50.03$$

This is an example of a power mean. $m=2$ gives the above, $m=1$ gives the arithmetic mean. If you want more extreme means, just let $m$ get larger.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .