Normalise rest of list I have an list of fractions as such:
sum(3/10, 1/2, 1/5) = 1

and I multiply some element (the second in this case) by some known factor (1/2 here):
sum(3/10, 1/4, 1/5) != 1

So the answer would be:
sum(????, 1/4, ???) == 1, where arr[0] and arr[2] are proportionate to their original values.

How can I normalise the rest of the array, so that the array still sums to 1, but the second element remains the same (1/4 in this case) and the rest of the elements are proportionately changed? I've tried adding/multiplying the rest of the elements by the factor but it doesn't work.

A general solution where you can have the ratio according to the array numbers.
Let the 3 numbers in your array be : $x,\ y,\ z$
Condition 1:
$$x+y+z = 1$$
where $y= \frac{1}{2}$
Condition 2:
You have scaled $y$ by ratio of $0.5$, let us scale the other 2 numbers by $\alpha$
$$\alpha x+ 0.25 + \alpha y = 1$$
So the 2 equations are:
$$x+z = \frac{1}{2}$$
$$\alpha x+\alpha z = \alpha(x+z) = \frac{3}{4} $$
$$\alpha = \frac{3\times2}{4}= \frac{3}{2}$$
Hope this helps...
