In order to do some data resampling so I can align certain time series, I need to modify some sets of numbers. I have a sequence of 563 data points, nominally divided into chunks of 30 values. I expected 570 values. I need to average chunks of 30 to get meaningful output. That leaves one unfortunate chunk of 23 values, and the math question arose:
How can I add an arbitrary number of values to a set without altering the average of the set?
Suppose one had the set
$$ X = \{x_1, x_2, x_3\ldots x_n\} $$ which has the average of $$ \overline{X} = \frac{1}{N}\sum_{n=0}^{N}x_n $$ How would I construct the numbers $x_{n+m}$ for arbitrary $m$ to make a new set $$ X'=\{x_1, x_2, x_3 \ldots x_n, x_{n+1},x_{n+2}\ldots x_{n+m}\} $$ such that $$ \overline{X}=\overline{X'} $$