Finding $\sum_i^nx_iI(x_i>0)$ given limited knowledge of sequence $x$

15 Views Asked by At

I want to find $$\sum_{i=1}^nx_iI(x_i>0)$$ but given only knowledge of $\sum_{i=1}^nx_i$ and $\sum_{i=1}^n|x_i|$ and $n$. Is this possible if $x$ is a real number?

Where $I(\text{[cond]})$ is indicator function returning $1$ if [cond] is true, and $0$ otherwise.

1

There are 1 best solutions below

0
On BEST ANSWER

Sure. Let $S=\sum x_i$ and write it as $S=S_+ + S_-$ where $S_+$ is the desired sum over the terms $>0$ and $S_-$ is the sum over the terms $<0$.

Then $P=\sum |x_i|=S_+ - S_-$ So $$S_+=\frac 12\times \left(S+P\right)$$

Note: we don't need to know $n$.