# recurrence relation – Calculate \$ sum_ {i} | sum_ {j} x_ {i, j} – sum_ {j} y_ {i, j} | \$ online

Can this formula be calculated online in a single pass, with a constant number of computation variables (for example, the memory used is $$O (1)$$ as opposed to $$O (j)$$). I take pairs $$(x, y)$$:
$$sum_ {i} left | sum_ {j} x_ {i, j} – sum_ {j} y_ {i, j} right |$$
The absolute value can be replaced by a square if that makes things easier. In fact, any monotonous replacement for $$| x |$$ work.

My minds:
I know you can reduce the medium term to $$sum_j x_ {i, j} -y_ {i, j}$$. So that you can accumulate $$j$$ temporary values ​​with this summation; then $$sum_i | mathrm {temp} _i |$$. The problem is, the size of $$i$$ pushes very fast, so I want to see if the elimination of the temporary accumulation chart is possible. It's been a while since I fiddle with the formula to try to find something, but nothing works. Is there something in the absolute value that seems to make it insoluble? I thought maybe it had something to do with Simpson's paradox.

Another idea was to summarize some basic statistics on $$x$$ and $$y$$, and maybe the calculation is equivalent to a calculation on statistics. However, I do not have much luck there; perhaps another application of Simpson's paradox, I'm not sure.

Maybe the integration of Monte Carlo could be applied here?

Posted on